Archive for June, 2008

Delete MySQL Rows Older Than Date

I ran into a problem recently where I needed to delete all rows in a MySQL table that were older than three months. This I was able to accomplish with the following statement:

[code]
DELETE FROM [table] WHERE [column] < DATE_SUB(NOW(), INTERVAL 3 MONTH);
[/code]

Substitute table and column, and a proper date option. The date_sub function subtracts a time period from the date specified. In this statement, NOW() grabs the current date from which INTERVAL 3 MONTHS is subtracted (along with the < operand).

 

About Benjamin Perove

Ben has been associated with a broad spectrum of technologies starting from an early age, and he's contributed to the success of many businesses and enterprises since 2001. Most of his time is spent building cool stuff. When he's not working, he enjoys reading, playing acoustic guitar, and being with friends. He currently resides in Chiang Mai, Thailand.

Install Microsoft TrueType Fonts in Fedora and Ubuntu

When it comes to typography, Microsoft TrueType fonts are both visually appealing and aesthetically pleasing. They’re found all over the web, usually specified in stylesheets. Unfortunately for Linux users, the most common TTFs aren’t installed (by default, that is). Instead, they are replaced by generic equivalents. With these font packages installed, you will see websites as the designer intended.

The Microsoft TrueType fonts package includes:

  • Andale Mono
  • Arial Black
  • Arial (Bold, Italic, Bold Italic)
  • Comic Sans MS (Bold)
  • Courier New (Bold, Italic, Bold Italic)
  • Georgia (Bold, Italic, Bold Italic)
  • Impact
  • Times New Roman (Bold, Italic, Bold Italic)
  • Trebuchet (Bold, Italic, Bold Italic)
  • Verdana (Bold, Italic, Bold Italic)
  • Webdings

Installing MS TrueType fonts in Ubuntu

You can install the MS core fonts by installing the msttcorefonts package. You will need to enable the “Universe” component of the repositories (done by default in Feisty & Hardy). After that, run the following from the command line:

[code]
$sudo apt-get install msttcorefonts
[/code]

While this gives you the core fonts, it also gives you the ability to install any other font by simply copying the .TTF to the ~/.fonts/ directory.

When installing new fonts, you’ll need to re-login to be able to see & use them. Optionally, this step can be bypassed by regenerating the fonts cache with:

[code]
$sudo fc-cache -fv
[/code]

Installing MS TrueType fonts in Fedora

Yep, a few extra steps in Fedora, but still a cinch. From the shell:

[code]
cd /tmp
wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
yum install rpm-build cabextract
rpmbuild -ba msttcorefonts-2.0-1.spec
yum localinstall --nogpgcheck \
/usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
[/code]

That should do it. Reinitialize the font cache, re-login or reboot and have another look at this site (with Georgia).

 

About Benjamin Perove

Ben has been associated with a broad spectrum of technologies starting from an early age, and he's contributed to the success of many businesses and enterprises since 2001. Most of his time is spent building cool stuff. When he's not working, he enjoys reading, playing acoustic guitar, and being with friends. He currently resides in Chiang Mai, Thailand.

Add this site to your Firefox Search Bar

Twitter Activity

Recent Entries

Topics

Archives