How to Create Keyboard Shortcuts for PHP

I finally grew tired of typing the awkward PHP object operator. Learn how to create keyboard shortcuts for KDE and use my shortcuts for PHP as a starting point.

My preferred server-side language is PHP. It's powerful and flexible, but it's certainly not perfect. One of my pet peeves is the object operator (->). I've programmed in C++, so I can appreciate its heritage. It's simply not needed in this case, so it feels like overkill to have to repeatedly type such an awkward key combination. Why should I move my hand to the top row for one key and hold shift for another when a single dot would be perfect for the task? Is it solely a byproduct of the poor decision to use the dot for string concatenation? I finally got fed up enough to look for a solution.

As with many desktop environments, KDE allows you to configure keyboard shortcuts that trigger a specific set of keystrokes. You can create your own in System Settings -> Shortcuts and Gestures -> Custom Shortcuts. From the Edit menu, select New -> Global Shortcut -> Send Keyboard Input. On the Trigger tab, click the button and provide the shortcut you want to use. Then select the Action tab and enter the keystrokes you want the shortcut to send. Type out the words for meta keys like Shift and Alt, use + to indicate keys that should be pressed simultaneously, and separate the keys using a colon. For example, -:Shift+. will output - and > (the object operator). You can also use directional words (e.g., Left and Right) for the arrow keys to position the cursor within the output.

Getting Started With Estate Planning

We all die eventually and someone has to take our financial reins. A few hours of work now could save your survivors a lot of trouble in their time of grief.

This is my first blog post related to personal finance, but it's one of my favorite subjects to read about and discuss. I've loved numbers and math since a very young age, and personal finance gives me the opportunity to plan and strategize with numbers. What could be more fun? Needless to say, not everyone reads that question without thinking of a long list of things that would be more fun for them. My better half is one of those people, so I manage our household finances while she remains blissfully unaware. Like many other couples, that arrangement works well for us.

Although I enjoy planning for our future, there's one event no one likes to think about: their own death and/or their partner's. You could be the most fit 138-year-old the world has ever seen and still get hit by a self-flying car one day. Without a plan in place, your loved ones could be left not only grieving but panicking as well. I can only imagine how difficult it would be for the little woman to take over our finances even if I were here to answer questions. Going solo without my help would be a total mess. What about you: would your spouse or partner be prepared? What if the scenario were worse due to dying together in an accident or very close in time? In that situation (or for single people), someone even less familiar with your finances such as a child or parent would have to figure things out.

Search Shell History Using Arrow Keys

FreeBSD's root user can easily search its shell command history using the arrow keys. Add the same search capability in the Bash shell with this change.

By default, the FreeBSD root user can type part of a command and then search through history for previous commands beginning with those characters using the up/down arrow keys. If you're new to FreeBSD or csh, you might think the convenient shell history search is specific to root or csh/tcsh. Fortunately, it's not. You can get similar functionality in Bash by creating or editing ~/.inputrc to add the following lines:

# Allow history searching with the up/down arrows:
"\e[A": history-search-backward
"\e[B": history-search-forward

Chromebook for Power Users: Part 3

After installing Debian Linux in a chroot on my Chromebook, I slimmed LXDE down a bit before connecting to my FreeBSD desktop running xrdp.

This is the final post in a 3-part series on using a Chromebook as a power user. Part 1 gave a high-level overview of how I'm using my Chromebook and some basic Chrome OS configuration steps. Part 2 dug deeper to show advanced users how to use crouton to install Debian Linux in a chroot. This post finishes up by configuring LXDE and connecting to a remote FreeBSD desktop running xrdp.

Configuring LXDE on Debian

Chromebook for Power Users: Part 2

The RDP apps on Chrome OS left me wondering if my Chromebook would be useless. Then I found crouton and installed Debian Linux in a chroot to expand my options.

This is the 2nd post in a 3-part series on using a Chromebook as a power user. Part 1 gave a high-level overview of how I'm using my Chromebook and some basic Chrome OS configuration steps. This post digs deeper to show advanced users how to use crouton to install Debian Linux in a chroot. Part 3 finishes up by configuring LXDE and connecting to a remote FreeBSD desktop running xrdp.

As discussed in Chromebook for Power Users: Part 1, the primary use for my Chromebook is to act as a dumb terminal to remote my FreeBSD desktop. I run xrdp on the desktop, which allows me to securely connect to an X session using a standard RDP client. That's why I was disappointed to find that none of the popular RDP clients for Chrome OS were able to connect to xrdp. In an effort to settle for less, I enabled a VNC server and tried connecting. While VNC "worked," the experience was unacceptable due to keyboard issues related to uppercase/lowercase letters and the shift key. That was a deal breaker for me: if I couldn't remote my desktop with it, a Chromebook would be almost useless—just an oversized tablet weighed down by an attached keyboard. Luckily, crouton came to the rescue by enabling me to install Debian Linux in a chroot on the Chromebook.

Chromebook for Power Users: Part 1

As a 'power user' who wanted to replace my laptop with something inexpensive and low maintenance, I gave a Chromebook an honest try. Was it up to the challenge?

This is the first post in a 3-part series on using a Chromebook as a power user. It gives a high-level overview of how I'm using my Chromebook and some basic Chrome OS configuration steps. Part 2 digs deeper to show advanced users how to use crouton to install Debian Linux in a chroot. Part 3 finishes up by configuring LXDE and connecting to a remote FreeBSD desktop running xrdp.

We all wear many hats. In my role as Household Systems Administrator, I manage more devices than I'd like. The desktop, my work laptop, and the youngster's college laptop (devices with important data on them) are actively managed: they get security updates for the OS and apps within days of release plus regularly scheduled backups. We also have a Windows VM that's actively managed, but it can skip backups since it's on the desktop. In addition, I manage the server that hosts this site and provide "IT support" for all devices within our home. Sometimes it feels like a second job, which is why I look for ways to minimize the workload while still meeting everyone's needs. All the important data is on the desktop, it's set up the way I like, and it's already actively managed, so adding another laptop to the mix seems like something to be avoided. Yet I live in the real world where computer activities happen throughout the house and may require more than a tablet to perform.

Life is Short by Paul Graham

Paul Graham's recent essay, Life is Short, discusses making the most of our short lives by focusing on the things that really matter.

With our youngster almost ready to leave the nest, I try to remind friends (and myself) to be conscious of how brief their kids' childhoods will be. Paul Graham puts it into perspective in his essay, Life is Short:

Having kids showed me how to convert a continuous quantity, time, into discrete quantities. You only get 52 weekends with your 2 year old. If Christmas-as-magic lasts from say ages 3 to 10, you only get to watch your child experience it 8 times. And while it's impossible to say what is a lot or a little of a continuous quantity like time, 8 is not a lot of something. If you had a handful of 8 peanuts, or a shelf of 8 books to choose from, the quantity would definitely seem limited, no matter what your lifespan was.

Year in Review: 2015

I started 2015 on a great streak, but it didn't hold up all year. Here are the habits I need to pick up again and a few other targets for 2016.

It's that time of year again when most of us take a moment to reflect on what we've achieved in the last year and set some new (or old as the case may be) goals for the new year. I had a great 2014 as far as habit building, but 2015 lost traction and slipped a lot. It'll take a ton of effort to get my momentum back in 2016, but I know I have it in me since I've done it before.

Regular exercise isn't something I felt I needed as a young person, but I've been trying to develop the habit as I approach middle age. My goal for 2015 was to exercise at least a little every day just to maintain a habit of doing so, because it takes less willpower to exercise more if you're already doing it. I did very well for the first 7 1/2 months with only 1 day missed. Then I went out of town for a week, didn't exercise at all, and became Lazy Me again. I could count on one hand the number of times I exercised in the last 4 1/2 months of the year, and I can feel the impact it's had on my body. Maybe this is what "almost 40" should feel like, but I'm making it a priority to develop the exercise habit in 2016.

Command Line Plugin Added to Prism

After making several changes proposed by another contributor, my Command Line plugin is now part of the Prism project.

Back in February, I wrote about how to style shell commands using CSS. I wanted to submit that code to the Prism project, but I got distracted by other things. By the time I finally got around to submitting it, there were changes to the main project that affected the plugin code. I updated the plugin to incorporate their changes and submitted my first GitHub pull request at the end of November.

Another Prism contributor, zeitgeist87 (Andreas Rohner), was quick to provide useful feedback and offered some great suggestions for expanding the plugin's functionality. Andreas' suggestions resulted in a more flexible plugin that works for any type of command prompt as opposed to only shell/terminal sessions. Besides project-specific details I wasn't aware of, he also helped me with some general best practices for GitHub collaboration that I'm grateful for. People's willingness to help others is part of what's most impressive about the open source community.

Core Web Application for PHP Released

The Core Web Application Libraries provide a logger, database layer, and MVC framework for PHP. The code is available on GitHub along with 2 example projects.

When I built this site, I chose to start from scratch for several reasons. I could've thrown something together using any one of the open source content management systems, but I've been down that road before. Once you customize a popular CMS, it becomes an outright burden to keep up with security fixes and other updates. It's convenient to have so many features and plugins at your disposal, but having thousands of lines of unused/inapplicable code with frequent vulnerability fixes can leave you with an uneasy feeling about what's creeping into each release. Once you have multiple sites in that state, maintaining them starts to feel cumbersome or, worse, like a second job. Additionally, I wanted the freedom to use the code in any project I work on whether I retain ownership of the finished product or not.

That's why I created the Core Web Application Libraries and released the code under the Apache License Version 2.0. They're a lightweight and flexible base for building small to medium-sized websites using PHP. I didn't want to build yet another "kitchen sink" solution that tries to appeal to all developers everywhere. My aim is to keep it lightweight so developers can become intimate with the code while providing enough flexibility that they can extend it to do whatever they want. Security is a primary focus and keeping the code lean makes it easier for anyone to audit at any time. It can't address all possibilities, of course, but my intention is to provide a secure foundation "out of the box" so that any additional measures the developer takes are icing on the cake.