XDebug, Laravel Valet, NetBeans

Screen Shot 2016-05-10 at 11.09.35.png

To get XDebug working with Laravel Valet & NetBeans, I needed to do the following:

  1. Install XDebug via Homebrew:
    brew install homebrew/php/php70-xdebug
  2. Enter NetBeans’s Preferences > PHP > Debugging:
    1. Change the port from 9000 to 9001.
      (This is because Valet runs on 9000 by default.)
    2. Uncheck “Stop at first line”.
      (This is because Valet is listening to all requests, and server.php will get hit a bunch of times in the same page refresh.)
  3. Edit /usr/local/etc/php/7.0/php.ini
  4. Add this bit to the end:
    [xdebug]
    xdebug.remote_enable=on
    xdebug.idekey="netbeans-xdebug"
    xdebug.remote_port=9001

    This turns on remote debugging, and tells XDebug to look for NetBeans’s IDE key.

  5. Restart Valet with valet restart in your favorite terminal app.
    Note that brew services restart php70 isn’t enough here; you need to restart Valet entirely.

Also…

Live debugging using XDebug will severely degrade Valet’s otherwise snappy performance. Composer will even tell you this:

You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug

This is normal. XDebug is a hugely powerful realtime interpreter, debugger, and profiler, and it’s going to slow things down while it’s listening to all that PHP chug along. (You may be able to tune this a bit using all of XDebug’s extensive settings.)

If you’re worried about battery life, most IDE’s (like NetBeans) will let you turn debug sessions on and off. So debug, do your thing, find the bug, kill the bug, and turn it off.

2016 MacBook

A few weeks ago, I upgraded from an 11″ MacBook Air to a 12″ MacBook. This is my review, my experience, and a few of my opinions & critiques.

The MacBook is the perfect successor to the 11″ Air.

Prologue

I loved my 11″ Air. It was the first Mac I’ve owned that didn’t suffer some sort of epic hardware failure that required it going away for several days. It traveled well. It aged well (enough) and with the i7 processor, it was plenty powerful for all of the work I needed it for.

But, it was the last of my non-retina screens, and it’s screen was surrounded by a thick faux-aluminum bezel that served as a constant reminder that it could have been bigger, better, and brighter. And it stood out as my only remaining silver Apple product, which triggered my OCD every time I used it.

My only real problem with the 11″ Air was a social one, needing to constantly justify it’s existence to colleagues & friends that have always had MacBook Pros. After a few dozen repeats I got my schtick down to a smooth pattern:

  • Great battery life
  • Super portable
  • Lack of screen real estate forces me to maximize my productive time
  • Great keyboard
  • Super fast & capable
  • Enough ports to still be useful as an octo-charger

The 12″ MacBook, as we all know by now, has only 1 port, and it’s not a problem in everyday life as much as it is when you’re just trying to get started using it.

Getting Started

Like any good Apple toting citizen, I back everything up to a Time Capsule (2 actually, at home and at my office.) If you’ve ever tried to restore from a Time Capsule over wifi, you’ll know that it feels like it takes a lifetime to move an entire machine’s worth of data over the air. I don’t really understand why this is, because it’s all local to the LAN, but after 14 hours of waiting to move over 180Gb, I decided to stop it mid-restore, format, and start from scratch instead.

This is a pain because the only port on this machine is USB-C, and it doesn’t come with a USB-C to ethernet adapter, and I wasn’t going to pony-up the extra $20 for a 1-time-use landfiller, so I couldn’t easily & quickly transfer my old data via a cabled connection.

I’ve reinstalled OS X and all of the tools I use to work enough times, that this entire process only took about 3 hours. I was up & running, did some actual work, and went to bed. The next morning, I commuted to the office, and opened by new MacBook only to be greeted with GPU-style artifacting on certain UI elements inside of various default OS X applications, like Safari, Messages, Mail, and Finder.

I’d seen this happen before, on my 2010 Mac Mini, so I performed the following trouble-shooting measures:

  • Logged into the Guest account, Safari worked okay
  • Created a new Admin account, everything still broken
  • Rebooted in Safe Mode, everything worked okay
  • Reset NVRAM, everything still broken
  • Reinstalled OS X, everything still broken
  • Reset SMC, machine would not reboot

Yeah… after attempting to reset the SMC, my brand new MacBook would not turn on. So, I assumed a trip to the Apple store was in my future, packed up for the day, came home, and gave it one last go. I held the power button down for what felt like a full minute, and low-and-behold, it chimes to life.

I log in, still broken.

Command-R restart, secure erase the drive (again) but this time… this time, I’m not encrypting the disk or turning File Vault on (gasp!) Why not? Because, in my experience, it’s just not reliable, which is the real value that Apple and OS X provide me in my daily life. So I reinstall everything (again) and it’s been right as rain ever since.

One time, my 2013 Mac Pro (ya know, the trash-can one) stalled halfway through the process of turning File Vault on. On reboot, it blew a GPU. (How these two actions could possibly be related, I have no idea.) Maybe the GPU was already bad; maybe me force-rebooting a locked-up machine caused the GPU to pop; whatever happened, it wasn’t worth another week in the shop for this brand new MacBook.

My frustrating experience getting started is maybe unique to me; I have high expectations from the machines I use (the heck out of) to pay my mortgage & help support my employees, but it pretty easy to get stuck quickly without much recourse. There is no USB port to, say, make a boot disk, or more quickly transfer your files without the use of an additional adapter. It requires placing a lot of trust in a convoluted process.

Review

The 12″ MacBook itself  is very pretty. It’s smaller than both the 11″ Air and the 12.9″ iPad Pro, but still manages to have a very usable keyboard, trackpad, screen, and enough processing power to not feel sluggish or bogged down.

Finish

Let’s start at the finish. I chose Space Black because it matches all of the other Apple devices I have (including the Apple TV remotes) and it replaces the last raw aluminum Apple product in my fleet. Just like every other Apple laptop, oil from your skin transfers to the case pretty quickly, resulting in somewhat unsightly wear marks. Unavoidable, really, but worth noting the anodizing hasn’t circumvented this at all.

And I like that the Apple logo doesn’t light up on the back of the screen. The new polished logo is subtle and unobtrusive, but still catches enough light from any angle to be distinctive and identifiable.

Keyboard

The keyboard didn’t take nearly as long to get used to as the rest of the web made it sound like it would, and I like that Apple used San Francisco on the key-caps. The back-lighting is subtle, with very little bleed between the keys, and it’s the first time since switching to Dvorak that I haven’t relocated the keys to their rightful Dvorak locations. I bought the tools to squeeze under the keys, but it hasn’t felt necessary for some reason (maybe I’m finally getting comfortable with touch typing Dvorak?)

My only gripe with the keyboard is that the left and right arrow keys are now full-height, and I get them confused with the “Option” and shift keys because there’s no discernible tactile difference. I spend an awful lot of my day navigating code, which means I reach for those keys relatively frequently. Instead of hanging my fingers off the left/right keys, I now need to search for the break between the up/down keys, and adjust from them.

Screen

The screen on the 12″ MacBook is pretty great, and even though it has less of a bezel than the 11″ Air (and what bezel there is, is black) I wish the screen were more edge-to-edge. I find the colors to be true to what I expect from Apple, and it’s nice to be fully converted to retina after only a few years worth of transitioning.

The bezel that is there, is part of the screen layer itself, so it’s easy to smudge it with your fingers while trying to adjust the display angle. I’m not sure how you fix this issue without an oleophobic coating or going back to the aluminum surround of the Air.

Hinge

The hinge that connects the screen-half to the keyboard half, is a bit wobbly. If you pay attention to any of the review videos online, you can watch the top-half wiggle around. I haven’t heard anyone mention this, but compared to the 11″ Air, this hinge feels less stiff, which has resulted in my treating this machine a bit more tenderly.

Processor

The m7 processor is adequate for my daily needs. There is no fan, which has the interesting psychological effect of never really knowing (or caring) what’s going on in the background anymore. Arguably, whatever little time I previously spent trying to clean-up after myself and the apps I use, I now spend doing other things.

The only time anything beachball’s is when there’s a problem. My most common problems are apps crashing, and they’re almost always apps that have some other huge dependency, like from Adobe or Java. It doesn’t seem like these are related to the hardware, but I mention them here to show that even a new machine has the same old problems.

Trackpad

The trackpad is nice. I don’t deep click very much, which could be a usage pattern of mine or could be Apple not making it compelling enough, but it’s nice to have edge-to-edge clicks. I am a drag-lock user (something I picked up from my Sony Vaio days) which continues to work nicely. If anything, the trackpad is maybe a bit large, and it’s happened a few times where my thumbs gently tap the pad enough to cause a touch-tap in OS X, but it’s a behavior that’s easy trained out.

Battery

Battery life is perceivably excellent. I don’t like the phrase “all day battery life” because it makes me feel bad about how much time I spend unplugged and working. My day is never done before my laptop is, to the point where I’ve practically rearranged my day around when the battery dies and when to switch to a different device.

Charging

The USB-C charger lacks the orange-green indicator available on every MagSafe adapter, so I usually use my MacBook until it’s about drained, then plug it in and switch to a different device until it’s fully charged again.

And even though USB-C supports up to 100 watts, the charger that’s packaged with the MacBook is only 29 watts. This means it takes almost 5 hours to get from empty to full, which could be sped up with proper wattage. This also means Apple will no-doubt release a higher wattage USB-C charger, and charge $80 for it.

And the 29 watt charging brick doesn’t have the wings on it to wrap the 2 meter long cable around – it’s a bit of a drag to go back to having a loose cable again. I’d suggest buying a shorter USB-C to USB-C cable for travel.

USB-C

Apple does do a good job of introducing new ideas slowly (getting people acclimated to the new while systematically weening off the old) but this MacBook could just have easily used a Lightning port instead.

I don’t really think this is the kind of laptop that begs for an external display, and this version of USB-C doesn’t support Thunderbolt, so you can’t easily plug in any of Apple’s external displays.

It’s frustrating as a consumer to have this new port shape in an otherwise Lightning ported ecosystem. Heck, even the Apple TV remotes and Apple Pencil’s use Lightning now.

Why bother with USB-C? It’s a way for Apple to get familiar with the intricacies of a new batch of protocols and possibilities, and with a limited and targeted sample size. (And let’s assume a Mac Pro refresh will come in 2017 with a bevy of USB-C ports vs. mixed USB-A/B & Thunderbolt ports.)

Speakers

I am more likely to use headphones than built-in laptop speakers, but the few times I’ve needed to crank up the volume to share a video or play some tunes so I could hear them in another room, they’ve been adequate (considering it’s thinness) in both clarity and loudness.

The headphone jack is oddly placed on the side opposite the charging port. Technically, it shares a board with the microphone and ambient co-processor, so it needs a little bit of dedicated room, but it seems like a compromise due to size constraints more than the “great intention” that Apple usually designs things with.

Epilogue

The 12″ MacBook is the perfect successor to the 11″ Air, and probably the 13″ Air, and maybe even the 13″ MacBook Pro. The future of professional computing is the same as the past, and it isn’t just in the cloud – it’s having an adequate client machine that can push computationally complex work towards more capable & properly tuned machines. (You likely will not use this MacBook to render 4k 3D animations, but you can easily use it to produce them, and ship the rendering off to a Mac Pro.)

I spend most of my day in iTerm, Netbeans, Safari, Sequel Pro, Paw, Mail, Messages, Slack, 1Password, and iTunes, with Vagrant and VirtualBox in the background. I write a lot, both communication and code. I listen to music and have movies on in the background. I have large photo and music libraries. I subscribe to all the Apple cloud stuff. The 12″ MacBook handles all of this for about 8 unplugged hours at a time.

If it can survive the way my 11″ Air did, this MacBook has the potential to be the best Mac I’ve ever owned, both in it’s simplicity and tenacity. If you’re on the fence about this or a Pro device, remember that being a professional isn’t just about having the best tools, it’s about using the right ones for the job. In my experience, the 12″ MacBook is Apple’s best tool for writing code, and something like a Mac Pro or a nice iMac is a better tool for running entire integration test suites.

Here’s the overview, incase you’re sold and want one of your own.❤

Screen Shot 2016-05-10 at 08.47.06.png

 

Slow Vagrant?

Maybe you’re a file hoarder, like me.

I switched to using VVV a few years ago, when it became cool to use Vagrant and when unit testing became a must-have part of my daily WordPress development process.

Truth be told, I’ve missed the simplicity of MAMP PRO ever since, even if I do prefer Nginx over Apache these days.

And if you’re like me, you never really delete stuff, it just goes someplace else. Git enables this; I pack away repositories like a squirrel, thinking that I’ll clone something now and peek at it later.

I have a 6 core Xeon powered Mac Pro at my office. It’s usually sitting idle as a task runner for all sorts of client work that requires a bit of additional TLC. I push some code from my MacBook to Gitlab; Gitlab tells my Mac Pro to make sure everything is still green; I move on to the next task.

So lately, my Mac Pro has seen abysmal performance when it comes to Vagrant related tasks. Things like up, ssh, and box update would take several minutes to complete. Last night, it took 6 hours to vagrant up --provision so I finally gave up and decided to figure out what the heck was going on.

Screen Shot 2016-05-05 at 12.58.27 PM.png
73 seconds to vagrant ssh.

I guess it was my own fault. I keep a local mirror of plugins.svn.wordpress.org on my Mac Pro, which pulls down about 70k WordPress plugins, creating over 339,000 directories.

Screen Shot 2016-05-05 at 1.02.06 PM.png
This kills the VVV.

What I discovered is that the number of directories in your VVV’s www directory can have a severely negative impact on the performance of your vagrant commands, even if those directories are largely dormant and do not contain a relative vvv-hosts or vvv-init.sh files to treat them as actual sites.

I have a few hunches about what’s causing the slow down, but haven’t the time to dig much deeper:

  • Guest Additions might front-load the directory tree, in such a way that locks the rest of Vagrant from proceeding, maybe part of the vagrant-vaguest plugin?
  • Some other plugin feels the need to traverse the directory tree without a max-depth flag
  • VVV or Vagrant have internally optimized for traditional web directories that do not have hundreds of thousands of directories

Hope this helps, and if you figure out the rest of this, drop me a comment!❤

WordCamp Chicago 2016

This weekend I’ll be driving down to WordCamp Chicago in my BRZ. It’s about 2 hours total from home to hotel, and I could use a playlist for the drive there and back.

I’ll be in Chicago chatting about the differences between BuddyPress and bbPress, and I’ll probably talk a bit about Prince, too. I’m on stage at 3pm, and I’d love it if you stopped by to say hi. 💜

Everything is a Variable

I like to say, that the job of a software engineer is to define variables, and honestly I don’t think it’s really much more than this. Everything in life starts off simple, and can end up as complex as you choose for it to be.

This process is traditionally called “architecting” and at one point in my career I was told I was a brilliant architect by someone I later came to admire quite a bit, Andrew Nacin. Whether or not that’s actually true, is irrelevant, because Andy said so and that’s all anyone should need to hear.

For most engineers, their accidental measure of success is how complex of a problem can I solve. This isn’t just true for software, but for all artists, makers, and creators – it’s a form of validating oneself to say you’ve leveled up and accomplished something more challenging than the time before. It’s learning, and evolving, and shaping your mind by enjoying new experiences, and it’s addicting like everything else in this world.

Ultimately, I think the thing that separates a good engineer from a bad engineer, is the ability to take complex ideas & relationships, and make them as simple to understand & interact with as possible, for as wide of an audience as possible.

In WordPress, this has traditionally meant introducing flexibility in the form of actions and filters, but for the future of WordPress development, this is about to change dramatically.

If you’re not familiar, WordPress developers have been living in a bubble compared to the rest of the PHP world, and this bubble is about to pop in a huge way when the ability to use versions of PHP higher than 5.2 becomes commonplace.

WordPress itself is a largely procedural codebase, meaning it’s relatively flat and simple. This was both by design, and by intention, because earlier versions of PHP had varying degrees of support for increasingly popular programming concepts. Future versions of WordPress will inevitably grow increasingly complex, but I for one am planning on sticking my neck out to ensure this happens only with great intention.

Once plugins and themes can (and will) start flexing more PHP muscle, the WordPress world has the potential to become a very scary place to work inside of, and it’s up to all of us to decide where to position the bar when it comes to code complexity and extensibility.

I’ve come across three WordPress based projects recently that appeared conceptually over-architected, re-solving problems in more complex ways than should have ever been required, considering the requirements and because APIs already existed to solve these problems in WordPress core.

I’m omitting the details from this post (we’re working it out, and my intention isn’t to negatively criticize) because I hope get people thinking deeply about what reusable code in WordPress has meant and should mean going forward. Here’s my take:

  • Code that others can quickly understand
  • Problems that others may need solving in their own projects
  • The ability to extend, unplug, replace, or override assumptions the code has made
  • Using existing code intended for it’s purpose, and sending upstream improvements if necessary to unblock your progress
  • It needs to be juice’able – shred it, direct it, blend it with any other code, and it will always act predictably

In the way that art mimics life, these rules are generally what I apply to real-life scenarios. If I can own (or build) a tool that solves many problems, and I can loan it out to someone that may need it, and that tool can be extended to suit many unique needs, it’s an obvious win. This might be a power drill, a table saw, a bucket, a car, a WordPress plugin, or just an idea I’ve had about some random life experience that’s worth sharing or blogging about.

If I can have 1 friend that I enjoy everything with, I’ll marry them so I can continue to enjoy everything they have to offer the world.❤

All of us are in different places, at different times, for different reasons, with different intentions and feelings and goals. We all have different experiences that lead us to unique conclusions about how to approach solving problems and addressing concerns and communicating our feelings. If you ask Mother Nature, this is not a bug, it’s a feature.

Each and every moment that passes results in new variables that require defining. What to eat, what to say, what not to say, how to say it, left or right, stop or go, yes or no. Engineers have trained their brains to quickly calculate the consequences of these rapid decisions, and we are difficult people to be around because we are 100 steps ahead and trying to think 101 steps backwards at the same time so what we do makes sense to the people around us.

So when I say that everything is a variable, I mean that it’s your responsibility to define the importance of the variables in your life to create a better tomorrow for the people around you. Hack the world, by being patient, and kind, considerate, and lovely. Learn how to recognize when someone needs help defining their own variables in their lives, and teach them how to in a healthy and constructive way.

$var;

 

The end of IPv6

The end of IPv6 will not be our fault, at least not directly.

Indirectly, and in the next 25 years or so, bots will be so ubiquitous to the modern web, that bots will have bots with bots, and they will autonomously be setting up both physical & virtual servers to scale their requests in such a way that will eventually saturate even the IPv6 protocol.

340,282,366,920,938,463,463,374,607,431,768,211,456

This is the number of available addresses in the global IPv6 range. If I’m right, that’s gonna take a lot of bots.

But consider that services like Akismet claim to fight spam at more than 7.5 million requests per hour, and Gravatar claims to serve more than 8.6 billion images per day, and that’s with me only cherry-picking 2 services that help power 25% of the web, amongst a sea of tens of thousands in the remaining 75%.

As services like these start to become increasingly intelligent, their computational needs increase exponentially, and the number of independent services necessary to keep up with those needs will follow suit.

Consider an application like Slack, where upon opening 1 application, it opens close to 20 individual sockets, each acting like a neurological meld between the client application on my Mac and the many servers they no-doubt are wrangling to keep up with the growing number of Slack networks I’m a part of.

When you start to look at the raw numbers, the insane amount of traffic, the ludicrous amount of connections required to make the world wide web of computers interact with each other, IPv6 suddenly starts to look less big than it did originally.

If we round up Gravatar’s numbers to 10 billion images per day, it will only take 100 days to hit 1 trillion (1,000,000,000,000) images. I have no idea how many physical servers (or public IP addresses) it takes to do this, but I bit it’s at least a few. If a few more services the size of (and equally as efficient as) Gravatar are invented, we start to double-up pretty quickly.

And I have a hunch that no service will be as efficient as Gravatar is at doing what it does; anything of this scale will only grow in complexity and necessities.

It may not happen in my lifetime, but make note that if you squint far enough into the not-too-distant future, even IPv6 won’t save the internet for very long.