Archive for the ‘HowTo’ Category

Eliminating crackling/distorted noise on Intel Mac computers running Ubuntu/Linux

on Saturday 17th May, 2008 Gabe speculated thusly…

I have a first generation macbook coreduo.

The latest version of Ubuntu (Hardy Heron 8.04 LTS) works very well on it with minimal configuration. However, several issues remain. One of which is the poor sound quality. Initially, installing linux-backports-modules did the trick, however after several reboots it became clear that it didn’t always work. I came across this post, which I followed and the results were outstanding. I have completely copied it here, only to make sure there is another copy of this important document. Full credit for this one goes to the original author. Anyway, here’s what you need to do:

Edit the file /etc/modprobe.d/options
$ sudo vim /etc/modprobe.d/options

And add the following to the end of the file:
options snd-hda-intel model=[MODEL_BELOW] position_fix=2 probe_mask=1

Run the following command:
$ sudo update-initramfs -u

Then reboot.

You must select the Intel HDA model that corresponds to your computer:

These are the codes you can use in the above instructions:
intel-mac-v1 : Intel Mac Type 1
intel-mac-v2 : Intel Mac Type 2
intel-mac-v3 : Intel Mac Type 3
intel-mac-v4 : Intel Mac Type 4
intel-mac-v5 : Intel Mac Type 5
macmini : Intel Mac Mini (equivalent with type 3)
macbook : Intel Mac Book (eq. type 5)
macbook-pro-v1 : Intel Mac Book Pro 1st generation (eq. type 3)
macbook-pro : Intel Mac Book Pro 2nd generation (eq. type 3)
imac-intel : Intel iMac (eq. type 2)
imac-intel-20 : Intel iMac (newer version) (eq. type 3)

For example, I have a Macbook 1st generation, and the only setting that worked was
model=intel-mac-v1. All others just gave me no sound at all, including the apparently
obvious macbook and the documented-as-equivalent macmini ones.

If nothing works, you can revert this by deleting the line and performing the rest of the steps.

For BEST sound, if the above works, open a terminal and type:
$ alsamixer

And set the front and surround sliders to their maximum.
It might be necessary to unmute them with the ‘M’ key.
Press ESC twice to leave the program.

Posted in HowTo, Information, Linux, Operating System, Ubuntu

No Comments »

Installing Netatalk AFP with SSL (encrypted authentication) on Ubuntu Hardy Heron 8.04 LTS Server

on Monday 12th May, 2008 Gabe speculated thusly…

Installing Netatalk from the repositories means that when you connect using a Mac client you will be warned that you are going to send your password in the clear. Obviously this isn’t great for security, and being prompted every time you want to connect is annoying. This occurs because Netatalk in the Ubuntu repositories is compiled without SSL support (SSL is what handles the encryption).

The key to getting this to work is to get the Netatalk source code and compile it yourself. Don’t worry, it’s been done hundreds of times before and if you follow this tutorial closely you should be fine.

The commands written always start with a dollar sign ($), you should not type this, it just indicates the commands should be typed at a standard user prompt in the terminal.

First off it’s a good idea to switch to your home directory:
$ cd ~

Make a new directory to hold the hundreds of small Netatalk files:
$ mkdir netatalk

Ensure you have essential development libraries and tools installed:
$ sudo aptitude install libdb4.2-dev libslp-dev autotools-dev devscripts cracklib2-dev dpkg-dev libssl-dev

Change in to the newly created directory:
$ cd netatalk

Install the netatalk source code:
$ sudo apt-get source netatalk

Install all required dependencies for netatalk:
$ sudo apt-get build-dep netatalk

A new directory called netatalk-2.0.3 should have been created, change in to that directory:
$ cd netatalk-2.0.3

Compile Netatalk with the SSL option:
$ DEB_BUILD_OPTIONS=ssl sudo dpkg-buildpackage -us -uc

Install the finished product!:
$ sudo debi

Posted in HowTo, Information, Linux, Operating System, Server, Ubuntu

3 Comments »

Profiling in CodeIgniter

on Tuesday 6th May, 2008 Gabe speculated thusly…

Profiling an application is a great way to see how it is performing. CodeIgniter comes with a profiling class, which you can make calls to from your controllers. However, during development I find profiling so helpful that I want it on all my pages, without having to specifically call it each time. I also want to be able to deploy my development site to a production server - making calls to the profiler throughout the controllers means I would need to edit each and every controller to make sure the profiler wasn’t active on the live server.

After much searching I discovered a better solution. This allows you to add profiling to the bottom of every page (along with its debug info and SQL query info). When you copy the dev site live you just exclude 1 file, and profiling will be removed totally. All you need to do is create a file called MY_Output.php in system/application/libraries that extends the Output core class, with the following contents:

< ?php
# /system/application/libraries/MY_Output.php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class MY_Output extends CI_Output {
function __construct() {
parent::__construct();
$this->enable_profiler( TRUE );
}
}
?>

This will enable profiling output on all your pages for development and debug purposes. When you copy your site to a production server just make sure you don’t copy MY_Output.php file. I normally use rsync for copying live and just add: --exclude="MY_Output.php" to the rsync command.

The condition to using the name MY_Output.php is that you left the variable $config['subclass_prefix'] in config.php as default. This defaults to $config['subclass_prefix'] = ‘MY_’;, so if you change it you will need to alter the filename of your new class.

Posted in CodeIgniter, Development, Frameworks, HowTo, PHP, Programming

No Comments »

Clear the DNS cache in OS X Leopard

on Tuesday 18th March, 2008 Gabe speculated thusly…

dscacheutil -flushcache

Posted in HowTo, Information, Leopard, OS X

No Comments »

Prevent Thunderbird from corrupting IMAP attachments

on Thursday 13th March, 2008 Gabe speculated thusly…

In the “about:config” section of Thunderbird (Tools > Options > Advanced > Config Editor) look for the “mail.imap.fetch_by_chunks” and ” mail.server.default.fetch_by_chunks” values and set them to “False”.

Mozillazine gives some more information about what this value actually does here

Posted in HowTo, Information

No Comments »

Resize all images in current directory using ImageMagick

on Tuesday 11th March, 2008 Gabe speculated thusly…

find . -iname "*.jpg" -print0|xargs -0 -I {} convert -quality 60 -resize 461x317 {} {}

Posted in HowTo, Information

No Comments »

Rails Production Environment Using Mongrel Cluster, Apache 2.2 mod_proxy, and Capistrano on Ubuntu Gutsy

on Wednesday 13th February, 2008 Gabe speculated thusly…

Recently, I had to setup a production environment for Rails applications at work. I encountered many difficulties, including problems with permissions on client/server computers, and not least because the documentation I had was out of date (Agile web dev and The Rails Way). Online tutorials were helpful but incomplete. I have compiled all that I discovered here. (more…)

Posted in Development, HowTo, Linux, Operating System, Programming, Ruby, Server

4 Comments »

Installing MySQL native extensions on OS X using existing MacPorts MySQL

on Saturday 8th December, 2007 Gabe speculated thusly…

Getting these native extensions from Ruby gems to build and install has been a bit of a nightmare. Especially since MySQL, Apache, Ruby, etc were compiled from source using MacPorts (which I heartily recommend).

The answer was as simple as:
sudo gem install mysql -- --with-mysql-config=/path/to/your/mysql/bin/mysql_config

Posted in HowTo, Information, OS X, Operating System, Tiger

No Comments »

Apache 2 with SSL on FreeBSD 6

on Monday 15th October, 2007 Gabe speculated thusly…

It wasn’t exactly trivial installing and configuring Apache 2 on FreeBSD. Much of the configuration had to be done manually, which depending on your point-of-view is good or bad. This describes how I went about getting Apache 2 with SSL support up and running on FreeBSD 6. I did this on 6.2 but it should equally apply to  6.x. (more…)

Posted in FreeBSD, HowTo, Server

No Comments »

Introduction to DNS

on Sunday 30th September, 2007 Gabe speculated thusly…

If you are a beginner with DNS then you might find this quick article useful. Recently I have had to play with various DNS records to get mail servers and web servers working. (more…)

Posted in HowTo, Server

No Comments »