PHP & More

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

Matplotlib is a MATLAB-like library that allows Python programmers to create images and animations. For example, you can easily draw a graphic representation of functions with Y (and maybe Z) values generated by numpy and scipy functions. Matplotlib can also be interactive and handle events. The command mpl_connect is used for connecting an event with …

Continue reading

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

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

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

Browsers supporting HTML5 allow you to draw on the browser’s screen without preparing an image file before. Drawing on a canvas is done using the wonderful Javascript language. If you want to draw a 2-dimensional image on canvas element ‘cnv’, get the drawing context using: var ctx = cnv.getContext(“2d”) And use that context to draw …

Continue reading

Processing is a programming language used mainly for animations and graphical applications. If your program is written in pure Processing, the same code can be run in many tools that use their own language: Windows with Java applets, HTML pages with Javascript, Android applications, etc. Running an application  is done by choosing a mode from …

Continue reading