Reference
For now, just a replacement for ref.pollestad.net.
PHP Arrays
PHP Arrays are easy but it's the multi-arrays that kicked my ass.
Here is how to do a mutli-dimesional array:
Two ways of filling it in:
or
Essentially the same thing.
Now, the thing to remember when printing is that the arrays cannot be in quotes.
Example:
while
Use print("blah" . $a[1][1] . "blah") to include in strings.
Sed
To globally replace every occurance of some pattern within any file:
(If you don't use /g, it will only replace the occurrence one per line, but will check every line)
You can also do several substitions on the same file:
http://www.suwald.com/linux-gnu/sed-howto.html
awk
Basic awk (prints out a column from a file):
This will print the second column separated by spaces from file.
Oracle
Connecting via command line to SQLPlus:
(be sure that the ORACLE_HOME env variable is set)
This Oracle SQL statement will display the names of all the tables within the current user's schema:
To display the names of all the tables that the current user has access to, use:
http://st-curriculum.oracle.com/tutorial/DBXETutorial/index.htm
SQL
- Logical Operators
Listing the names and ages of employees whose last names begin with S or P and who are less than 30 years of age.
Note the usage of parenthesis in the statement above. The parenthesis are meant to separate the various logical conditions and remove any ambiguity.
http://www.webdevelopersnotes.com/tutorials/sql/sql_primer_logical_operators.php3
- Update (Search/Replace)
When doing an SQL update that requires a search/replace, the following SQL query should do the trick:
Note that you can also use "trim" fuctions if needed:
Sample p.net php code would look like this (after performing a fetch_array while() loop...):
http://www.sqlteam.com/article/using-replace-in-an-update-statement
tcsh
Setting environment variables:
To append:
Be sure to escape any ":" that you add or you'll get an error.
SSL Certs
First, to generate a cert with no password and is self-signed (so Apache doesn't prompt us) (this assumes you have openssl installed and working...):
(cert is valid for 10 years)
(views the completed cert)
To generate a self-signed with password, simply change the first command to read:
(note the -des3 parameter)
The link below also details how to set up your own CA if you want to certify against that.
http://www.vanemery.com/Linux/Apache/apache-SSL.html