Need to remove all those ^M characters from a DOS file?

Need to remove all those ^M characters from a DOS file? Try

tr -d \\r < dosfile > newfile

[jQuery] weird error in globalEval

If I change the first line to
var head = document.documentElement,
it all works fine.In IE (but not in firefox) i suddenly got a ‘fatal’ error in globalEval; wrong argument passed in the last line, that says head.removeChild (script)..

In order to get things working again, i’ve had to make a small workaround:

globalEval: function( data ) {

data = jQuery.trim( data );if ( data ) {

// Inspired by code by Andrea Giammarchi

// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html

var head = document.getElementsByTagName("head")[0] || document.documentElement,

script = document.createElement("script");

script.type = "text/javascript";

if ( jQuery.browser.msie )

script.text = data;

else

script.appendChild( document.createTextNode( data ) );

head.appendChild( script );

try {

head.removeChild( script );

}

catch (e) {

}

}

},

If I change the first line to “var head = document.documentElement” it all works fine too

BSD Tips, Tricks,Docs and FAQ’s

*BSD are OpenSource implementations of the complete UNIX-compatible operating system. Their most popular derivates, FreeBSD, OpenBSD and NetBSD contain everything you need for a running system, including kernel, C libraries, commandline tools, installation program and a superb system to integrate and update third-party applications.
Although these days Linux is in every mouth, I found BSD OS’es to be more stable, secure and especially faster and less bloated than typical Linux distributions (while optionally offering binary Linux compatibility!). Guess this is why BSD systems are still the most popular OS’ses of hosting services, making webservers fast and secure by default.

With this page, I’d like to share my favorite BSD link collection with you, hoping it will ease your first steps with the BSD of your choice.

Кодировка внешнего файла скрипта

Кажется, не все в курсе. Чтобы генерируемый JavaScript-сценарием текст в кодировке, отличной от кодировки страницы, куда этот текст выводится, отображался корректно (это актуально, например, для Google Maps), достаточно добавить к соответствующему элементу script атрибут charset, явно указывающий на кодировку JS-файла:
<script … charset=”utf-8″></script>

Перенос FreeBSD с одного HDD на другой

Написано по мотивам статей:
http://www.freebsd.org.ru/how-to/w2w.html
http://sysadmin.su/index.php?option=com_content&task=view&id=33
http://www.opennet.ru/base/sys/movingfbsd.txt.html

Подключаем 2 HDD, включаем комп, смотрим как определился (например: ad2).
Создаем директории /mnt/root, /mnt/var, /mnt/usr, /mnt/tmp.
Запускаем /stand/sysinstall, в ней выбираем configure -> fdisk, ad2.
Создаем freebsd slice на всем винте нажав “A”, нажимаем “S” (set bootable), нажимаем “W” (write changes). “Q” выходим из fdisk, задастся вопрос надо ли создать Master Boot Record. Выбираем Standart Install standart MBR и YES.
После этого перезагружаемся. - ВАЖНО!!!
Запускаем /stand/sysinstall -> Label, выбираем ad2, создаем partitions.
Если вручную, то “С”.
Например:
винт 80Gb
“С” -> 512M ->FS ->/
“С” -> 512M ->SWAP
“С” -> 30000M ->FS ->/var
“С” -> 10000M ->FS ->/tmp
“С” -> 35292M ->FS ->/usr

После этого меняем точки монтирования
/ -> /mnt/root
/var -> /mnt/var
/tmp -> /mnt/tmp
/usr -> /mnt/usr
Переходим на самую верхнюю строчку (Disk: ad2 Parition name: ad2s1 Free:0 blocks(0MB)). - ВАЖНО!!!
Нажимаем “W” для записи изменений и “Q” для выхода.
Потом копируем разделы по root
cd /; pax -p eme -X -rw . /mnt/root
cd /var; pax -p eme -X -rw . /mnt/var
cd /tmp; pax -p eme -X -rw . /mnt/tmp
cd /usr; pax -p eme -X -rw . /mnt/usr

Для справки:
Информация о партишнах /etc/fstab, об устройствах /dev/*
Создать устройство cd /dev; sh ./MAKEDEV ad0s1g