Space Cat, Prince Among Thieves

Blog

Use Beyond Compare as a Git Diff/Merge Tool in OS X

I switched from Windows to Mac for work a little over a year ago (I've been using Macs at home for years) and there is one program I still could not live without - Scooter Software's wonderful Beyond Compare. I've tried every single diff tool available and none have lived up to Beyond Compare. It truly lives up to its name. I've had Beyond Compare running in WineBottler for a while now, but was never able to get passing arguments to work correctly. Today I had a revelation. On creating the bottle it asks you for arguments to pass the executable, I had not provided any. Ends up it then pas…
Read More / Comment »

Static::? More like Lies::

In my professional work, we have a system that utilizes __call and __callStatic for caching of certain method calls. We have been running into a problem where calling an undefined method via :: within the class itself will trigger __call rather than the expected __callStatic. The Problem The following code example illustrates the issue. <?php class foo { function __call($name, $args){ echo "__call " . $name . PHP_EOL; } public static function __callStatic($name, $args) { echo "__callStatic " . $name . PHP_EOL; } public function make_call_self() { …
Read More / Comment »

Late Definition of PHP Class Members

Working on a class in our application, I discovered that it was being included before a number of constants it used for its members were even defined. Puzzled on how this had never been a problem I started to experiment; echoing the member at the bottom of the class file after the class closed showed the expected CONSTANT_NAME. I was very confused at runtime the value of the member in the constructor and elsewhere in the class appeared correct. To test what all behaves in this manner I threw together this simple set of three tests including instance members, static members, and class consta…
Read More / Comment »

Web Developer Resumé/Interview Advice

As Lead Developer at my previous company, I interviewed quite a few Developers. I wanted to provide some advice to Developers on how to come off more positively. For the purposes of this post I, me and all other pronouns referring to myself refer to a hiring professional. Some Basics Up Front Google yourself. Google your email address, I will! There will be lots of Googling before you’re hired. I am well versed in the darker Google arts, and odds are I will find you. If I don’t find you, that’s almost as detrimental as finding something fairly negative; you are interviewin…
Read More / Comment »

Simple Single Pass Doubly Linked Flat Tree Building Algorithm

A hierarchy is a common structure, especially in web development.  The problem with hierarchies is they need to be flattened to be stored in a relational database, and then expanded again after being pulled out.  An Example Hierarchy Top level item Sub Item Sub Sub Item Sub Sub Sub Item Sibling of Sub Item Top level as well   A common and simple way to store them is with a table structure similar to the following. id parent_id title 1 0 Top level item 2 0 Top level as …
Read More / Comment »

Nusphere PhpED Dark Theme

It would seem there is a fair deal of call for an updated version of my PhpED dark theme from colleagues as well as random folks on the internet who’ve seen screenshots of my PhpED installation. I previously had my Dark Theme for 5 linked on my Review of PhpED, but I figured I could have a page dedicated to it. Screenshots Download and Installation The first step is to download the proper version. Click here to download the PhpED 6 Version or here to download the PhpED 5 Version. After you have downloaded the file you will need to replace your hl.cfg. In Windows 7 or Vista th…
Read More / Comment »

Simple WPF VB.Net JumpList Example

Today I decided to spruce up a VB.Net application I wrote in college and still use almost daily. In the process of converting it from .Net 2 to .Net 4 I wanted to add a splash of Windows 7 goodness; there were some very simple operations I wanted to add to JumpLists.  The problem I ran into with all the examples I could find is that they either called entirely different applications (the Microsoft examples all called Notepad) or the example was in C#.  The application is in VB.Net and I intend to keep it that way, as it is my .Net language of choice. The interesting problem with Jump…
Read More / Comment »

Opinion: Google Killed the Internet

Googles Page Speed “Optimizations” Make Learning Difficult If you, as I, grew up during the web bubble we call the 90’s and were interested at all in web development my guess is that you probably didn’t learn most of your skills from a book or a class.  You probably would run across a site that had something cool on it and ponder  “Oh my, how does that work?” right click, view source, and after some digging were enlightened.  I’m certain this is how most of my generation learned their HTML/CSS/JavaScript skills, it is certainly how I did, and often…
Read More / Comment »

Grid Style Sheets vs. The Semantic Web

Grid Style Sheets Must Die I have been aware of Grid Style Sheets for quite a while, but I long ago dismissed them as a fad like CSS Resets.  Recently though it came to my attention that OSCommerce 2.3 switched to the 960 Grid Style to replace its table based layout system.  I spend most of my development time working with OSCommerce and thought it would be good to understand this change so I could decide whether or not to integrate it into our fork. My general impression playing with the latest nightly of OSCommerce 2.3 from Github though is that I don’t like it – maybe I’m …
Read More / Comment »

Statistics Based Lorem Ipsum Generator

Several months ago I was wondering to myself if you could detect patterns in a list of words and then use those patterns to generate a new list of fake “words”. A kind of a flavored Lorem Ipsum generator, where I could change the feel of the sentences by switching out the data set.  I’m sure thousands of developers have done this before me – but it was a fun thought experiment. I threw together a little script in PHP to test the idea, and the results were kind of interesting so I figured I'd throw it on my site - Anyway, here are some examples in action – you can hit re…
Read More / Comment »

Fast Patches with Git

In my work, I deal with a lot of very similar codebases - and often if I fix something in one project I'll want to fix it in many others. For a long time this has meant popping open Beyond Compare, which works, but isn't the simplest solution. I use git on my projects - but they're not similar enough just to be branches. Recently I came up with a way to patch one or more commits from a project to another easily. Here is a simple shell script I wrote to handle the task. Simply put, you can use it either by fast-patch.sh /z/my_project to patch a project with the latest commit from the project …
Read More / Comment »

A Balanced Look at GZIP and the User Experience

With Google recently starting to involve load time in search rankings, there has been a lot of talk about GZIP.  Google Webmaster Tools exclaims "Compressing the following resources with gzip could reduce their transfer size by XKB:". Many people listen to this, and go out looking for a quick fix without realizing that poor GZIP implementation has a strongly negative effect on the overall user experience. There are two main ways in PHP to go about implementing GZIP. The first is ob_gzhandler.  Basically all that is really involved in setting this up is adding ob_start("ob_gzhandler…
Read More / Comment »

There Isn't an App for… - Part 1: PhpED

“There Isn't an App For That” - Windows Apps I haven't been able to replace in Mac OS X For a very long time I was a Windows guy, I was once a DOS guy. I switched nearly exclusively to Mac for my home use about 4 years ago. I’ve been very happy with it. Its stable, well engineered, and - my favorite part of all - consistent. Yet, in this time there remain a few applications I cannot seem to replace. Nusphere PhpED I am a PHP Developer by trade, and PhpED for my money is by far the best development environment for the serious PHP developer. When I do develop on the Mac platfo…
Read More / Comment »

Donat Studios Officially Launches

After much ado, Donat Studios is finally live! There are a few things left to complete. Eventually setting up the documentation and public git repository for CorpusPHP will certainly take up a fair amount of time. I'm still not quite sure what to put in my portfolio, I was thinking of for the time being just throwing a bunch of my sketches in there. My reasoning and goals behind this site are slightly different than my other sites. More than anything I wanted a place where I could rant about everything web related. I have strong opinions on many topics, and where Oasisband.net is good for mo…
Read More / Comment »

JSONP: Take It With a Grain of Salt

I don’t want anyone take this the wrong way.  I am having a torrid affair with JSON. It is so much simpler to parse than XML, and is an all around exceptional way to represent data. I have one caveat though, and that is “JSON with Padding” or “JSONP” as it goes by. While building this site I was trying to bring in images from my Flickr account, as you may have noticed. Building the module in PHP, I basically ran file_get_contents on the feeds url and passed that directly into json_decode. On print_r’ing the results, it was null. It had failed.  As…
Read More / Comment »