PHP $_SERVER environment variable

Feb
04

PHP provides a large number of predefined variables to all scripts, and $_SERVER array is commonly used to refer server-specific environment information. Per PHP.net documentation, the $_SERVER variable is defined as:

Posted By admin read more

How to reverse a MySQL result set?

Feb
04

I need to grab last 100 rows of a MySQL table, and loop them through in reverse order. The array_reverse() PHP function won't reverse the "resource" or "array" data types, so it isn't as easy to reverse the array of "mixed" data type. The best way to achieve this is by using a SQL statement as shown below.

SELECT * FROM (SELECT * FROM mytable ORDER BY id DESC limit 100) 
AS foo ORDER BY id ASC;

You may also retrieve the MySQL result set in descending order, and traverse the set in reverse order.

Posted By admin read more

How to install Subversion on SuSE Linux?

Feb
04

I've had a chance to install Subversion on Windows machines in the past, but this is my first try on SuSE Linux. The process is pretty straight forward, and it's fairly easy to follow. Here is the run down summary of how to get started.

1. Use Zypper to install the following modules:

# zypper install subversion subversion-tools apache2

2. Once you have required software modules, installed browse the following README file to setup your subversion repositories.

Posted By admin read more

Double and Triple equal operators in PHP

Feb
04

Even if you're a seasoned programmer, you may not have seen triple equals operator in most programming languages. In PHP, the triple equals (===) operator was introduced in version 4 and it checks for equality similar to double equals (==) operator but also checks type of variable. Here are the differences between single, double and triple equals operators.

A single equals operator (=) is an assignment operator - take what's on the right as an expression and save it in the variable named on the left.

Posted By admin read more

Assigning name/value pair from a single element array to variables

Feb
04

How do you extract name/value pair of an associative array into PHP variables? Whether it's a single element array, or multiple element array the procedure is identical.

Posted By admin read more

How do I extract information from an SSL key and certificate?

Feb
04

An SSL certificate contains the information about issuer, valid dates, subject and other cryptic information. The openssl x509 subcommand may be used to retrieve those information from a SSL certificate.

# The "-text" option will output full breadth of certificate information.
bash# openssl x509 -text -in server.crt

# The "-issuer" option will show issuer.
bash# openssl x509 -noout -in server.crt -issuer

# The "-subject" option will show Organizational information.
bash# openssl x509 -noout -in server.crt -subject

Posted By admin read more

How do I disable ping response on Linux?

Feb
04

To disable responses to a ICMP ping request, the following two kernel parameters can be added to the /etc/sysctl.conf file.

# Disable ping response
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_echo_ignore_all = 1

To apply the changes, perform the following command.

# sysctl -p

To make it one time change, run the following command.

echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all

Posted By admin read more

Getting Started with Oracle SQL*Plus

Feb
04

SQL*Plus is a command-line application that allows you to manage virtually every facet of the Oracle database. This article may be viewed as FAQs on SQL*Plus.

Before using SQL*Plus, there are a number of environment setting that you may want to configure. To toggle any of those settings, use the SET command shown below.

% sqlplus username
Enter Password: *****
SQL> SHOW ALL
SQL> SET {setting} ON/OFF

To turn on SQL query results to the terminal, set the following environment variable.

Posted By admin read more

Oracle Import and Export: how to use it?

Feb
04

The Oracle export (exp) and import (imp) utilities are used to perform logical database backup and recovery, which allow you to write data into an operating system file and read back into the Oracle database. They are also used to move Oracle schema and data from one machine to another, or one database to another.

The exp/imp utilities use an Oracle proprietary binary file format and can thus only be used between Oracle databases. One cannot export data and expect to import it into a non-Oracle database.

Posted By admin read more

Install spamassassin with sendmail

Feb
04

Documentation http://spamassassin.apache.org/

1. Install spamassassin on the server

# yum install spamassassin

2. Install required perl CPAN modules

# perl -MCPAN -e shell
cpan> install Digest::SHA1
cpan> install HTML::Parser
cpan> Install option perl modules...

2. Edit spamassassin configuration in /etc/mail/spamassassin/local.cf .

Posted By admin read more

Pages

Subscribe to Web Traffic Exchange RSS