How to allways show scrollbars in Firefox

2 Jun 2009 In: CSS

CSS designers allways have same problem; when the page is short there is no scroll in firefox but there is in ie. We can’t remove IE’s scrolls but we can put scrolls to Firefox.
Here we go;

html {
     overflow: -moz-scrollbars-vertical;
}

Remove last char of string in PHP

30 May 2009 In: PHP

Simple and clear;

substr_replace($string ,"",-1);

Free feed directories

27 May 2009 In: Bookmarks, SEO

Here is the list of some free feed directories;

http://www.feedest.com/feedAdd.cfm

http://www.2rss.com/index.php

http://www.fybersearch.com/add-url.php

Read the rest of this entry »

How to print all defined variables in PHP

25 May 2009 In: PHP

we’ll go it with get_defined_vars() function. get_defined_vars returns multidimensional array with all defiend variables in PHP
here we go ; Read the rest of this entry »

I am going to divide each part as follows

1. Plan the layout of the filesystem with the new drive
2. Partition the new hard drive
3. Format the new partitions
4. Test the new space
5. Copy data from old to new partition (optional)
6. Edit /etc/fstab
7. Reboot
8. Remove old data (optional)

Here is the details about each one.
Read the rest of this entry »

Mysql Dump and Restore commands

21 May 2009 In: PHP

if you want to backup and restore your big MySQL databases you need better solution than phpmyadmin

So here we go;

To dump all databases to a file:

$ mysqldump -u dbuser -pdbpass --all-databases > all-databases.sql

To dump a single database to a file:

$ mysqldump -u dbuser -pdbpass somedb > somedb.sql

Dump InnoDB in a single transaction:

$ mysqldump -u dbuser -pdbpass --single-transaction somedb > somedb.sql

To restore:

$ mysql -u dbuser -pdbpass somedb < somedb.sql

How to get file extensions in PHP

21 May 2009 In: PHP

There are several methods get a file extension using PHP:

<?
$filename = 'myfile.jpg';
 
// 1. The "explode/end" method
$ext = end(explode('.', $filename));
 
// 2. The "strrchr" method
$ext = substr(strrchr($filename, '.'), 1);
 
// 3. The "strrpos" method
$ext = substr($filename, strrpos($filename, '.') + 1);
 
// 4. The "preg_replace" method
$ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filename);
 
// 5. The "never use this" method
//   From: http://php.about.com/od/finishedphp1/qt/file_ext_PHP.htm
$exts = split("[/\\.]", $filename);
$n = count($exts)-1;
$ext = $exts[$n];
?>

Free premium wordpress themes

20 May 2009 In: Bookmarks

High quality free Wordpress Themes have become harder and harder to find in the past year, with the influx of premium themes, more and more designers and developers are selling themes (and rightly so, they do amazing work). But, that aside, the quality is certainly there, and we are sure you will be impressed with this Wordpress theme compilation for 2009.

1 – Blog & Portfolio Themes(1-35)

2 – Magazine & Corporate Themes(36-57)

3 – Photo blogs & Gallery Themes(58-68)

4 – Minimal & Clean Themes Themes(69-84)

5 – Smashing Magazine Themes(85-98)

6 – Something different… (99-104)

Blog & Portfolio Themes

One Room [Demo]

Free Wordpress themes

Elegant Grunge [Demo]

Free Wordpress themes

Fusion [Demo] Read the rest of this entry »

Debian: How to make scripts run at boot

17 May 2009 In: Linux

Debian uses a Sys-V like init system for executing commands when the system runlevel changes – for example at bootup and shutdown time.

If you wish to add a new service to start when the machine boots you should add the script to the directory /etc/init.d/. Many of the scripts already present in that directory will give you an example of the kind of things that you can do.

Here’s a very simple script which is divided into two parts, code which always runs, and code which runs when called with “start” or “stop”. Read the rest of this entry »

I spend a lot of time lurking in the channel # PHP (EFnet and freenode, please – no flame wars) and this issue is a frequently asked that the rule is a simple answer in the form of the use of strpos (), or best to ip2long () in a more than less than reply.

Unfortunately, although the people in the rule that an IP address is just an unsigned 32-bit integer, and is easy to determine, usually with $ _SERVER [ "REMOTE_ADDR"], where the real challenge – is in defining the range within which it must decide whether the IP address. IP ranges are usually divided into three categories (in increasing complexity):

1. Wild Card: 192.168.10 .*
2. Start-end: 10.1.0.0-10.1.255.255
3. * CIDR: 172.16.1.0/24

* Classless Inter-Domain Routing
Read the rest of this entry »


Sponsors