Archive for the ‘Operating Systems’ Category

How to (always) get your server’s IP address

Tuesday, August 25th, 2009

Here is how to (always) get your server's a IP address. Works on Unix/Linux.

<?php
if (empty($_SERVER['SERVER_ADDR'])) {
$server_host = `hostname -f`;
$server_ip = `host $server_host`;

if (preg_match('#(\d+\.\d+\.\d+\.\d+)#', $server_ip, $matches)) {
$server_ip = $matches[1];
} else {
$server_ip = '127.0.0.1';
}
} else {
$server_ip = $_SERVER['SERVER_ADDR'];
}

echo $server_ip;
?>

VirtualBox addons cannot be installed

Wednesday, April 22nd, 2009

Have you seen this error message:

root@ubuntu:/media/cdrom# ./VBoxLinuxAdditions-x86.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 2.1.4 Guest Additions for Linux installation...........................................................................................................................................................................................................
VirtualBox 2.1.4 Guest Additions installation
Please install the build and header files for your current Linux kernel.
The current kernel version is 2.6.27-11-server
Problems were found which would prevent the Guest Additions from installing.
Please correct these problems and try again.

Solution:

sudo aptitude install build-essential linux-headers-`uname -r`

or

sudo aptitude update && aptitude dist-upgrade && aptitude install linux-headers-`uname -r`

Related

How to export svn editor

Wednesday, April 22nd, 2009

Have you seen this message lately ?

csvn: Commit failed (details follow):
svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR is set, and no 'editor-cmd' run-time configuration option was found

Here is how to export SVN_EDITOR variable.

Feel free to change the editor to pico, nano etc.

echo export SVN_EDITOR=vi >> ~/.bash_profile

Logout and then Login again to *see* the change.
By *see* I mean that you have to do execute the following command and the editor of your choice should be run for you:

svn ci

Related:

Solution to Mail disappear in Mac OS X (Mail.app) (Overstuffed mailbox problem)

Tuesday, March 17th, 2009

It seems if you have too many files in your Mail.app message could disappear (visually)

Apple has calls it "Overstuffed mailbox is unexpectedly empty"

Reason:
---
How large does the mailbox have to be for this to happen? With Mac OS X 10.4 or later, 2.0 GB or larger. With Mac OS X 10.
3 through 10.3.9, there's not a specific size where this will always occur--the mailbox could be anywhere from a few hundr
ed megabytes (MB) to over a gigabyte (GB) large. However, the bigger your mailbox (or combination of mailboxes) is, the mo
re likely it is this could occur.

---

Apple suggest these steps:

* Update to the latest version of Mac OS X 10.3 or 10.4. Even if this works, check out "How can I prevent it from happ
ening again?" below.
* From the Mailbox menu, choose Rebuild.
* Quit Mail and open it again. If Mail had been open a while, this might help. Even if this works, check out "How can
I prevent it from happening again?" below.
* If you use more than one account, for example "Account 1" and "Account 2", instead of clicking on the "In" mailbox,
click on either "Account 1" or "Account 2" that appear beneath "In" (as well as beneath Sent and Trash, for example). That
way you'll only see messages related to that specific account. If your two account mailboxes are big individually, but no
t big enough to cause this issue, when viewed together (by just clicking "In" for example), the issue may occur.

Related: