21 June 2005

Misc: Foiling Autodialers

When the phone rings at dinner time, it's usually some call center operator on the other end. Yes, its a wonderful offer but no thanks. Recently, some call centers have started using auto dialers to improve their staff efficiency because their operators don't have to dial out and wait for a response. The auto dialer only connects an operator when the recipient answers the phone. To foil these nuisances, just pick up the phone and say nothing. After about 10 seconds, the auto dialer hangs up. Other tips can be found in http://www.scn.org/%7Ebk269/data.html.

01 June 2005

Software: CSS Multiple Class Selectors

I just found out that HTML elements can have multiple (CSS) class names, such as <p class="Number ReadOnly">. This feature allows a design approach where the CSS class selector names are defined first. If the style definitions are independent of each other, then your elements can combine a number of styles. If you have a style sheet with these definitions ...
.ReadOnly { background-color : aliceblue; }
.Number { text-align : right; }
... and your elements have multiple class names ...
<input class="ReadOnly" readonly="true" value="ABCD"/>
<input class="Number" value="123456"/>
<input class="Number ReadOnly" readonly="true" value="34566"/>
... then ...
  • 123456 and 34566 should be right justified.
  • ABCD should be left-justified.
  • 34566 and ABCD shold have coloured backgrounds.

Software: Vim HTML Pretty Indentation

I initially wrote lots of dummy HTML table rows like this:
<table>
<tr><td>Blah</td><td>Blah</td></tr>
</table>
As the text in the table cells grew longer, the rows became harder to read and edit because they were wrapped over more than one line. So, I inserted a carriage return between every end and start tag. In vim, the command :%s/></>Control-Q Control-M/g< results in:
<table>
<tr>
<td>Blah</td>
<td>Blah</td>
</tr>
</table>
Still ugly. Now I want to prettify the text with indentation. I found tip 83. So, I moved the cursor to the start of the file, typed =G and got this:
<table>
  <tr>
    <td>Blah</td>
    <td>Blah</td>
  </tr>
</table>
Ahh, the power of vim!