BMF: A New Project

June 4th, 2016

I have a new project, in a completely new sector to me. The experience so far has been an interesting one, between researching the industry, and working out how and what I want to build.

Today’s challenge is figuring out how I want to write the code. I’m trying to hold a balance between work that won’t be too hard to clean up later, and work that won’t take me a ton of time now. This of course meant I had to decide between static classes, dependency injection, and some sort of factory. So far, static classes wins out, because it’s not a ton of work to do.

I’m sure I’m going to regret this decision later on.

Read a CSV file into columns

May 6th, 2016

This command will read a CSV file, and display it as columns. This also works on Windows if you have Cygwin installed.

column -t -s"," test.csv

Example CSV columns

OpenVPN Linux DNS Issues Solved

October 20th, 2015

I can now resolve things on my Raspberry Pi (Raspbian) thanks to a helpful post here: http://www.softwarepassion.com/solving-dns-problems-with-openvpn-on-ubuntu-box/

MySQL Dump And Restore Database Table With Compression

August 30th, 2014

mysqldump --no-create-info -uxxxx -pxxxx Database ATable | gzip -9 > xxxx.sql.gz

zcat xxxx.sql.gz | mysql -uxxxx -pxxxx Database

Setting Up Zend Framework 2 Autoloader

May 13th, 2014

If you’re like me, you like to dig into the belly of things and twist them to your own uses. Tonight, I’ve been monkeying around with ZF2 autoloaders, and working out how they function.

I store my ZF install in a dir (Zend/) in my include path, so I don’t have to maintain copies for each site on my server.

Some useful notes on this:

The stock ZF2 download does not include a pre-generated classmap file. To generate this, go into the default unpacked archive folder, into bin/ and run this command:

php classmap_generator.php -l "/usr/share/php/Zend/"
// How to get an absolute path to the generated classmap file (return: /usr/share/php/Zend/autoload_classmap.php)
$classmapPath = stream_resolve_include_path('Zend/autoload_classmap.php');

// How to get the autoload up and running
require_once 'Zend/Loader/ClassMapAutoloader.php';
$autoloader = new Zend\Loader\ClassMapAutoloader();
$autoloader->registerAutoloadMap($classmapPath);
$autoloader->register();

That’s all for tonight folks!

WordPress - Entries (RSS) and Comments (RSS) - © 2011 Ben Dauphinee