Crisp Fonts on Linux

December 18th, 2008

fontsWell I just installed Linux Mint tonight as I really liked where the Project was going, it’s basically Ubuntu with some extra’s for the real Linux geeks.

The only problem with any (or most) new Linux installations is that the fonts are blurry and spacing is just off.. So I did some googling and found this thread on the Ubuntu forums, if you follow the 2 simple steps given you’re fonts will look a lot better..

Create a file called .fonts.conf in your home directory (vim ~/.fonts.conf) and paste in the following contents

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="autohint" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
</fontconfig>

After that relog.

Apperantly the reason this isn’t done by default is because Apple has some patents on the techniques used to make this happen.. don’t you just hate patents..

Note that I’ve only tried it on Linux Mint 6 (based on Ubuntu 8.10), but I reckon it should work for most distro’s.. gonna try it tomorrow on Centos 4.7 at work.

cPanel – How to put all Domains in the same Folder

December 11th, 2008

cpanelIf you’ve ever used cPanel you probably know that each account is tied to a default domain for that account.. you can add more domains to each account but these will be seen as additional domains..
This idealogy has always annoyed me.. because it also means that your default domain is bound to the public_html folder and all other domains can have either that folder or any sub folder as it’s homedir.. but I want all my domains in the same folder, not one “default” domain as the main folder and put all other domains in a subfolder of that domain.. where’s the logic in that?

So I used htaccess to have mod_rewrite redirect the main domain to the “domains” folder… which is the same folder all my other domains use, this way I can have things the way I like.

Here’s the code that you put right inside your public_html folder;

<IfModule mod_rewrite.c>
RewriteEngine On
ReWriteCond %{HTTP_HOST} naatan.com
ReWriteCond %{DOCUMENT_ROOT} !domains/
ReWriteCond %{DOCUMENT_ROOT} !subdomains/
ReWriteRule ^(.*)$ domains/naatan.com/$1 [L]
</IfModule>

Of course you’re gonna want to replace naatan.com with your domain..

Read the rest of this entry »

Multiple spaces in Wordpress posts

November 12th, 2008

nbspIf you’ve ever tried posting source code on your blog you probably have noticed that Wordpress has the annoying habbit of stripping out multiple spaces out of your post, god knows why.

Anyway, I was not the only one getting annoyed by this and so a plugin already exists to fix this behaviour, only this plugin will make ugly nbsp’s appear in your post when editing it, to fix this, simply replace line 39 with the following

$text = str_replace('&amp;nbsp;','&nbsp;',$text); // Allow NBSP's

That’s it, you should now be able to use multiple spaces in your posts.

Adding Smilies to your Wordpress Plugins

November 11th, 2008

wordpress-logoWhilst monitoring the #wordpress irc channel on irc.freenode.net I came across a question by “erchik” asking how to add smilies to his widgets.

After some researching I found this to be quite simple, of course there is unfortunately no global way of doing this for all your widgets at once, since every widget has it’s own backend, but it’s quite easy to achieve and is not limited to widgets, you can use it in plugins and templates all the same.

Simply add the following lines to your code right before you are outputting the string that you want to contain smilies


global $wp_smiliessearch, $wp_smiliesreplace;
$content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);

Replace $content with the name of your string containing the content.
Read the rest of this entry »