PHP & More

A technical blog about programming in PHP and about technology in general: programming, workarounds and troubleshooting

One thing I wish to see in languages such as PHP is to find them supporting the complex type. Complex numbers are more than vectors in 2D, and I wish to see expression containing them parsed just like the ones with real numbers. Python supports them, and you have to import ‘cmath’ to use functions …

Continue reading

When you see a change in the major version (the number before the first point of the version id), expect a great leap. New features have been added to PHP in version 7, that make programming more convenient. I’m going to discuss some of them. Null Coalescing Suppose you’re trying to get a value from …

Continue reading

I remember that little prank from the days I was a student. You work on an X terminal, and out of the blue, all the display contents gradually disappear’ Pixel after pixel turns black. But don’t worry – you’ll regain control over your display shortly. shortly. Everyone can access other X terminal display, and mess …

Continue reading

I have received by e-mail a rotated video in the ‘flv’ format. The video was supposed to be a vertical one, but it turned out to be horizontal, that is ROTATED. So, I wrote a little program to rotate it back using libming. There are two things to take care of when processing the input …

Continue reading

D3 is a JavaScript framework used for data visualization. Learning how to work with D3.js is very easy. If you begin with the basics, you’ll see how easy it is to use D3, because: the DOM function names are much shorter than those in the legacy DOM library. the same functions are used for both …

Continue reading

The Bézier curve is a popular way to draw curves in graphic editors such as GIMP and Inkscape. A curve of degree n is defined using n+1 points, where the first and last are the start and end points of the curve, respectively, and the rest are control points. For example: The curve in the …

Continue reading

How do you declare a static variable in a JavaScript function? Not with the word “static“. In JavaScript “function” is a variable type similar to “object“. The difference is that the reference to a function inside itself is not this but arguments.callee. An example of using arguments.callee is the following function that returns itself: function …

Continue reading