How To Optimize Your Site With GZIP Compression

Kategoriler: Web Programlama

Compression is a simple, effective way to save bandwidth and speed up your site. I hesitated when recommending gzip compression when speeding up your javascript because of problems in older browsers.

But it’s the 21st century. Most of my traffic comes from modern browsers, and quite frankly, most of my users are fairly tech-savvy. I don’t want to slow everyone else down because somebody is chugging along on IE 4.0 on Windows 95. Google and Yahoo use gzip compression. A modern browser is needed to enjoy modern web content and modern web speed — so gzip encoding it is. Here’s how to set it up.

Devamını oku

Fast, Effective PHP Compression

Kategoriler: PHP Web Programlama

PHP compression is an excellent method of conserving bandwidth and reducing client download times. We have already discussed an excellent method for CSS compression, and in this article we share a super-easy technique for compressing all PHP content without editing a single file.

Using two PHP files and two corresponding lines of .htaccess, it is possible to compress your PHP files via gzip-encoding. Browsers and other user-agents capable of interpreting gz-encoded data will employ the compressed content, while other user-agents will utilize the content uncompressed.

Devamını oku

SQL Server, PHP and Truncating Text

Kategoriler: MSSQL PHP

PHP and SQL Server are a powerful combination, however sometimes data stored in a text type column is truncated for no apparent reason after 4096 characters. Here’s how to fix the problem.

Devamını oku

the Tar Command – Archiving, Compression, Encoding And Encryption

Kategoriler: Linux

The tar (tape archive) command bundles a bunch of files together and creates an archive (commonly called a tar file or tarball) on a tape, disk drive, or floppy disk. The original files are not deleted after being copied to the tar file.

To create an archive using tar, use a command like this, which bundles all the files in the current directory that end with .doc into the alldocs.tar file:

tar cvf alldocs.tar *.doc

Devamını oku

Download Entire Folder using Wget Command in Linux

Kategoriler: Linux

wget -m http://www.simsekmert.com/FOLDER_TO_DOWNLOAD/

-m, –mirror
shortcut for -N -r -l inf –no-remove-listing.

wget -H -r --level=1 -k -p http://www.simsekmert.com/FOLDER_TO_DOWNLOAD/

-r, –recursive

Specify recursive download.
-l, –level=NUMBER
Maximum recursion depth (inf or 0 for infinite).
-k, –convert-links
Make links in downloaded HTML point to local files.
-p, –page-requisites
Get all images, etc. needed to display HTML page.

MS-SQL limit command

Kategoriler: MSSQL

This example shows the MS-SQL (Microsoft SQL-Server) counterpiece for the limit command of MySQL.

Devamını oku

SQL to Select a random row from a database table

Kategoriler: MySQL

There are lots of ways to select a random record or row from a database table. Here are some example SQL statements that don’t require additional application logic, but each database server requires different SQL syntax.

Select a random row with MySQL:

SELECT column FROM table
ORDER BY RAND()
LIMIT 1
Devamını oku

What is the maximum length of a URL?

Kategoriler: Web Programlama

Although the specification of the HTTP protocol does not specify any maximum length, practical limits are imposed by web browser and server software.

Microsoft Internet Explorer (Browser)

Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. In my tests, attempts to use URLs longer than this produced a clear error message in Internet Explorer.

Firefox (Browser)

After 65,536 characters, the location bar no longer displays the URL in Windows Firefox 1.5.x. However, longer URLs will work. I stopped testing after 100,000 characters.

Devamını oku

Generating Random Numbers in JavaScript

Kategoriler: Javascript

To generate random numbers with JavaScript we employ the random() method of the Math object. It returns a floating-point number between 0.0 and 1.0.
JavaScript Math object has several methods and we shall encounter three on this page – the first one being random().

var rand_no = Math.random();
alert(rand_no);
Devamını oku

How to setup mail forwarding on Ubuntu?

Kategoriler: Linux Ubuntu

A common task is to set up mail forwarding on your web or mail server so that you can have email addresses like me@mydomain.com ; however, managing email on your server sucks, especially if you get into the horrors of courier imap or hula, and then you have to worry about backing up your email, spam filtering and lots of lovely tasks.