Categories
CSS

Centering a DIV element

Trying to center a DIV element can be a frustrating experience.

<div id="content">
This is a DIV block that is to be centered. I don't
want the text to be centred, though, just the block.
</div>

The trick is to specify a width for the div, then set the left and right margins to auto.

#content {
  width: 700px ;
  margin-left: auto ;
  margin-right: auto ;
}

Just remember, this won't work if you haven't set a width for the

element.

Categories
Database MySQL

Selecting Field Names in MySQL

Selecting field names in MySQL is pretty easy, though it's not quite like the SELECT syntax we're all used to:

SHOW COLUMNS FROM TABLE;

To select all fields that start with 'customer' we extend that a little bit, note the wild card to select all fields that start with 'customer'.

SHOW COLUMNS FROM TABLE LIKE 'customer%';
Categories
Joomla!

Removing or changing the GENERATOR meta tag

You may prefer not to have the generator meta tag in the <head> section of your source code reveal what you've used to create your website.

To change this, insert the following  line immediately above the <head> line in the index.php file of your template, where text is your preferred text. You can also choose to leave it blank.

<?php $this->setGenerator('text'); ?>

Doing this in the template means your changes will not be overwritten when you upgrade the Joomla! core, but if you change templates make sure to change your new template.

Applies to Joomla! 1.5.

Categories
Uncategorized

PHP's empty() Function

This code snippet from http://php.net/empty illustrates a very useful function that helps eliminate some of the ambiguity we sometimes encounter with variables that have no value or boolean zero value.  The comments in the snippet explain it pretty well.

 

1
2
3
4
5
6
7
8
9
10
11
$var = 0;
 
// Evaluates to true because $var is empty
if (empty($var)) {
    echo '$var is either 0, empty, or not set at all';
}
 
// Evaluates as true because $var is set
if (isset($var)) {
    echo '$var is set even though it is empty';
}

[ad]

Categories
Uncategorized

ActiveX Error in Microsoft Outlook Signature Blocks

Signature files in Microsoft Outlook can pick up an aggravating ActiveX error, which I have associated with editing the signature file in MS Word but may also have other causes. A little edit to HTML source file will chase the message away without compromising the formatting of your signature file. Here's the Error Message:

One or more ActiveX controls could not be displayed because either:
1) Your current security settings prohibit running ActiveX controls on this page, or
2) You have blocked a publisher of one of the controls.
As a result, the page may not display correctly.

 

The Solution:

Start by opening the folder that contains your signature files.

  • For Vista:
    • %userprofile%\AppData\Roaming\Microsoft\Signatures
  • For XP and Windows 2003:
    • %userprofile%\Application Data\Microsoft\Signatures

Copy the appropriate line, click Start > Run, then Ctrl–V or otherwise paste the text onto the Run line and press Enter.

You'll see 3 versions of your signature file (in .htm, .txt and .rtf formats). Open the .htm signature file in Notepad or your preferred text editor (never in a Word Processor such as MS Word.) Then go to Edit > Find and type in “<object”.

You're looking for a line of code that resembles the following:

<OBJECT id=ieooui classid=clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D></OBJECT>

Just remove that <OBJECT tag, everything from <OBJECT to /OBJECT> and save the file.

Optionally, to make sure that the ActiveX object doesn’t come back you can make the file read only (In Windows Explorer select the file and Right-Click > Properties > Read Only), but this might limit your ability to edit your signature block from within Outlook, so I'd wait and see if this fix holds before I do that.