My serial printer doesn't work. What shall I do?

Feb
04

Serial printers generally do not require a device driver to work in a desired software application. If POS software cannot print directly to the serial printer, it is preferable to make sure we can print from the running operating system such as Windows or Linux. Here are a few things to do to diagnose serial printer problem.

Use the right cable. When trying to connect DTE (PC) to a DTE (such as printer), you'll need to use a null model cable. For information about RS232 Cabling, refer RS232 Cables, Wiring and Pinouts.

Posted By admin read more

TCP Sweep - What is causing it?

Feb
04

Running a company as a reseller web host, you'll often receive an email from your upstream provider reporting security violations. If you do not correct the problem in a timely manner, your upstream provider may block inbound and outbound traffic from the affected server.

Today, we received a security report from Savvis indicating that one of our Windows 2003 server is sweeping TCP port 445. This obviously violates their "Acceptance Use Policy". Here is the snippet of their log entry.

Posted By admin read more

How to find duplicate values in a table column?

Feb
04

There was an error with one of our application, and I needed to find table rows with duplicate values. The table column was not defined to have a unique index, but we weren't anticipating duplicate values. I needed an easier way to identify duplicate values in a table with simple SQL statement.

Consider the following "employee" table:

Posted By admin read more

How to install php-imagick on CentOS 5

Feb
04

ImageMagick is a software suite to create, edit, compose or convert bitmap images. To use this utility in PHP, you'll need to install ImageMagick Linux package and also build and install a PHP extension.

Prerequisite for installing imagick PHP extension is php-pear and gcc packages, so let's get those packages installed.

# yum install php-pear gcc

Now, that you have php-pear and gcc, you may install ImageMagick packages.

# yum install ImageMagick ImageMagick-devel php-devel
# pecl install imagick

Posted By admin read more

Multiple Constructors in PHP

Feb
04

In most object-oriented programming languages such as Java, C++ and C#, you can define multiple constructors each having different signatures. The class calls correct constructor based on the number of parameters, and data type of input parameters. In PHP5, however, you can have one and only one constructor. Constructor in PHP is defined with a reserved keyword, __construct(). If the __construct function doesn’t exist, PHP5 will search for the old-style constructor function by the name of the class.

Posted By admin read more

Copy and Paste Word document to HTML form

Feb
04

Many users without computer knowledge copy contents from a word document, and paste them into a HTML form (<textarea></textarea>) and expect to retain formating as well as special characters such as smart quotes and emdashes. You may opt to translate smart quotes to regular quotes and emdashes to regular dashes with a PHP script. If any user submits a non-ASCII character contents, you'll probably see weird characters in the database and HTML page. Finding and fixing just a few of them (curly quotes and em dashes) isn't going to solve the real problem.

Posted By admin read more

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

Pages

Subscribe to Web Traffic Exchange RSS