PHP: Absolute Value Function abs()
A number’s absolute value is the distance from the origin of the axis to itself. In PHP, you can get the absolute value of any numeric value by the help of abs() function: $a = abs(-19.7); // $a = 19.7
A number’s absolute value is the distance from the origin of the axis to itself. In PHP, you can get the absolute value of any numeric value by the help of abs() function: $a = abs(-19.7); // $a = 19.7
The open_basedir directive in php.ini limits PHP file accesses (such as file opening, writing and deleting) within a designated directory such as /home/www/public_html so that it doesn’t endanger the rest of the system in any way. With proper Apache permissions and PHP installed as an Apache module, PHP inherits whatever privileges Apache has. As Apache …
Well it depends on the Linux distribution you are using, the version of php and the way you install it with Apache web server. Php.ini may be here: /etc/php.ini Or here: /etc/php/php.ini /etc/php5/php.ini Or here: /usr/bin/php5/bin/php.ini Anyway, you can always find any file named php.ini in this manner find / -name php.ini The simplest yet …
Ctrl+S happens to be a rather handy and popular combination as it’s used in Windows applications to save your current working data. I accidentally used it several times in Vim and it keeps locking the screen up and halting the interactivity — basically, after Ctrl+S I can’t do anything to the terminal (window). I use …
Accidental Ctrl+S Locks and Freezes Linux Terminal / SSH / Telnet Read More »
Unbuntu has auto-configured Vim to use syntax highlighting for text (mostly, programs and configuration files of course) editing, the problem however, is that some of the colors appear to be darker than wanted on SSH console and it’s a little hard to recognize comfortably. So how can we change the default colors of the syntax …
Unmanaged hosting provided by Rackspace acquisition Mosso, Cloud Servers can be really a bargain considering their dedicated support and ease of use from the control panel. The pain lies in the server administration and stuff which I’m still learning my ropes with. But hey, for less than $15 a month, it’s fun! I’ll throw in …
Back when WordPress was pretty young there’s some loopholes that enable hackers to inject unauthorized and dangerous HTML code into your website pages, thus promoting the distribution of malware that damages the end users computer. I was once there and got penalized by Google for one of my sites. However, they are gentle enough to …
A quick tip — I kind of have the feeling that I’ve covered this before, but whatever — well, just the simple SQL query below will do: CREATE TABLE temp SELECT id, COUNT(id) FROM `book` GROUP BY isbn, subject HAVING COUNT(id) > 1 Wherein each combination of column isbn and column subject in each of …
Today I’m optimizing some MySQL tables with large number of records — 1 million of them, yeah, I know — , it’s simply impossible to deal with such big chunks of data without proper indexing. So there I was, adding a variety of indexes to a few of the columns. It’s expected it’d take a …
MySQL: Huge Table Not Responding after Adding Index Read More »
PHP can execute shell commands, which means it can compress selected files into a archive or zipped package: exec(‘tar zcf files.tar.gz file1 file2 file3’); Or make a zip file: exec(‘zip files.zip file1 file2 file3’); You can then use PHP to render and supply download of the zip file to your visitor.
There are times when you need to store a file (such as one that you sell for profit) outside of the document root of your domain and let the buyers download it via a PHP script so as to hide the real path, web address or URL to that file. Use of this approach enables …
PHP: Hide the Real File URL and Provide Download via a PHP Script Read More »
Well, MySQL doesn’t actually have anything called Foreign Key, it’s just my way of saying a alien column from another table. Let’s say 2 tables are related, 1 is books and the other is subjects. Any book in book table falls into one of the subjects, thus having a subject column referencing the ID of …
MySQL: Counting Number of Records or Rows by a Foreign Column (from Another Table) Read More »
As MySQL doesn’t have inherent support for updating more than one rows or records with a single update query as it does for insert query, in a situation which needs us to perform updating to tens of thousands or even millions of records, one update query for each row seems to be too much. Reducing …
MySQL: Update Multiple Rows or Records with One Single Query Read More »
To find / identify a part of an original string and replace it with another string in a SQL query with MySQL, use REPLACE(), the string replace function. For example, you may want to replace all spaces in one of the varchar or text fields to a single dash: UPDATE `table` SET `old_field` = REPLACE(`old_field`, …
MySQL: Replace Substring with Another String – the MySQL String Replace Function Read More »
One of the principles of data integrity is to reduce data redundancy as much as possible and wipe out any duplicate database table entries. Another reason for this is that you need to add unique indexing to one or a group of table columns and you need the one column or combination of columns to …
MySQL: Deleting Duplicate Rows or Records | Selecting Unique Rows into A New Table Read More »
I joined Dynadot at the commencement of .tel domains and tried my luck to get some domainers to register a domain with them. Maybe it’s because they just don’t care about expanding via affiliates, the system might be a little buggy or not so affiliate friendly in that once the referred friend signed up an …
Dynadot Affiliate Program Review – Not Worth the While Read More »
Amazon Affiliate system does a great job presenting you a variety of ways to make associate affiliate links so that you can take credit of their products that you have referred to others. Today I messed around a little bit with their generators and finally come to a simple solution to generate affiliate links dynamically …
Proper indexing can work wonders for large databases in query efficiency, it’s a compromise of disk storage in exchange for sorting speed. For databases with millions of records, indexing takes considerable amount of disk storage, and, AGONIZING lengths of time to create. I recently compiled a database with one table mytable consisting of over 4 …
Just imagine, that much amounts of money just vaporized into thin air at a cause of nothing. Company Bankruptcy date Total assets pre-bankruptcy (in millions) Lehman Brothers Holdings, Inc. 9/15/2008 $691,063 Worldcom, Inc.1 7/21/2002 $103,914 Enron Corp.2 12/2/2001 $65,503 Conesco, Inc. 12/17/2002 $61,392 Pacific Gas and Electric Co. 4/06/2001 $36,152 Texaco, Inc. 4/12/1987 $34,940 Financial …
Naturally, you’d never expect an AdSense ad of a site to appear on itself. But this I just encountered, indicates an inherent *bug* of AdWords. Or is it? But I’ll never understand otherwise. What’s the point? Maybe there’s an option for the AdWords advertiser to opt out of his advertisement listing being published on his …