How to optional include config files in Apache
If you want to easy manage sites in separate configurations it might become handy to simply include them in the httpd.conf instead of defining the VirtualHosts in your httpd-vhosts.conf every time.
The following will include all files not starting with a hash character in the sites directory.
# Only include files not starting with a hash Include /usr/local/etc/apache22/sites/[^.#]*.conf |
Of course you still need to check for configuration errors using apachectl -t
My advice for naming the config files is as follows:
- nl_kitara.conf
- nl_kitara_subdomain.conf
- nl_kitara_sub-domain.conf
You might notice that I write the names in reverse, I do this so all the configs of one domain are sorted next to each other.
Of course you can make your own way of writing it down
How to format a USB stick in FreeBSD
Usually I only use 2 types to partition an USB drive, UFS or Fat32.
For UFS2 you run the following where da0 is your USB drive.
gpart destroy -F da0 gpart create -s gpt da0 gpart add -t freebsd-ufs da0 newfs /dev/da0p1 |
And for FAT32 you almost run the same commands.
gpart destroy -F da0 gpart create -s mbr da0 gpart add -t fat32 da0 newfs_msdos -L FILES -F 32 /dev/da0s1 |
Notice that you can change the label of the drive to your own preferred name.
How to use regular expressions (regex) in MySQL
Sometimes it might be useful to use regular expressions instead of using a LIKE statement.
Here some examples how you can use it.
Load data where the data only may contain alpha characters:
SELECT `id`, `field` FROM `table` WHERE `field` REGEXP '[a-z]'; |
Load data where the data only may only contain lowercase alpha characters:
SELECT `id`, `field` FROM `table` WHERE binary `field` REGEXP '[a-z]'; |
Load data where the data only may only contain digits:
SELECT `id`, `field` FROM `table` WHERE `field` REGEXP '[0-9]'; |
Load data where the data only may contain uppercase alpha characters:
SELECT `id`, `field` FROM `table` WHERE binary `field` REGEXP '[A-Z]'; |
For some more examples and information you might want to visit the MySQL website.
See: 12.5.2 Regular Expressions.
How to lower-/uppercase characters of content in MySQL tables
Only uppercase first character
UPDATE `theTable` SET `theContent` = CONCAT(UPPER(SUBSTRING(`theContent`, 1, 1)), SUBSTRING(`theContent`, 2)); |
Lowercase all and only uppercase the first character.
UPDATE `theTable` SET `theContent` = CONCAT(UPPER(SUBSTRING(`theContent`, 1, 1)), LOWER(SUBSTRING(`theContent`, 2))); |