AuthorChris Peterson

As a Web Application Developer & Elephant Trainer I have been putting the PHP mascot to work for more than a decade. I specialize in back-end development and use the LAMP stack to craft software that frees human beings to spend their time on more productive and rewarding things.

jsqrcode Implementation

j

This post provides is a quick-and-dirty demonstration of the LazarSoft / jsqrcode Javascript QR Code scanner library available at . The HTML and JavaScript provided below is designed to show how a simple capture and decode program could be implemented using the library. Provided the code from the GitHub repository above has been downloaded, simply copy the code posted below into an html file in...

Flippin’ Fast Array Searches in PHP

F

Recently, while optimizing some code to use less memory, I had to manually compare two arrays rather than using PHP’s built-in functions.  Given the sizes of the arrays involved processing was far too slow to be practical. While considering my options (and groaning at the amount of work they would take) it occurred to me that a simple trick might just do the job. Since PHP actually implements...

WSL Line Endings with NetBeans

W

While the Windows Subsystem for Linux provides a suitable environment for development, the one fly-in-the-ointment is still the incompatibility of the respective file systems. Microsoft has emphatically warned that writing to the Linux file system from Windows has the potential to corrupt the entire Linux environment. As such, they recommend that files be created and modified in Windows, and then...

SOAP XML Transform – NWS Forecast

S

The National Digital Forecast Database is a SOAP web service distributing U.S. forecast data via XML. I recently examined the output with an eye toward incorporating a basic forecast component into a webpage, but found it rather difficult to use directly. The purpose of this post is to share the process I used to transform the XML into an easier to use format. An example of the format returned by...

PHP VIN Code Validation

P

Since 1981 Vehicle Identification Numbers in North America have followed a standard which provides a check digit to aid in the identification of transcription errors. Reproduced below is my PHP implementation that calculates a checksum and compares it to the check digit. class VehicleUtilities{ public static function validateVin($vin){ $vin=strtoupper($vin); //17 Chars <> I,O,Q - Last 4...

PHP Passwords with Character Arrays

P

Here’s a simple function I recently wrote to randomly generate passwords in PHP. //Generate new password $characterPool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-_+=:;<>?'; $newPassword = ''; while(strlen($newPassword)<8) $newPassword .= $characterPool[mt_rand(0,strlen($characterPool)-1)]; Simplified a bit, this is equivalent to: //Generate new...

jQuery Lightbox

j

Creating a centered lightbox that dynamically resizes the image and maintains centering within the browser window is simple if you know the technique.  Hopefully this short article will save someone else the time I spent finding a solution.  I have tested the technique in the current (as of posting date) versions of IE, Firefox and Chrome. Note, however, that the JSFiddle example below does not...

eToken WSO and IE10

e

For the last several years I’ve been using the SafeNet (formerly Aladdin) eToken Web Sign On (WSO) product to manage my credentials for more than two-dozen websites. Unfortunately, after upgrading to IE10 the browser extension no longer works. While version 5.2 of the WSO software only officially supported Internet Explorer up to version 8, I experienced no issues running it on IE9. However, the...

Rounding Sales Tax Calculations

R

Until recently, Minnesota rounded sales tax calculations by looking out to the ten-thousandths place – as reflected in the state’s official sales tax charts.  Earlier this week I discovered that the state now has an online sales tax calculator that rounds by looking out only to the thousandths place.  This means that the 6.875% sales tax on $1.38 could be either $.09 or $.10 depending on which...

Chris Peterson

As a Web Application Developer & Elephant Trainer I have been putting the PHP mascot to work for more than a decade. I specialize in back-end development and use the LAMP stack to craft software that frees human beings to spend their time on more productive and rewarding things.

Recent Posts

Recent Comments

Archives