tag:blogger.com,1999:blog-242584862008-05-13T05:58:43.751-07:00Linux NotesThomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-24258486.post-82428355831583239412008-04-10T06:41:00.001-07:002008-04-10T06:45:43.221-07:00units<a href="http://www.gnu.org/software/units/">GNU Units</a><br /><br />With this program you enter in the units that you have and the units that you want to convert to, and the program tells you what to multiply by or divide by to get there.<br /><br />You have: furlongs per fortnight<br />You want: mph<br /> * 0.00037202455<br /> / 2687.9946<br /><br />You have: kilowatt hours<br />You want: calories<br /> * 859845.23<br /> / 1.163e-06Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-48071173594772876592008-04-09T07:14:00.000-07:002008-04-09T07:17:26.117-07:00Gutsy and 100% CPU usage... udevd going nuts.This article seems to have the fix: <br /><a href="http://codepoets.co.uk/upgrade-ubuntu-gutsy-emvs-and-udevd-100-cpu-usage-aka-udevd-going-nuts">Upgrade to Ubuntu Gutsy - emvs and udevd 100% cpu usage - aka udevd going nuts</a><br /><br />One typo I noticed: He refers to /etc/init.d/udevd instead of /etc/init.d/udev.<br /><br />The corrected steps:<br /># apt-get remove evms<br /># /etc/init.d/udev stop<br /># /etc/init.d/udev start<br /><br /><a href="http://librenix.com/?inode=2407">Full set of articles on evms</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-59114451799945448172008-01-10T12:43:00.000-08:002008-01-10T12:45:35.897-08:00DidiWiki 0.5 source codeDidiWiki is a very simple wiki written in C. I've been able to compile it for Cygwin and under Ubuntu.<br /><br /><a href="http://linux-notes.thomaspowell.com/didiwiki-0.5.tar.gz">didiwiki-0.5.tar.gz</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-21096250785298756292007-02-09T13:15:00.000-08:002007-02-09T13:14:27.838-08:00Using Native Data Structures in JNI<a href="http://www.devx.com/Java/Article/21841#codeitemarea">Write Efficient Java Apps Using Native Data Structures with JNI</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-80930772624214156712007-02-09T13:06:00.001-08:002007-02-09T13:10:52.869-08:00Linking a static library to Java using JNI<a href="http://cnd.netbeans.org/docs/jni/beginning-jni-linux.html">Beginning JNI Linux tutorial for Netbeans</a><br /><br />Once I had accomplished the above with complete success, I extended the experiment by linking my static library (.a) to the dynamic library, and calling the static library function from the dynamic library function.<br /><br />My HelloWorldNative.h:<br />/* DO NOT EDIT THIS FILE - it is machine generated */<br />#include <jni.h><br />/* Header for class helloworld_Main */<br /><br />#ifndef _Included_helloworld_Main<br />#define _Included_helloworld_Main<br />#ifdef __cplusplus<br />extern "C" {<br />#endif<br />/*<br />* Class: helloworld_Main<br />* Method: nativePrint<br />* Signature: ()V<br />*/<br />JNIEXPORT void JNICALL Java_helloworld_Main_nativePrint<br /> (JNIEnv *, jobject);<br /><br />/*<br />* Class: helloworld_Main<br />* Method: nativePrintNumber<br />* Signature: (I)V<br />*/<br />JNIEXPORT void JNICALL Java_helloworld_Main_nativePrintNumber<br /> (JNIEnv *, jobject, jint);<br /><br />#ifdef __cplusplus<br />}<br />#endif<br />#endif<br /><br />My HelloWorldNative.c:<br />#include <jni.h><br /><br />#include <stdio.h><br /><br />#include "../HelloWorldNative.h"<br /><br />void hello();<br />void hello_number(int i);<br /><br />JNIEXPORT void JNICALL Java_helloworld_Main_nativePrint(JNIEnv *env, jobject obj)<br />{<br /> hello();<br />}<br /><br />JNIEXPORT void JNICALL Java_helloworld_Main_nativePrintNumber<br /> (JNIEnv *env, jobject obj, jint ji)<br />{<br /> hello_number(ji);<br />}<br /><br />My Main.java:<br />/*<br />* Main.java<br />*<br />* Created on February 9, 2007, 3:48 PM<br />*<br />* To change this template, choose Tools | Template Manager<br />* and open the template in the editor.<br />*/<br /><br />package helloworld;<br /><br />/**<br />*<br />* @author thomas<br />*/<br />public class Main {<br /> <br /> private native void nativePrint();<br /> private native void nativePrintNumber(int i);<br /> /** Creates a new instance of Main */<br /> public Main() {<br /> }<br /> <br /> static {<br /> System.load("/home/thomas/src/c/testlib/HelloWorldNative/dist/HelloWorldNative.so");<br /> }<br /> /**<br /> * @param args the command line arguments<br /> */<br /> public static void main(String[] args) {<br /> Main me = new Main();<br /> me.nativePrint();<br /> me.nativePrintNumber(2);<br /> me.nativePrintNumber(5);<br /> // TODO code application logic here<br /> }<br /> <br />}<br /><br /></stdio.h></jni.h></jni.h>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-60396128488931207682007-02-09T13:06:00.000-08:002007-02-08T08:35:06.117-08:00Linking a static library to Java using JNI<a href="http://cnd.netbeans.org/docs/jni/beginning-jni-linux.html">Beginning JNI Linux tutorial for Netbeans</a><br /><br />Once I had accomplished the above with complete success, I extended the experiment by linking my static library (.a) to the dynamic library, and calling the static library function from the dynamic library function.<br /><br />My HelloWorldNative.h:<br />/* DO NOT EDIT THIS FILE - it is machine generated */<br />#include <jni.h><br />/* Header for class helloworld_Main */<br /><br />#ifndef _Included_helloworld_Main<br />#define _Included_helloworld_Main<br />#ifdef __cplusplus<br />extern "C" {<br />#endif<br />/*<br /> * Class: helloworld_Main<br /> * Method: nativePrint<br /> * Signature: ()V<br /> */<br />JNIEXPORT void JNICALL Java_helloworld_Main_nativePrint<br /> (JNIEnv *, jobject);<br /><br />/*<br /> * Class: helloworld_Main<br /> * Method: nativePrintNumber<br /> * Signature: (I)V<br /> */<br />JNIEXPORT void JNICALL Java_helloworld_Main_nativePrintNumber<br /> (JNIEnv *, jobject, jint);<br /><br />#ifdef __cplusplus<br />}<br />#endif<br />#endif<br /><br />My HelloWorldNative.c:<br />#include <jni.h><br /><br />#include <stdio.h><br /><br />#include "../HelloWorldNative.h"<br /><br />void hello();<br />void hello_number(int i);<br /><br />JNIEXPORT void JNICALL Java_helloworld_Main_nativePrint(JNIEnv *env, jobject obj)<br />{<br /> hello();<br />}<br /><br />JNIEXPORT void JNICALL Java_helloworld_Main_nativePrintNumber<br /> (JNIEnv *env, jobject obj, jint ji)<br />{<br /> hello_number(ji);<br />}<br /><br />My Main.java:<br />/*<br /> * Main.java<br /> *<br /> * Created on February 9, 2007, 3:48 PM<br /> *<br /> * To change this template, choose Tools | Template Manager<br /> * and open the template in the editor.<br /> */<br /><br />package helloworld;<br /><br />/**<br /> *<br /> * @author thomas<br /> */<br />public class Main {<br /> <br /> private native void nativePrint();<br /> private native void nativePrintNumber(int i);<br /> /** Creates a new instance of Main */<br /> public Main() {<br /> }<br /> <br /> static {<br /> System.load("/home/thomas/src/c/testlib/HelloWorldNative/dist/HelloWorldNative.so");<br /> }<br /> /**<br /> * @param args the command line arguments<br /> */<br /> public static void main(String[] args) {<br /> Main me = new Main();<br /> me.nativePrint();<br /> me.nativePrintNumber(2);<br /> me.nativePrintNumber(5);<br /> // TODO code application logic here<br /> }<br /> <br />}Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-35115840367874485102007-02-08T08:26:00.000-08:002007-02-08T08:22:58.215-08:00Link java to a static library.See last post, assume testlib has a void hello(void) function.<br /><br />Step 1: Create a wrapper class.<br /><span style="font-family: courier new;">public class TestLibWrapper {</span><br /><span style="font-family: courier new;"> public static native void hello();</span><br /><br /><span style="font-family: courier new;"> static {</span><br /><span style="font-family: courier new;"> System.loadLibrary("testlib");</span><br /><span style="font-family: courier new;"> }</span><br /><span style="font-family: courier new;">} </span><br /><br />Step 2: Compile wrapper class.<br />javac TestLibWrapper.java<br /><br />Step 3: Run javah to create C header and stub file.<br />javah TestLibWrapper<br /><br />Step 4...Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-56823813715802357052007-02-08T08:09:00.000-08:002007-02-08T08:13:37.592-08:00GNUmakefile for a basic libraryGNUmakefile for a static library, testlib.a, including a single file, hello.c<br /><br /><span style="font-family:courier new;">OBJS = hello.o</span><br /><br /><span style="font-family:courier new;">CFILES := ${OBJS:.o=.c}</span><br /><span style="font-family:courier new;">LDFLAGS =</span><br /><span style="font-family:courier new;">ARFLAGS = rcv</span><br /><br /><span style="font-family:courier new;">all:: testlib.a</span><br /><br /><span style="font-family:courier new;">testlib.a: ${OBJS}</span><br /><span style="font-family:courier new;"> @$(AR) ${ARFLAGS} $@ $?<br /><br />clean::<br /> @$(RM) ${OBJS} testlib.a<br /></span>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-63009117203954811252007-02-04T22:22:00.000-08:002007-02-04T22:48:38.275-08:00More on update-alternativesIt appears that update-alternatives is a very handy facility in Debian derivatives for keeping track of the preferred application for specific tasks. <br /><br />This seems to be a much SAFER than Windows way of handling things (i.e., let the application try to set itself as the default handler--a la IE vs. Firefox, whatever audio player you use, etc...).<br /><br />This also seems to be much cleaner than what I've experienced in the past with Linux--maybe trying to override one browser with another, creating a random soft link, etc...<br /><br />All such alternatives can be seen in the /etc/alternatives directory. On a Kubuntu 6.10 (Edgy Eft) box, one finds among the alternatives java, pager, x-terminal-emulator, x-window-manager, and x-www-browser. Some alternatives are used to point to specific versions of a program.<br /><br />"update-alternatives --display <name>" will display information about which alternative is selected.<br /><br />"update-alternatives --list <name>" will list alternatives.<br /><br />"update-alternatives --config <name>" allows the selection of a specific alternative.<br /><br />The files which control the list of alternatives are in /var/lib/dpkg/alternatives.Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-45604044488661084022007-01-30T11:14:00.000-08:002007-01-30T11:15:48.511-08:00Selecting java alternativesAs root, run the following to see which alternatives are out there, and which one is selected as default:<br /><br /> update-alternatives --display java <br /><br />As root, use the following to select default.<br /><br /> update-alternatives --config javaThomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-69840254240825955982007-01-29T06:06:00.000-08:002007-01-30T18:21:05.753-08:00Research performed trying to get wireless card working on a laptop"bcm4306 linux" search:<br /><a href="dossy.org/archives/000110.html">Dossy's Blog: Linksys WMP54GS with Broadcom chipset under Linux</a><br /><a href="http://www.melbpc.org.au/pcupdate/2407/2407article12.htm">How to Get One 802.11g Wireless Card to Work on Linux</a><br /><br />"wmp54gs driver" search:<br /><a href="http://forums.windrivers.com/archive/index.php/t-67640.html">WinDrivers Computer Tech Support Forums - Linksys WMP54GS Wireless with Linux</a><br /><a href="http://gentoo-wiki.com/HARDWARE_wmp54gs">HARDWARE wmp54gs - Gentoo Linux Wiki</a><br /><br />"'no version of ndiswrapper found'"<br /><a href="http://www.ubuntuforums.org/archive/index.php/t-275123.html">Ndiswrapper Package Broken? [Archive] - Ubuntu Forums</a> Conclusion: use 1.18 version of ndiswrapper in ubuntu.<br /><br />"BCM43xx_IRQ_XMIT_ERROR" search<br /><a href="http://ubuntuforums.org/showthread.php?t=256795">Problems with wlan bcm43xx - Ubuntu forums</a><br /><br />Need to look into Linuxant:<br /><a href="http://www.linuxant.com/driverloader/">Driverloader </a> http://www.linuxant.com/driverloader/<br /><br />1) Move wpa_supplicant binary to /usr/sbin/ and rename to "dldr_wpa_supplicant"<br />2) Move wpa_supplicant.conf to /etc/driverloader/ and rename to dldr_wpa_supplicant.<interface>.conf, where interface is your interface name (mine was eth1)<br />3) Reboot<br /><br />Tried adding pci=routeirq to boot parameters in /boot/grub/menu.lstThomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-57175331282902247322007-01-22T13:23:00.000-08:002007-01-22T13:33:07.091-08:00I never learned this in school.Actually, I haven't had to format a Linux partition manually since (maybe) I experimented with Slackware in 1995. So, when I had a nice little 400 GB USB HD with three partitions (two NTFS, one Linux), I was somewhat at a loss as to how to proceed.<br /><br />I found <a href="http://www.idevelopment.info/data/Unix/Linux/LINUX_PartitioningandFormattingSecondHardDrive_ext3.shtml">this handy guide to partitioning and formatting mkfs.ext3</a>.<br /><br />Ahhh... I have access now.Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-68519837237364809132007-01-16T13:24:00.000-08:002007-01-16T13:32:41.717-08:00Quick ascii table in hex.The <a href="http://www.troubleshooters.com/linux/quickhacks.htm">Linux Quick Hacks</a> page inspired on this one:<br /><br /><span style="font-family:courier new;font-size:85%;">perl -e 'foreach $x (32..126) { printf(":: %c %x ::", $x, $x) } print "\n"'</span><br /><br />Output:<br /><span style="font-family:courier new;font-size:85%;">:: 20 :::: ! 21 :::: " 22 :::: # 23 :::: $ 24 :::: % 25 :::: & 26 :::: ' 27 ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: ( 28 :::: ) 29 :::: * 2a :::: + 2b :::: , 2c :::: - 2d :::: . 2e :::: / 2f ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: 0 30 :::: 1 31 :::: 2 32 :::: 3 33 :::: 4 34 :::: 5 35 :::: 6 36 :::: 7 37 ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: 8 38 :::: 9 39 :::: : 3a :::: ; 3b :::: < 3c :::: = 3d :::: > 3e :::: ? 3f ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: @ 40 :::: A 41 :::: B 42 :::: C 43 :::: D 44 :::: E 45 :::: F 46 :::: G 47 ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: H 48 :::: I 49 :::: J 4a :::: K 4b :::: L 4c :::: M 4d :::: N 4e :::: O 4f ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: P 50 :::: Q 51 :::: R 52 :::: S 53 :::: T 54 :::: U 55 :::: V 56 :::: W 57 ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: X 58 :::: Y 59 :::: Z 5a :::: [ 5b :::: \ 5c :::: ] 5d :::: ^ 5e :::: _ 5f ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: ` 60 :::: a 61 :::: b 62 :::: c 63 :::: d 64 :::: e 65 :::: f 66 :::: g 67 ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: h 68 :::: i 69 :::: j 6a :::: k 6b :::: l 6c :::: m 6d :::: n 6e :::: o 6f ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: p 70 :::: q 71 :::: r 72 :::: s 73 :::: t 74 :::: u 75 :::: v 76 :::: w 77 ::</span><span style="font-size:85%;"><br /></span><span style="font-family:courier new;font-size:85%;">:: x 78 :::: y 79 :::: z 7a :::: { 7b :::: | 7c :::: } 7d :::: ~ 7e ::</span>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-54820943359152531202007-01-13T15:55:00.000-08:002007-01-14T11:49:06.067-08:00sed guides.I'm using sed (along with awk and shell scripts) to extract data from my website files. <br /><br /><a href="http://www.student.northpark.edu/pemente/sed/sedfaq.html">Frequently Asked Questions about sed, the stream editor</a><br /><br /><a href="http://www.student.northpark.edu/pemente/sed/sed1line.txt">sed one-liners</a><br /><br /><a href="http://sed.sourceforge.net/local/scripts/list_urls.sed.html">Colorized list_urls.sed</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-47063295777518102942007-01-10T10:17:00.000-08:002007-01-10T18:16:44.679-08:00sed/sh/awk removing a section in multiple filesAll of my scripts are in ~/bin, I'm replacing a marked section with my google adsense code, contained in a separate file.<br /><br /><span style="font-weight: bold;">remove_topstart.sh:</span><br /><span style="font-family:courier new;">#!/bin/sh</span><br /><span style="font-family:courier new;">find . -name '*.html' | while read x</span><br /><span style="font-family:courier new;">do</span><br /><span style="font-family:courier new;"> cat $x | awk -f ~/bin/remove_topstart.awk >> $x.$$</span><br /><span style="font-family:courier new;"> cp $x.$ $x</span><br /><span style="font-family:courier new;"> rm $x.$</span><br /><span style="font-family:courier new;">done</span><br /><br /><br /><span style="font-weight: bold;">remove_topstart.awk:</span><br /><span style="font-family:courier new;">BEGIN { outsideTop = 1 }</span><br /><span style="font-family:courier new;">/<!--TOPSTART-->/ { outsideTop = 0 }</span><br /><span style="font-family:courier new;">/<!--TOPEND-->/ { outsideTop = 1 }</span><br /><span style="font-family:courier new;">outsideTop {</span><br /><span style="font-family:courier new;"> if( $0 !~ "<!--TOPEND-->" )</span><br /><span style="font-family:courier new;"> {</span><br /><span style="font-family:courier new;"> print $0</span><br /><span style="font-family:courier new;"> }</span><br /><span style="font-family:courier new;">}</span><br /><br /><span style="font-weight: bold;">insert_adsense.sh:<br /></span><span style="font-family:courier new;">#!/bin/sh</span><span style="font-weight: bold;font-family:courier new;" ><br /></span><span style="font-family:courier new;">#my.adsense.txt contains as its first line and as</span><br /><span style="font-family:courier new;">#its last line.</span><br /><br /><br /><span style="font-family:courier new;">#insert after tag, regardless of case.</span><br /><span style="font-family:courier new;">#change index.html in current directory</span><br /><span style="font-family:courier new;">cat index.html | sed '/<[Bb][Oo][Dd][Yy]>/r /home/thomas/my.adsense.txt' > index.html.$$</span><br /><span style="font-family:courier new;">cp index.html.$ index.html</span><br /><span style="font-family:courier new;">rm index.html.$</span><br /><br /><span style="font-family:courier new;">#change all *.html files in selected subdirectories</span><br /><span style="font-family:courier new;">find . -name '*.html' | egrep "SubDir1|SubDir2|SubDir3|SubDir4|SubDir5" | while read x</span><br /><span style="font-family:courier new;">do</span><br /><span style="font-family:courier new;"> cat $x | sed '/<[Bb][Oo][Dd][Yy]>/r /home/thomas/my.adsense.txt' > $x.$$</span><br /><span style="font-family:courier new;"> cp $x.$$ $x</span><br /><span style="font-family:courier new;"> rm $x.$$</span><br /><span style="font-family:courier new;">done</span><fixed><br /></fixed>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-14448931457216071402007-01-09T07:26:00.000-08:002007-01-09T07:36:43.195-08:00IE 4 LinuxInternet Explorer on Linux<br />http://webexpose.org/2007/01/07/internet-explorer-7-on-linux/<br /><br />http://www.tatanka.com.br/ies4linux/page/Installation<br /><span style="font-size:85%;">IEs 4 Linux needs two packages: <a href="http://www.kyz.uklinux.net/cabextract.php" class="external text" title="http://www.kyz.uklinux.net/cabextract.php" rel="nofollow">cabextract</a> and <a href="http://www.winehq.org/" class="external text" title="http://www.winehq.org" rel="nofollow">Wine</a>. You can install them using your Linux package manager (synaptic, apt-get, yum, emerge etc) or go to their sites.</span><br /><pre>wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz<br />tar zxvf ies4linux-latest.tar.gz<br />cd ies4linux-*<br />./ies4linux<br /></pre>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-70505060824629239932007-01-08T21:40:00.000-08:002007-01-08T21:48:55.732-08:00Research on adding a wireless card using WPA in UbuntuI've just begun to research WPA + PCI wireless card in Ubuntu.<br /><br />Follow installation instructions for ndiswrapper:<br /><a href="http://ndiswrapper.sourceforge.net/mediawiki/index.php/Installation">http://ndiswrapper.sourceforge.net/mediawiki/index.php/Installation</a><br /><br />Using a ZyXEL card:<br /><a href="http://ndiswrapper.sourceforge.net/mediawiki/index.php/List#Z">http://ndiswrapper.sourceforge.net/mediawiki/index.php/List#Z</a><br /><br />Tools to use:<br /><ul><li>iwconfig - to configure wireless network interface.</li><li>iwlist wlan0 scan - scan for access points using wlan0 interface</li></ul>WPA with ndiswrapper:<br /><a href="http://ndiswrapper.sourceforge.net/mediawiki/index.php/WPA">http://ndiswrapper.sourceforge.net/mediawiki/index.php/WPA</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-58338467355425925622006-12-29T13:22:00.000-08:002006-12-31T20:11:21.111-08:00Log of setting up a "test" virtual server on apache2 under Linux.Equipment HP Pavilion 6745C/700 MHz Celeron/256MB ram. I'm using <span style="font-weight: bold;">gvim </span>as an editor. <span style="font-weight: bold;"><br /><br />Step 1, Add host to /etc/hosts:</span><br />sudo gvim /etc/hosts<br />Before the IPv6 section (if you have one), add:<br /><blockquote></blockquote><span style="font-family:courier new;">127.0.0.1 latte</span><br /><blockquote></blockquote>In this case "latte" is my virtual hostname.<br /><br /><span style="font-weight: bold;">Step 2, Add a new configuration file for the virtual host:</span><br /><span style="font-family:courier new;">cd /etc/apache2/sites-available</span><br /><span style="font-family:courier new;">cp default latte.conf</span><br />The naming of the configuration file is somewhat arbitrary, but I used {hostname description}.conf.<br /><br /><span style="font-weight: bold;">Step 3, Edit the configuration file:</span><br /><span style="font-family:courier new;">sudo gvim latte.conf</span><br /><br />Change the following lines and save your configuration file:<br /><span style="font-family:courier new;">NameVirtualHost *<br /><br />DocumentRoot /var/www<br /><virtualhost></virtualhost></span><br />to the following:<br /><span style="font-family:courier new;">NameVirtualHost latte<br /><virtualhost><br />DocumentRoot /var/www/latte<br /></virtualhost></span><br />Your original "DocumentRoot" may be different, but the new value should be the root directory for website files.<br /><br /><span style="font-weight: bold;">Step 4, Link to the configuration file in the "sites-enabled" directory:<br /></span><span style="font-family:courier new;">cd /etc/apache2/sites-enabled/</span><br /><span style="font-family:courier new;">sudo ln -s /etc/apache2/sites-available/latte.conf latte.conf</span><br /><br />or in Debian (and by derivation, Ubuntu):<br /><span style="font-family:courier new;">a2ensite latte.conf</span><br /><br /><span style="font-weight: bold;">Step 5, Reload the apache configuration file:<br /></span><span style="font-family:courier new;">sudo /etc/init.d/apache2 reload<br /><br /></span><span style="font-weight: bold;">Step 6, Browse to your virtual server to check your work:</span><br /><span style="font-family:courier new;">firefox http://latte</span>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-1167272414530664002006-12-27T18:06:00.000-08:002006-12-27T18:48:53.793-08:00Manually adding a PCI display card.Equipment/Software:<br /><ul><br /><li>HP Pavilion 6745C</li><br /><li>256 MB ram</li><br /><li>Kubuntu 6.10 (Edgy Eft)</li><br /><li>eVGA (nVidia) GeForce4 MX 4000 PCI</li><br /></ul><br /><br />I've had persistent problems with the i810 on-board vga with virtually every install of Linux that I've tried with this PC (with the exception of damnsmalllinux). Between that and its poor performance, I added a MX 4000 to this PC. However, recent distributions have failed to even properly recognize the card at install/configuration time, so I had to take some indirect steps to add the device.<br /><br /><b>Step 1:</b><br />Install Kubuntu using i810. This required setting bios to use the "AGP" video card (in this case AGP=onboard video). I had the MX 4000 PCI card installed for this as well, but not hooked to a monitor.<br /><br /><b>Step 2:</b><br />Run "lspci" at a shell prompt. At the end of my listing was:<br /><blockquote>01:0d.0 VGA compatible controller: nVidia Corporation NV18 [GeForce4 MX 4000 AGP 8x] (rev c1)</blockquote><br /><br /><b>Step 3:</b><br />At a shell prompt, run "sudo vim /etc/X11/xorg.conf" (substitute your favorite editor for vim). I copied and pasted the following section:<br /><blockquote><br />Section "Device"<br /> Identifier "Intel Corporation 82810 ..."<br /> Driver "i810"<br /> BusID "PCI:0:1:0"<br />EndSection<br /></blockquote><br />I modified my new section to read:<br /><blockquote><br />Section "Device"<br /> Identifier "NVidia"<br /> Driver "nv"<br /> BusID "PCI:1:13:0"<br />EndSection<br /></blockquote><br />The "Identifier" value must be copied in a later section, so the value doesn't matter as much as the consistency of that value. The 1:13:0 is from the lspci output (01:0d.0, where 0d in hex = 13 in decimal). "nv" is the free nVidia compatible driver. I may later apply the proper nVidia driver (instructions in a previous post).<br /><br /><b>Step 4:</b><br />Still in xorg.conf, I modified the "Screen" section (Section "Screen") by replacing "Intel Corporation 82810..." with "NVidia" on the Device line.<br /><blockquote><br />Section "Screen"<br /> Identifier "Default Screen"<br /> Device "Nvidia"<br /></blockquote><br /><br /><b>Step 5:</b><br />Save xorg.conf and restart X (Ctrl-Alt-Bksp on an X screen). X will now start on the nVidia card.<br /><br /><b>Step 6:</b><br />Reboot, switch bios to use "PCI" as the primary display. Save BIOS.<br /><br /><b>Step 7:</b><br />Plug monitor into nVidia card, and boot with new BIOS settings.<br /><br /><b>TODO: <br />- Get both devices working on this PC as two separate displays.<br />- Install "proper" nVidia drivers.<br /></b>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-1167184953393993552006-12-26T17:57:00.000-08:002006-12-26T18:02:33.393-08:00Discovered bluetooth keyboard and mouse was not working.More fallout from upgrading to Edgy Eft, my bluetooth keyboard and mouse no longer worked. This post on ubuntu forums was the best consolidated set of instructions on how to configure bluetooth (which worked without configuration before upgrade, by the way).<br /><br />I ended using "/etc/init.d/bluetooth restart" instead of "/etc/init.d/bluez-utils restart". However, I've only been able to restore the connection to my mouse, not my keyboard.<br /><br /><a href="http://ubuntuforums.org/showthread.php?t=227057">HOWTO: Bluetooth Keyboard and Mouse</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-1167149324677007242006-12-26T08:05:00.000-08:002006-12-26T11:02:55.720-08:00Installing Beryl and Xgl<a href="http://ubuntuexperiences.wordpress.com/2006/12/05/installing-beryl-and-xgl/">Ubuntu experiences entry.</a><br /><a href="http://www.smorgasbord.net/ati_beryl_kde_dapper_my_guide">ATI/Beryl/KDE/Dapper/My Guide</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-1167148558816167942006-12-26T07:53:00.000-08:002006-12-27T19:25:11.446-08:00Needed to reinstall nvidia driver on Edgy Eft.Did a distro upgrade on Kubuntu to 6.10. Everything was working nicely--firefox 2.0, etc... but I hadn't rebooted yet. My linux box isn't a critical system at work, it's subjected to the whims of the neighborhood power grid. Thus, it had to be turned on after the long weekend. This morning, I discovered that I needed to reinstall the nvidia drivers. The post linked to below contains the details, but if you had the nvidia splash screen prior to 6.10, the line below is probably all you need:<br /><br />sudo aptitude install linux-generic linux-restricted-modules-`uname -r`<br /><br /><a href="http://ubuntuforums.org/showthread.php?t=281823&page=7">Install the Nvidia driver on Edgy Eft</a><br /><br />In case there are module difference issues, different display driver versions are available from nVidia <a href="http://www.nvidia.com/object/linux_display_archive.html">here</a>.Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-1166717565677167542006-12-21T07:30:00.000-08:002006-12-21T08:15:20.873-08:00select() system call in Linux vs. other *nix flavorsFrom the Linux Programmer's Manual:<br />"On Linux, the function <span style="font-weight:bold;">select</span> modifies <span style="font-style:italic;">timeout</span> to reflect the amount of time not slept; most other implementations do not do this. This causes problem both when Linux code which reads <span style="font-style:italic;">timeout</span> is ported to other operating systems, and when code is ported to Linux that reuses a struct timeval for multiple <span style="font-weight:bold;">select</span>s in a loop without reinitializing it. Consider <span style="font-style:italic;">timeout</span> to be undefined after <span style="font-weight:bold;">select</span> returns."Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-1166640429674033082006-12-20T10:46:00.000-08:002006-12-20T11:11:30.170-08:00Upgrading Ubuntu<a href="http://www.debianadmin.com/upgrade-ubuntu-606-dapper-drake-to-ubuntu-10-edgy-eft.html">Upgrading Ubuntu from 6.06 Dapper Drake to 6.10 Edgy Eft</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.comtag:blogger.com,1999:blog-24258486.post-1166546610961767492006-12-19T08:42:00.000-08:002006-12-19T08:51:25.936-08:00Apache2 setup / Virtual Hosts<a href="http://www.debuntu.org/2006/02/22/7-virtual-hosting-using-apache-2">Virtual Hosting using Apache 2 on a linux machine</a><br /><br /><a href="http://linuxgazette.net/issue86/tag/2.html">NameVirtualHost in Apache</a>Thomashttp://www.blogger.com/profile/08347962976730903449noreply@blogger.com