Tales of an IT Nobody

devbox:~$ iptables -A OUTPUT -j DROP

Worthy of Distribution: Angularjs patterns April 29, 2015

Feel like you’ve gotten ‘over the hump’ on getting AngularJS to do what you want? Check out the video below to help save yourself from being overly analytical for your project structuring and avoiding common pitfalls (and general javascript pitfalls) for moving on to the “next level” for AngularJS development.

 

No Comments on Worthy of Distribution: Angularjs patterns
Categories: angularjs programming

A PHP bug – really? (custom session handlers) April 18, 2015

It’s not often I ramble about PHP, since it’s my bread and butter. But after perusing the RFC notes to get up to speed on the PHP 7 pipeline, I found this: https://wiki.php.net/rfc/session.user.return-value

That bug has been around for how long? I’m amazed folks with pitchforks haven’t come out on that one sooner. I myself have suffered great pains dealing custom session handlers for this exact bug. Shame shame! (At least it’s getting fixed)

/rant

No Comments on A PHP bug – really? (custom session handlers)
Categories: php programming rant

PHP 7 Roundup – implicit ‘array to string’ conversion April 15, 2015

Feast your eyes upon this: https://wiki.php.net/rfc/array-to-string

If you’ve been in the trenches for a long time, chances are you’ve been bitten more than enough by the implicit array to string conversion as such:

It will now look like this in PHP 7:  Catchable fatal error: Array to string conversion

 

 

No Comments on PHP 7 Roundup – implicit ‘array to string’ conversion
Categories: php programming

PHP 7 Roundup: Chainable ternary awesomeness. April 12, 2015

Feast your eyes on this: https://wiki.php.net/rfc/isset_ternary

This eliminates quite a bit of ‘noise’ and ‘fluff’ use in any display logic, it’s a new ternary operator that allows you to quickly set a default without doing the isset() dance.

This has a limited affect if you use a templating engine like Twig, but it’s still very nice if you have to do some quick and dirty default setting at the code level for display.

 

No Comments on PHP 7 Roundup: Chainable ternary awesomeness.
Categories: php programming

A better way to give Logstash permissions to your logs

So you’re ready to rock out Logstash to ship your logs – there’s one little headache: You still need to give it access to your files. Chances are, you want “all of the files!”

The internet will (at the moment) instruct you to use “setfacl”, or various chown/chmod techniques or even add logstash to various groups.

READ THIS TECHNIQUE FIRST!

Why setfacl won’t work

Logrotate can be scripted, but sudo-io (sudo logging) can’t. There are other exceptions where logs not managed by logrotate don’t persist setfacl settings.

Why chmod/chown and adding “logstash” to groups its a bad idea

You’re making too many exceptions, and relinquishing flexibility to give access to the logs in a normal basis. (meaning, not using something like setfacl, but instead normal linux groups)

Then what works best?

It’s so clean and tidy: either through mount –bind or  bindfs.
Feast your eyes on this:

 

OR (in the case of ext4)

You’re given a tidy ‘ro’ binding of the /var/log dir ONLY readable by the logstash reader.

I hope this helps those who want to ship “all of the things!” – this is a good separation of concerns for managing logstash access.

‘bindfs’ is available in the default Debian repos as well!

 

No Comments on A better way to give Logstash permissions to your logs
Categories: Uncategorized

How to use PHPUnit installed by composer in PHPStorm April 5, 2015

Ever wonder how to properly use those packages installed from the require-dev section of composer.json?

Ideally you’d integrate them with your IDE, or perhaps set up your system path to access it via vendor\bin\phpunit – If you use PHPUnit, take a quick look at this on how to properly set up PHPUnit in PHPStorm on a per-project basis (because not all projects use the same PHPUnit version).;

No Comments on How to use PHPUnit installed by composer in PHPStorm