How to Create a Simple Navigation Like Next-Previous with PHP

We often need to create something for navigation. For example, we have a gallery that consists of 400 pictures and we’d like do create 40 pages to list 10 pictures per page. In this sample we will need to create a navigation bar that will allow us to switch between pages easily. It is ok to have 40… Read More »

How to Hide Midnight Commander Window and Show The Command Line

Just a simple trick that is often used. You’re working in mc  and need to issue a command from the command line. You can “minimize” Midnight Commander window and then return back to the place you were before with just a simple keyboard shortcut. Just input Ctrl+O to hide mc window. Command line interface will appear with the… Read More »

How to Check if Apache Is Up and Restart if Not

I do often monitor server apache status as most often reason of server outages is Apache overload. Some web hosting panels are sending notifications when your server is down; some web services like Alertra.com provide you with different notification options and one of my hosters has his internal monitoring service. But what to do if you need to… Read More »

Running a Cron Job Once a Day at a Random Time

Let’s say we need to randomize the time to run a cronjob. We need to run a script once a day but the time should be different each day. How should we proceed? I’ve got some solutions for this. The first one is a little stupid, but it will work if you have your own dedicated server. If… Read More »

How To Select All Files in A Midnight Commander Panel

Today my post will be quite short: a simple yet useful keyboard shortcut for mc. Often you need to select all files in a Midnight Commander panel, just like using Ctrl+A in Windows. Mignight commander has another shortcut, that uses mask and allows you to select all the files in a mc panel. Here is your initial view:… Read More »

Regular Expression to Parse Text Between Simple Tags (XML)

It is often necessary to extract text from a variable that contains HTML or XML code. I’ve created a simple regular expression that will help you to extract all text between certain tags into an array. It is a PHP solution, though regular expression is compatible with other programming languages. preg_match_all(“/<tag>(.*?)</tag>/”, $source, $results); This construsion will create an… Read More »

htaccess Site Redirection Without Parameters

Sometimes you need to redirect all traffic from one site to another. Very often site structure is different and the need is to send visitors to the main page of the site. This makes Site Redirection tabs of all known panels unusable, as the parameters are being sent to the new site. For example, if you had www.oldsite.com/index.php?f=9… Read More »