ls or find command to find files that do not match a

find -not -name “*_*” -print

This is a bit too broad, actually,
because I presume that you don’t want to match directories if you can help it.
This is done by adding the primary -type f. If you’d like to further constrain your
search results to just those files in the current directory (remember, find likes to
traverse entire file trees, not just the current directory) you can add -maxdepth 1.
Change the “1″ to a “2″ and you’ll get only the current directory and matches one level deeper.

Put it all together and even toss in a second filename conditional to screen out
files with dashes in their names and here’s what you end up with:

find . -not -name “*_*” -and -not -name “*-*” \  -maxdepth 1 -type f -print

SQL SERVER reindexing

Taken from the microsoft site:

DBCC DBREINDEX
Rebuilds one or more indexes for a table in the specified database.

Syntax
DBCC DBREINDEX
(  [ 'database.owner.table_name'
[ , index_name
[ , fillfactor ]
]
]
)  [ WITH NO_INFOMSGS ]

Arguments
‘database.owner.table_name’

Is the name of the table for which to rebuild the specified index(es). Database, owner, and table names must conform to the rules for identifiers. For more information, see Using Identifiers. The entire database.owner.table_name must be enclosed in single quotation marks (‘) if either the database or owner parts are supplied. The single quotation marks are not necessary if only table_name is specified.

index_name

Is the name of the index to rebuild. Index names must conform to the rules for identifiers. If index_name is not specified or is specified as ‘ ‘, all indexes for the table are rebuilt.

fillfactor

Is the percentage of space on each index page to be used for storing data when the index is created. fillfactor replaces the original fillfactor as the new default for the index and for any other nonclustered indexes rebuilt because a clustered index is rebuilt. When fillfactor is 0, DBCC DBREINDEX uses the original fillfactor specified when the index was created.

WITH NO_INFOMSGS

Suppresses all informational messages (with severity levels from 0 through 10).

Remarks
DBCC DBREINDEX rebuilds an index for a table or all indexes defined for a table. By allowing an index to be rebuilt dynamically, indexes enforcing either PRIMARY KEY or UNIQUE constraints can be rebuilt without having to drop and re-create those constraints. This means an index can be rebuilt without knowing the table’s structure or constraints, which could occur after a bulk copy of data into the table.

If either index_name or fillfactor is specified, all preceding parameters must also be specified.

DBCC DBREINDEX can rebuild all of the indexes for a table in one statement, which is easier than coding multiple DROP INDEX and CREATE INDEX statements. Because the work is done by one statement, DBCC DBREINDEX is automatically atomic, while individual DROP INDEX and CREATE INDEX statements would have to be put in a transaction to be atomic. Also, DBCC DBREINDEX can take advantage of more optimizations with DBCC DBREINDEX than it can with individual DROP INDEX and CREATE INDEX statements.

DBCC DBREINDEX is not supported for use on system tables.

Result Sets
Whether or not any of the options (except NO_INFOMSGS) are specified (the table name must be specified), DBCC DBREINDEX returns this result set; this example uses the authors table of the pubs database (values will vary):

Index (ID = 1) is being rebuilt.
Index (ID = 2) is being rebuilt.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

DBCC DBREINDEX returns this result set (message) if the NO_INFOMSGS option is specified:

DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Permissions
DBCC DBREINDEX permissions default to members of the sysadmin fixed server role, the db_owner and db_ddladmin fixed database roles, and the table owner, and are not transferable.

Examples
A. Rebuild an index
This example rebuilds the au_nmind clustered index with a fillfactor of 80 on the authors table in the pubs database.

DBCC DBREINDEX (‘pubs.dbo.authors’, UPKCL_auidind, 80)

B. Rebuild all indexes
This example rebuilds all indexes on the authors table using a fillfactor value
of 70.

DBCC DBREINDEX (authors, ”, 70)

File Upload Problem PHP

Go to Internet Explorer -> Tools -> Internet Options

1) Click on the Security Tab
A)The Internet Globe should be highlighted
B)Click on Custom Level
C)Every Item should be set to enable
D)The Microsoft VM/Java Option should be set to low safety
E)Click OK

2) Click on the Advanced Tab
A) Scroll down to the Browsing Section
1) Uncheck if checked show friendly HTTP Error Messages
2) Uncheck if checked show friendly URLS
B) Scroll down to the Security Section
1) Uncheck if checked the ‘Check for publisher’s certificate revocation’ option
2) Uncheck if checed the ‘Check for Server certificate revocation’ option
3) Uncheck if checked the ‘Warn about invalide site certificates’ option
4) Uncheck if checked the ‘Warn if changing between secure and non-secure mode’ option
5) Check if unchecked the ‘Allow Active Content to run in files’ option
C) Click on Apply
3) Click on the Privacy Tab
A) The pop blocker should be desactivated
C) The Privacy Level should be adjusted to medium or less

4) Click on Apply then Accept

Apache Logout Script

This works really well for one page:
<?
header(“Expires: Sat, 01 Jan 2000 00:00:00 GMT”);
header(“Last-Modified: “.gmdate(“D, d M Y H:i:s”).” GMT”);
header(“Cache-Control: post-check=0, pre-check=0″,false);
header(“Pragma: no-cache”);
session_cache_limiter(“public, no-store”);
session_start();

function auth_user() {
$realm = mt_rand( 1, 1000000000 );
header(‘WWW-Authenticate: Basic realm=”Protected:[ID'.$realm.']“‘);
header(‘HTTP/1.0 401 Unauthorized’);
die(“Unauthorized access forbidden!”);
}

if(isset($_GET['logout'])) {
auth_user();
}
if (!isset($_SERVER['PHP_AUTH_USER'])) {
auth_user();
} else if (!isset($_SERVER['PHP_AUTH_PW'])) {
auth_user();
}

echo “pass = “.$_SERVER['PHP_AUTH_PW'].”
“;

mysql_connect(“localhost”, “root”);
mysql_select_db(“database”);
$validate_sql = “SELECT Username, PasswordÂ
FROM user WHERE Username = ‘”.$_SERVER['PHP_AUTH_USER'].”‘
AND Password = ‘”.$_SERVER['PHP_AUTH_PW'].”‘”;
if(!$validate_qry = mysql_query($validate_sql)){
die(mysql_error());
}

if(mysql_num_rows($validate_qry) < 1) {
if($_SERVER['PHP_AUTH_USER'] == “logout”) {
// message for firefox
die(“You have successfully logged out.”);
} else {
auth_user();
}
}

echo “You are now logged in
“;
if (ereg(“MSIE”, $_SERVER['HTTP_USER_AGENT'])) {
// Use basic logout
echo “<a href=\”".$_SERVER['PHP_SELF'].”?logout=y\”>Logout</a>”;
} else {
// use other logout for Firefox and other browsers
echo “<a href=\”<a href=”http://logout:logout/”>http://logout:logout</a>@”.
$_SERVER['SERVER_NAME'].”/”.$_SERVER['PHP_SELF'].”\”>Logout</a>”;
}
?>

Javascript DOM examples and PHP

<a href=”http://www.w3schools.com/js/js_examples_3.asp”>http://www.w3schools.com/js/js_examples_3.asp</a>
<html>
<head>
<script type=”text/javascript”>
function alertId()
{
var txt=”Element id: ” + document.getElementById(“myButton”).id
txt=txt + “, element type: ” + document.getElementById(“myButton”).type
txt=txt + “, element value: ” + document.getElementById(“myButton”).value
alert(txt)
document.getElementById(“myButton”).disabled=true
}
</script>
</head>

<body>
<form>
<input type=”button” value=”Click me!” id=”myButton” onClick=”alertId()” />
</form>
</body>

</html>

Ternary Operator PHP

boolean_condition?true_value:false_value

If it were written as an if-else statement, it would look like this:
if( boolean_condition )
{
true_value;
}
else
{
false_value;
}

In both cases you’re testing a condition that evaluates to true or false. If it evaluates as true, you want execute the true_value statement, otherwise you’d execute the false_value statement. Here’s an example:
$test_me = 1;

if( $test_me >= 0 )
{
print “Positive”;
}
else
{
print “Negative”;
}

To use all that with the conditional operator, you’d do this:
$test_me = 1;

print ($test_me > 0?”Positive”:”Negative”);