viernes, 29 de febrero de 2008

Learn the Basics of Installing From Source in Linux

Few things can be as frustrating to non-expert Linux users as seeing the phrase "... or compile from source packages" on the download page of that killer app to try out (and we know that's often the case for you patient non-Ubuntu users out there). If you're looking for a nuts-and-bolts guide to installing software from those strange-looking Whatever.tar.gz files, Tuxfiles.org has a pretty good one.

PHP 5 Tutorial - Final Class and Methods

In this PHP tutorial we will understand the following:

  • Meaning of Final Class
  • Meaning of Final Method
  • When to declare a class as final
  • When to declare a method as final

Ajax Fast and Easy - Part one, two and three

The purpose of this post is to try to explain AJAX the way I understand it. To me, AJAX is not some complicated technology that you need to go out and buy books to learn. Rather, it is simply two or more web pages, and a couple of simple Javascript functions. I have come to hate the term AJAX. It seems every time I mention AJAX, either developers get nervous, or account managers get excited. Neither situation benefits me. Actually, I’ve pretty much stopped using the term at all. Depending on my audience, I’ll make up different terms. Like when I’m talking to Java developers, I’ll say “we need to do a back end call” and that doesn’t freak them out, but telling them we need to do an AJAX call makes them sweat.

Hopefully, if enough people read posts like this, the mystery and glamor will be removed from the term AJAX. So, lets get to the de-mystification.

Practical (and impractical) PHP Optimizations

I've been seeing a lot of articles popping up lately about PHP Optimizations, particularly within the code (rather than the configuration, server, caching, etc) that I have some nitpicks with.

My position remains the same: Unless your code is running incredibly slow, you've found every single bug you can possibly find without having nightmares about unit tests, or an optimization that makes more than a 10% improvement in speed (factoring in your margin of error,) don't bother. That said, let's down to brass tacks.

Each test is run 1000 times and the execution time is averaged over two different ways of achieving the same results. Execution times are rounded to millionths of a second, and taken using microtime. The server is running Ubuntu 7.10 server with PHP 5.2.3-1 and Apache 2, and will not have anything else open to keep the margin of error as low as possible. To be on the safe side, my margin of error (between doing this for years, and my guesstimate after running countless hours of benchmarks) is about 15% +/-.

(more...)

AJAX file upload tutorial

In this tutorial I will show you how to create simple AJAX file upload system using PHP and JavaScript.

Five basic Ajax tutorials

This post is a collection of five basic and most required Ajax tutorials with PHP. It inlcudes login, insert record into a database table, search engine, autosuggest and Edit in Place.

Prevent Contact Form Spam Email Header Injection

A common technique employed by spammers to send large quantities of email is through the use of unsecured web forms like contact forms. The vulnerability they exploit is a form of Header Injection. There are several basic steps you can take to secure your web forms and prevent spam from originating from your website.

(more...)

HTML Filtering To Secure Websites With HTML Purifier

Secure input and data handling is hard when it comes to HTML because of many different types of malicious code (XSS).

HTML Purifier is a well documented, standards-compliant HTML filter library written in PHP. It simply:

  • Removes all malicious code (better known as XSS) with an audited, secure yet permissive whitelist.

  • Makes sure your documents are standards compliant.

(more...)

How To Automatically Scan Uploaded Files For Viruses With php-clamavlib

This guide describes how you can automatically scan files uploaded by users through a web form on your server using PHP and ClamAV. That way you can make sure that your upload form will not be abused to distribute malware.

jueves, 28 de febrero de 2008

Debugging PHP code using debug_backtrace

Most of the PHP developers debug php code in their local machine just by trial and error using “print_r”,”var_dump” and “echo”. They dont write unit tests or follow any advanced debugger like xdebug. But the problem of using these methods is you cannot fool proof your code and their might be some bugs still present in your code. Lets see how can we debug our code more effectively getting more information from the php interpreter itself. There is a nice function called debug_backtrace() is available in PHP to trace the root of an error. As the name implies, you can trace the execution of you code which produces the error.

FreeBSD 7.0-RELEASE Available

The FreeBSD Release Engineering Team is pleased to announce the availability of FreeBSD 7.0-RELEASE. This is the first release from the 7-STABLE branch which introduces many new features along with many improvements to functionality present in the earlier branches.

(more...)

miércoles, 27 de febrero de 2008

jQuery Cycle Plugin

The jQuery Cycle Plugin is a lightweight slideshow plugin. Its implementation is based on the InnerFade Plugin by Torsten Baldes, the Slideshow Plugin by Matt Oakes, and the jqShuffle Plugin by Benjamin Sterling. It supports pause-on-hover, auto-stop, auto-fit, before/after callbacks, click triggers and many transition effects. It also supports, but does not require, the Metadata Plugin and the Easing Plugin.

(more...)

FPDF

FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

FPDF has other advantages:  high level functions. Here is a list of its main features:

  • Choice of measure unit, page format and margins
  • Page header and footer management
  • Automatic page break
  • Automatic line break and text justification
  • Image support (JPEG and PNG)
  • Colors
  • Links
  • TrueType, Type1 and encoding support
  • Page compression

(more...)

DragonFly BSD 1.12 available

DragonFly BSD developer Matthew Dillon has announced the release of DragonFly BSD 1.12, a BSD operating system originally forked from FreeBSD 4 in order to develop a radically different approach to concurrency, SMP, and most other kernel sub-systems.

(more...)

martes, 26 de febrero de 2008

Using JQuery to Add Drag and Drop Support

Drag and drop support in a web application always get some attention. I used drag and drop support in one of my applications and I have to admit that it involved a lot of JavaScript code. You can check out the article "Browser Compatible Drag and Drop Shopping Cart".

Today I had to create the same drag and drop approach so I decided to check out the drag and drop API's of the JQuery library. I have to admit that JQuery is one of the best JavaScript library that exists today. I can go on and on with the praise but let's take a look at the animation of the sample application.

PHP: Best practices

This guide will give you solutions to common PHP design problems. It also provides a sketch of an application layout that I developed during the implementation of some projects.