Archive (38 tips)
December 22nd, 2016 6,159
Strong password without having to remember it? Is it possible? Is it safe?
December 21st, 2016 4,788
How to delete a command in Bash history. Sometimes it is better to not include a secret command in history. See how.
October 25th, 2016 10,681
In Ubuntu, Grub boot menu is hidden by default. You can display it by pressing "SHIFT" continuously at boot time. This is useful (among other cases) in case you want to boot in Recovery mode. How to make this change permanent?
October 19th, 2016 12,091
Use needrestart to determine if some services need restart or system reboot is required after Debian or Ubuntu update
When you prompt user to input text (e.g. username, lastname etc), you may use Regular expressions to sanitize User Input
If you want to start a youtube playlist from random video, just add: &index=random_number to the src attribute of the embed code.
Php has functions to easily get basename and file extension. In some cases using of regular expression is necessary.
December 9th, 2013 22,828
A good solution is to use immutable disks. When a virtual disk marked as immutable, it becomes read-only and differences will be stored in differencing disks
December 9th, 2013 36,413
It is useful to prevent direct access of AJAX calls (from browser address bar). A solution could be the following simple function check_is_ajax()
November 4th, 2013 55,858
Date manipulation is a common and useful development task. It was never easy with PHP, until PHP5 and DateTime class. Take a look at date_convert() function
November 4th, 2013 19,181
Sometimes you want to check if a string represents a valid timezone. Using PHP versions greater than 5.2, timezone_identifiers_list() would be a solution.
October 2nd, 2013 164,946
Browser (and browser version) detection is an "all time classic" development requirement. jQuery.browser WAS an excellent solution, but it was removed
September 27th, 2013 112,174
PHP shuffle randomizes (shuffles) the order of the elements in an array. You may use this function to create a simple banner rotator.
September 27th, 2013 31,041
Sometimes, you want to create a list of available time zones to prompt your user to select his/her time zone. PHP offers timezone_identifiers_list
September 13th, 2013 5,964
In most cases you can distinguish if a PHP script was invoked from the command line (or Cron) or by the web server, using php_sapi_name()
September 9th, 2013 50,731
Sometimes you need to replace accented characters with non accented, for example when you want to perform an accent insensitive search. See this function.
September 8th, 2013 53,247
PHP DateTime class, available with PHP versions greater than 5.2 is very powerful. As an example, it ts very easy to check if a string represents a valid date
September 7th, 2013 3,744
How can you create a reference to a DOM element using jquery? In other words, what is the jquery equivalent of document.frm.element_name
September 6th, 2013 35,039
How to display line numbers in nano text editor
September 5th, 2013 3,615
A simple solution to scan your network is nmap. Avoid to use nmap in external networks, as it could be considered as an 'attack'.
September 4th, 2013 18,635
September 3rd, 2013 43,319
September 2nd, 2013 20,546
Use of include is very common in PHP. include will parse a file and display the result. But, how to store the result in a variable for later use?
September 1st, 2013 5,188
A I am running Linux (Archlinux or Debian) on my workstations and I use XFCE for desktop environment. I keep two portable backup versions
How to take a screenshot from command line in Linux (even from ssh connection) in a system running X server
August 30th, 2013 634,971
To get current datetime (now) with PHP you can use date with any PHP version, or better datetime class with PHP version greater than 5.2
PHP is_numeric() is useful to find whether a variable is a number or a numeric string. How you can check if a variable is an integer?
Use the powerful find command with exec parameter to change permissions using chmod
A convenient way to pass a single or multidimensional (possible utf-8) array is to serialize it ("convert it to a string") and pass it using a hidden input.
It is very important for dynamic web applications, any js and css changes to become available to user (without need to refresh - reload browser page)
PHP stripos (or mb-stripos) finds the position of the first occurrence of a case-insensitive substring in a string. How to find all occurrences?
This error is produced, because MySQL exports DEFINER with views or procedures, which might be not the same in production and developer machines
August 23rd, 2013 126,052
The ideal way to escape a string with php, is json_encode. This requires php > 5.2. Here is a solution for older versions of php.
Using Facebook LIKE button or other SM buttons, it is useful to define the URL of the page you want to share. It is not requested, as the page URL is used.
You can search for a certain package in a Debian system using dpkg
To find out system CPU is 64-bit capable or not, use /proc/cpuinfo
To find out if you are running a 64-bit or 32-bit kernel, uname command is enough: uname -m