Server Migration – Part 2

I’ve finished the server migration and everything was successful and only maybe 30-45 minutes of downtime. The old computer I’m using for a server got an upgrade while I was migrating as well. A little faster processor and doubled the memory in it.

I did run into a problem with ESXi, apparently since the motherboard was older in the server ESXi wouldn’t install correctly onto the drive I had in there, and the motherboard also didn’t support booting from USB to install ESXi to a flash drive, as suggested by a few sites. So I scraped the idea for ESXi and installed CentOS 5.4 on the server without any desktop managers and disabled everything except a few essential services, this netted a server using less than 200 MB of memory. Then I installed VMWare Server 2 on it and transferred my VM image over to the server. Although there is more overhead having a complete OS and VM Server for my purposes it should be fine.

Posted in Aside, Linux, tech | Tagged , | Comments Off on Server Migration – Part 2

Server Migration – Part 1

Before this week, my server that handles this website was beginning to show signs that it need a fresh start. It’s currently running CentOS 4.4, so I decided it’s time to upgrade. So I grabbed the latest DVD iso from CentOS for 5.4 and installed a clean virtual machine on my desktop. I’ve just finished migrating everything from the old server to the virtual machine. I’ve also done away with the cobbled together mail solution of sendmail, dovecot, and assp I had running in favor of a very nice open-source Exchange-type replacement called Zimbra.

The next step after a couple of days of testing will be wiping the old drive in the old server and installing VMWare ESXi on it. I decided to virtualize to make it easier to upgrade in the future when I decide to build a new desktop. I’ll retire my current desktop and recommission it as the new server and having everything virtualized should make the transition much smoother. I’m hoping downtime will be minimal if any at all.

Posted in Aside, Linux | Tagged , , | Comments Off on Server Migration – Part 1

WordPress Theme Developers Tip – Call Dynamic CSS the Right Way

This solution should no longer be used. After further research and reading other’s suggestions, the ideal solution is to just output the css directly to the head section of your code.
While developing my Techozoic theme, I’ve progressed from adding custom CSS into the head section, to having an external file and using $_GET variables to pull options from the database, to now I believe is the right way to do it, using add_filter and a custom query in WordPress. By using this new method I’ve done away with unsafe $_GET variables and can now use any builtin WP functions in the external file.
First you’ll need to edit your functions.php file and add this block of code.
[php light=”true”]
add_filter(‘query_vars’, ‘add_new_var_to_wp’);
function add_new_var_to_wp($public_query_vars) {
$public_query_vars[] = ‘my_theme_custom_var’;
//my_theme_custom_var is the name of the custom query variable that is created and how you reference it in the call to the file
return $public_query_vars;
}
[/php]
This sets up WP to now accept a new variable in a query called my_theme_custom_var the format of the query would be http://www.yourblog.com/index.php?my_theme_custom_var=css . The ? mark tells WP that this is a query and the = sign tells what the query variable should be set to.

Now to actually setup the function that will call the external file. I found this gem when looking at how popular WP theme called Atahualpa handled it’s external CSS.
[php light=”true”]
add_action(‘template_redirect’, ‘my_theme_css_display’);
function my_theme_css_display(){
$css = get_query_var(‘my_theme_custom_var’);
if ($css == ‘css’){
include_once (TEMPLATEPATH . ‘/style.php’);
exit; //This stops WP from loading any further
}
}
[/php]
This code now will check if a query is passed to WP with the value my_theme_custom_var and if it is and has the value of css then it includes the style.php file which is our dynamic CSS file. Then the code exits which stops any other functions from happening other wise the whole home page is outputted along with the style.php file, which isn’t what is needed only the file.
Now you can use any WP functions on the style.php file as it is included from the functions.php file which is a standard WP file.
Source : Will Norris

Posted in guides, tech, wordpress | Tagged , , | 20 Comments

WordPress Theme Options Framework Ver 2

As I’ve worked more on my theme and increased my coding skills I’ve added to my original theme option framework. I’ve become more aware of best practices of coding and WordPress, a big issue with the original framework was the way options were added to the wp_options database table. Each theme option got it’s own entry in the table, this might be okay for small theme, but I’ve grown to over 40 different options in my Techozoic theme. It was time to optimize, with the new framework the entries added to the wp_options table went from 40 to 2. I’ll continue below with code examples and explanations. As an added bonus I’ve included an example of how to pull your theme options into a external stylesheet, based off of this concept.

Continue reading

Posted in guides, tech, wordpress | Tagged , , , | 47 Comments

Ubuntu 9.10 Released

ubuntulogo Ubuntu the Linux distro from Canonical has released a new version 9.10. The biggest new features are Firefox 3.5 and access to “Ubuntu One“, online storage space. Every user gets 2GB of free space for backup and sharing. Of course access to thousands of applications and games is available through the software center as well. This release was focused on beautification of the desktop rather than major feature inclusion.

The server edition wasn’t overlooked though, it now includes Ubuntu Enterprise Cloud. Organizations that use Ubuntu Server can now take advantage of cloud computing.

Posted in Linux | Tagged , , , | Comments Off on Ubuntu 9.10 Released