Category Archives: Hakre's Tips

Lazy Loading in PHP Object Composition

When it comes to nicely performing PHP scripts (yes in PHP these are all scripts as PHP code is run-time) there is a nice addition since PHP 7 named the Null coalescing operator which plays very well with the basic nature … Continue reading

Posted in Hakre's Tips, PHP Development, PHP Development, Pressed, The Know Your Language Department, Tools | Tagged , | Leave a comment

Linting PHP Files in Parallel on Travis

With PHP 7 around the corner here is a small tip how you can at least lint the code in your project to be PHP 7 syntax compatible. That allows you to easier obtain forward-compatible PHP code with ease. So … Continue reading

Posted in Hakre's Tips, PHP Development, Pressed, Tools | Tagged , , , , , , , , | Leave a comment

The SimpleXMLElement Magic Wonder World in PHP

PHP’s Simplexml ships with a lot of magic to simplify access to an XML documents element and attribute node values. Some criticize this and suggest to use the DOM library instead. The DOM library on the other hand, even it … Continue reading

Posted in Developing, Hakre's Tips, PHP Development, Pressed, The Know Your Language Department, Uncategorized | Tagged , , , , | Leave a comment

Kubuntu Default Browser

The system-settings don’t reflect the whole picture in Kubuntu. Settings can be done via the command-line. Here exemplary to chromium: I had an issue with this for quite some time, I finally found the answer via “opening web link from … Continue reading

Posted in Hakre's Tips, Pressed, Uncategorized | Leave a comment

Installing PDF Printer under Kubuntu with AppArmor and Samba

It actually should be as little as installing cups-pdf (CUPS-PDF (Ubuntuusers German)): Then opening Printers in system preferences did show the new printer. However printing a test-page didn’t work. I then just followed the tail of the syslog: to find … Continue reading

Posted in Hakre's Tips | Tagged , , , | Leave a comment

Hide Folders in PhpStorm Project Pane

How can I hide a directory in a PHPStorm project, for example .sass-cache I just asked myself this morning. Searching online didn’t reveal it to me and there are numerious options that were close but not about hiding the directory … Continue reading

Posted in Developing, Hakre's Tips, Pressed | Tagged | Leave a comment

Download NextGen Gallery WordPress Gallery with Wget

For a gallery download with Wget made by NextGen Gallery (at least this is what I read from then nggpage=2 query string), I had success with: My example gallery with with all jpeg files. The switches are documented in the … Continue reading

Posted in Hakre's Tips, Pressed | Tagged , , , | Leave a comment

Commandline Source Fixes Foo

From time to time I need to cleanup source trees. Today I needed to do that again, here are some command liners to get some work done. If you’re on Windows, all you need to do to get these running … Continue reading

Posted in Developing, Hakre's Tips, Pressed, Tools | Tagged , , , , , , | Leave a comment

Composer Clear Cache

It’s one of the best kept secrets of popular PHP dependency manager Composer: How to flush composers cache. You normally don’t need it, however if you create some composer.json and you want to put it to a test, this can … Continue reading

Posted in Developing, Hakre's Tips, PHP Development | Tagged , , , , , | 5 Comments

XPath Null Byte Injection in PHP

Back in July this year, in Mitigating XPath Injection Attacks in PHP I was writing about how to properly quote a string in PHP’s Xpath 1.0. The code presented there was based on the assumption that the resulting expression is … Continue reading

Posted in Hakre's Tips, PHP Development, Pressed, Surviving the Internet | Tagged , , , , , , , | Leave a comment

The Negative Influence of WordPress on PHP

The current The TIOBE Programming Community Index for July 2013 shows an increase for PHP, gaining grounds fast and as an ongoing trend over the last year: If compared to January 2013, PHP is the fastest climber with an increase … Continue reading

Posted in Hakre's Tips, Linked, Pressed, Surviving the Internet | Tagged , , , , , | 2 Comments

Mitigating XPath Injection Attacks in PHP

PHP has two libxml based extensions that allow to execute XPath 1.0 expressions: DOM (by the DOMXPath class) and SimpleXML (with its xpath() method). Both extensions are prone to XPath Injection Attacks, a common attack form. Albeit all this, and … Continue reading

Posted in Hakre's Tips, PHP Development, Pressed, Surviving the Internet | Tagged , , , , , , , | 1 Comment

PHP: XPath on HTML and XHTML

Christan Weiske has published a nice summarizing article with the same title. It contains some detailed information I haven’t found so far on the web so worth the link: PHP: XPath on HTML and XHTML. It also reminds me of … Continue reading

Posted in Developing, Hakre's Tips, PHP Development, Pressed | Tagged , , , , | Leave a comment

PHP on Google App Engine – Quick First Review

This is fresh out of the news (Ars; Wired; WHIR; VB), and what Google wants to offer looks like a very cool package. So if you hadn’t had the time to view the video, here is a quick summary and … Continue reading

Posted in Features, Hakre's Tips, PHP Development, Pressed, Reports, Tools | Tagged , , , , , , , , , , , | 7 Comments

SimpleXML Type Cheatsheet

A SimpleXMLElement can represent many different things, from an element, to a list of attributes or childelements. Sometimes it’s good to know how to find out, especially with the magic the extension comes with. The following is a table with … Continue reading

Posted in Hakre's Tips, PHP Development, Pressed, The Know Your Language Department | Tagged , , , , , , , , , | 1 Comment

PHP Autoload Invalid Classname Injection

There are many ways to attack an application, many are working by injecting some malicious data hoping to trigger a deserved action in the end. Most of these are possible when input data is not properly sanitized. This can have … Continue reading

Posted in Features, Hakre's Tips, PHP Development, Pressed, The Know Your Language Department | Tagged , , , , , | 1 Comment

Debug with Xdebug on the Commandline with Phpstorm and Git Bash

Enable Phpstorm Xdebug listening: Press the listen button inside Phpstorm to actually listen: To disable Phpstorm Xdebug processing in Bash again: This (PHPSTORM) is the default Phpstorm IDE-Key. You don’t need to disable listening after the variable is unset. Should … Continue reading

Posted in Hakre's Tips, PHP Development, Pressed | Tagged , , , , | 1 Comment

Assorted SPL Iterator Examples

This is an assorted list for three SPL iterator resources out there in the net. I’m sure there is more, so feel free to leave a comment I’m happy to add them. spl-examples (salathe) The idea is to have you … Continue reading

Posted in Hakre's Tips | Tagged , , , , , , | 4 Comments

Getting N Random Elements out of an Iterator – RandomIterator

Considering there is an Iterator or Traversable with an unknown number of elements, I wondered if it is possible to get one or more random iterations out of it.

Posted in Developing, Hakre's Tips, PHP Development, Pressed | Tagged , , , , , , | Leave a comment

Prepared Statements

In Programming With Anthony – Prepared Statements (by Anthony Ferrara; 12 Dec 2012) the author needs only two minutes and 17 seconds (Youtube Video) to explain *Prepared Statements*. Worth to watch. See as well the Playlist of Programming With Anthony … Continue reading

Posted in Hakre's Tips, Linked, PHP Development, Pressed, Surviving the Internet | Tagged , , , , , , , , , | Leave a comment