mysql: count number of rows in a table

Which way to count a number of rows should be faster in MySQL?

SELECT COUNT(1) FROM TABLE_NAME

When you COUNT(1) it takes in count column indexes, so it will be the best result. Mysql engine actually stores row count, it doesn’t count all rows each time you try to count all rows.

here is the codes you can use it in a script to echo the count

$counter = mysql_query(“SELECT COUNT(*) AS id FROM table_name”);
$num = mysql_fetch_array($counter);
$count = $num[“id”];
echo(“$count”);

mac os x server file sharing not taking parent folder permission

The problem arises when someone other than me makes a folder in this shared directory. No one but the person who made that folder can write into it, not even me as a server admin.

i found this to set the permisions and it worked for me

  1. Click the name of your server in the sidebar under Hardware.
  2. Click the Storage tab and browse for and select a shared folder.
  3. Click the gear icon and select Edit Permissions from the pop-up menu.make sure your permission set correctly and also set permission for group

osx-fs

vi editor: remove lines longer than 40 characters

when i was working with mail address , one stage i had to export the contact list to a file and found there is junk mail address which obviously long lines like 013f8be66f33ce4b6dc28e505e56ddda@m.facebook.com

 

so i found a way to remove all lines longer than 40 characters with the most powerful VI editor

 

open your file in vi

 

# vim filename

and type this

:g/.\{40,\}/d

whala! you will see a message – something like this

324 fewer lines

 

 

 

WP Twitter Auto Publish Powered By : XYZScripts.com