Posts Categorized: Programming

How to Use a PHP Closure to Implement a SoapClient Method Staggering Retry

The Problem I ran into an situation where I have to interact with an extremely unreliable SOAP web service using PHP’s SoapClient. I needed a way to consistently retry failures before eventually dying if it doesn’t ever succeed. I prototyped this using procedural code, but when I implemented it for real, it was in object-oriented… Read more »

How-To: Git Merge

I create a lot of Git branches. Every change I do is a branch. That means I perform a lot of Git merges. Here’s how I do it. Read about my Git workflow here. Assume there’s a dev branch called ‘Fingerboard’ that I need to merge into ‘master.’ The Fingerboard branch has been committed to… Read more »

The Perfect Git Workflow

I have concocted the world’s most perfect Git workflow. Here it is. Spoiler, it’s actually not perfect, but it works for me. In Git, there’s the concept of a master branch. Master is merely the first branch Git creates. Git might as well called it “Pippy Pee Pee Diarrheastein Poopypants Esquire.” But Git didn’t do… Read more »

Pass node arguments to PM2

What I used to do with Perl or shell scripting, I do with Node.js. Here’s how to pass node arguments to a pm2 start command. I have Node.js application that uses garbage collection. For it to work, I have to pass the –expode-gc node command-line argument. Since I use pm2 to manage my Node.js applications,… Read more »

How to Merge Files Without Using Merge

I use a Mac almost exclusively for development. Mac doesn’t come with the Linux merge command and sometimes I need to merge text files. It’s pretty easy to do using diff and grep. I’m going to show you how to merge the changes from two files into one. I’ll use file1, file2, file3 and file4… Read more »

Edit Eclipse Generate Getter and Setters Format

For me, I like to always return $this when creating a setter class method when coding PHP. For example, to set an object to be freaky, I would create method like this. /** * Set to freaky or not freaky. * * @param boolean $freaky * @return $this */ public function setFreaky($freaky) { $freaky ===… Read more »

How to Make Eclipse IDE Faster

While coding the other day, Eclipse was running like shit. It was slow as hell. I couldn’t get anything done. I did all of the updates to Eclipse and even rebooted. It didn’t it help, it was dog ass slow. Checking my laptop resources, it was all fine. Researching this issue, I found out about… Read more »

Configure Composer to Allow for dev-master

By default composer doesn’t allow you to install packages that are dev-master, but it’s easy to change that behavior. When you install a package that only has a dev-master version and it fails, you need to update your composer.json. It’s easy to fix this composer error. In your project’s composer.json, set “minimum-stability” to “dev.” Your… Read more »

PHP Portable Paths

Frankly, I don’t care about people wanting to run my code on a Windows box and it not working. But in reality, for some reason, there are people who write code using computers running the Microsoft Windows operating system. Why don’t they use a Mac, or if they don’t have or want to spend the… Read more »

Connect Existing Eclipse Project to a Git Repository

Since we moved to Git at work for version control, I’ve had a few occasions in which I had an existing Eclipse project in my IDE that I wanted to connect with a Git repository. The process is, I feel a bit convoluted, but it sort of made sense after I did it once. First,… Read more »