
How to create chess diagrams with PHP
In this post, I’ll show you how to generate chess diagrams on the server using PHP. The diagrams are cached automatically and served directly next time they’re requested.
In this post, I’ll show you how to generate chess diagrams on the server using PHP. The diagrams are cached automatically and served directly next time they’re requested.
Unlike CSV, fixed-width text files don’t use a separator to differentiate between fields. I’ll show how you can convert such a file in all major programming languages.
This little tutorial is intended for those learning Python and demonstrates a number of features, including OS-independent file manipulation, email parsing, string formatting and error handling.
With everybody using grunt.js for linting, css compilation and minification nowadays, I wanted to make a simple experiment and see if I could do the same using a plain batch file – in Windows no less. Turns out some things are very easy and some quite tricky.
As the complexity of today’s sites increases, so are the challenges to keep the site loading fast and bandwidth usage low. Minified scripts, concatenated CSS, image sprites and even hand-crafted static html are used for speedy delivery. This article discusses some less-known features of nginx that can lead to significant speed increase.
Union Platform is powerful and easy-to-use multiplayer server written in Java. By default it uses an embedded Derby database. In this article I’ll show you how you can replace this datasource with a MySQL one and how to process the database with minimum downtime.
One annoying scenario is when you let users enter their names and then you need to output their names nicely, for example in a newsletter. Some users simply enter their names in upper/lowercase, but obviously when you address them you can’t do the same. On the other hand PHP’s ucfirst() and ucwords() functions are too naive for proper capitalization.
A while ago I wrote an article about the common pitfalls of handling file downloads in PHP. One thing I did not realize at that time is that in most cases developers don’t have the time to write such a script and they’ll use whatever they can find, even if it has flaws. Because of this, I decided to write a download script and release it free for everyone with a BSD License. It’s not a class, just a script that accepts a “file” parameter via GET or POST and outputs the file. For security purposes any paths are stripped and replaced with a path in the script (the folder containing the downloadable file(s) should be protected against direct access).
Here’s a free, automated method to backup your site, including any databases. What you need is either a VPS hosting service or at least one that gives you SSH access. Your local computer can be Windows, Mac or Linux. I’ll write about Windows, since Linux users probably already know how to do this.
I’ve seen many download scripts written in PHP, from simple one-liners to dedicated classes. Yet, at least half of them share common errors; in many cases programmers simply copy the code from something that works, without even attempting to understand what it really does. What follows is not a complete working download script, but rather a set of issues you should be aware about and that will allow you to write better code.
If you thought having broadband makes page size irrelevant, you were wrong. Bandwidth costs money and a few saved kilobytes over a million impressions means real savings, not to mention that Google ranks sites based on their speed too. I’ll show you how you can create a fancy slideshow in under 2KB, rather than about 100KB for JQuery + JQuery Cycle plugin.
I was recently asked to aggregate tweets based on their hashtags using PHP (no Ajax), so I decided to turn this into a small tutorial that will hopefully enable you build all sorts of XML parsers in PHP.