Archive for the ‘Linux’ Category

.vimrc options to assist with perl coding

Sunday, January 16th, 2005

Edit the .vimrc file and add the following:





” F2 close current window (commonly used with my F1/F3 functions)

noremap :close

” perl -cw buffer, using a temp file, into a new window

function! PerlCW()

let l:tmpfile1 = tempname()

let l:tmpfile2 = tempname()

execute “normal:w!” . l:tmpfile1 . “\

execute “normal:! perl -cw “.l:tmpfile1.” \> “.l:tmpfile2.” 2\>\&1

+ \

execute “normal:new\

execute “normal:edit ” . l:tmpfile2 . “\

endfunction

” perl buffer, using a temp file, into a new window

function! PerlOutput()

let l:tmpfile1 = tempname()

let l:tmpfile2 = tempname()

execute “normal:w!” . l:tmpfile1 . “\

execute “normal:! perl “.l:tmpfile1.” \> “.l:tmpfile2.” 2\>\&1 \
+R>”

execute “normal:new\

execute “normal:edit ” . l:tmpfile2 . “\

endfunction

” Settings for editing perl source (plus bind the above two functions)

function! MyPerlSettings()

if !did_filetype()

set filetype=perl

endif

set textwidth=78

set expandtab

set tabstop=4

set shiftwidth=4

set cindent

set comments=:#

set formatoptions=croql

set keywordprg=man\ -S\ 3

noremap :call PerlCW()

noremap :call PerlOutput()

endfunction

if has(”eval”)

augroup SetEditOpts

au!

autocmd FileType perl :call MyPerlSettings()

augroup END

endif

endif

VIM option file

Sunday, January 16th, 2005

Setting VIM options:

http://babbage.cs.qc.edu/courses/cs701/Handouts/using_vim.html



The installation program normally puts a file named .vimrc in your home directory. On Windows, the file will be named _vimrc, and will be in the directory where Vim was installed. For example, when I installed version 6.1, it was placed in D:\Utils\Vim\vim61, and the _vimrc file was put in D:\Utils\Vim. Also, the Windows environment variable, VIM, was set to D:\Utils\Vim.

The standard .vimrc file supplied with the Vim distribution is not quite correct for use in this course. You need to set the tab width to something small, you must set the option to replace tabs with spaces, and you need to tell vim to wrap lines longer than 72 characters.

I also have some keyboard shortcuts that I like to use, mostly so I can enter certain commands while I am in insert mode. Here are links to two .vimrc files, one for Windows and one for Unix that you may use as a model for your own. Feel free to modify them as you wish, but be sure not to change the expandtab and tw options!

Other example .vimrc files:

http://tabo.aurealsys.com/code/vimrc.html

Excellent page for explanation of some .vimrc options

http://www.stripey.com/vim/

Turn that irritating beep off: set visualbell


Debian - Disabling system beep

Sunday, January 9th, 2005

Just installed Debian woody on a P133/16Mb/4gb (actual memory 14Mb, -2Mb for display I guess).



Disable the beep sound of the pc speaker.

Add the following line to ~/.inputrc:

set bell-style none



If the file does not exist, create it.

If the above does not work, add this to the file:

set show-all-if-ambiguous on

Also, I did see here that the inputrc file can be put in /etc. No idea if that works or is relevant.

Will give it a try sometime.


Mandrake Powerpack 10.0 on Dell Inspiron 4150

Thursday, October 28th, 2004

Installed Mandrake PowerPack 10.0 on Dell Inspiron 4150.

Specs are <>

Performed an “everything” install.

Allowed it to autopartition.

Filesystem Type Size Used Avail Use% Mounted on

/dev/ide/host0/bus0/target0/lun0/part1 ext3 5.8G 3.5G 2.1G 64% /

/dev/ide/host0/bus0/target0/lun0/part6 ext3 31G 38M 31G 1% /home

The NIC - 3Com - was detected.

ATI Display card - with 1600 x 1200 - resolution worked fine.

GNOME worked fine !! which hadn’t worked under Slackware 10.0

Slackware used Gnome 2.4 - which was I guess the latest.

I installed Slack on 3 different machines and 2 different options - normal and expert, but still Gnome would not work. It would load the desktop but no background, Terminal would come up, but not Nautilus.

Wireless Card - Hotplug worked. Network config through the wizard worked fine.

Had to change the SSID for the WLAN.

Driver: Orinoco_cs

USB Mouse as well as the PS/2 touchpad both worked together and alone.

Battery Monitor - in Gnome - worked fine.

Shutting the lid, would put the system in standby and bring it back up without any problems.

Windowmaker, XFCE, all worked fine.

I had not installed KDE, so no idea about KDE.

Menus in MDK 10.0 are much much better than what I had seen in 9.2.

Much better organized, fewer options in each category.

Sound - worked out of the box - ALSA

(Donno the sound card, think it is AC’97)

Pleasant Surprise - Audacity was installed :)

Also, Kdenlive was installed - havent had a chance to try it out.

CDROMs are automounted - nice, has been a MDK feature.

an icon appears on the desktop.

USB Drives - work …..although they do not automount. I suppose this

can be set in /etc/fstab.

Not so pleasant things:

XMMS was not installed :-o

Totem has such a stupid interface for Playlists.

Windows key not mapped to Gnome menu.

Wireless configuration - 2

Thursday, September 30th, 2004

Update 2: Sep 30, 2004, 3:14am

Edited the /etc/rc.d/rc.wireless.conf

Changed the ESSID from Any to

Logged out and logged in - no luck.

/etc/rc.d/rc.pcmcia stop , then start - no luck.

reboot - got it working on the reboot…Dunno if it was the manual editing of the file…or the Kwifi manager.

Setting the system-wide default window manager

Thursday, September 30th, 2004

Change it in /etc/X11/xinit/

or

use xwmconfig.

or

at the login screen, change the Session to whatever you want.

(This was tested in Slackware 10)

How to change default desktop environment?

Thursday, September 30th, 2004



Use xwmconfig

http://www.linuxquestions.org/questions/archive/8/2001/11/3/8699

How to enable Graphical Login prompt

Thursday, September 30th, 2004

To display a graphical login prompt, change the runlevel from 3 to 4

/etc/inittab

http://www.linuxquestions.org/questions/history/230311

Wireless configuration - related commands

Monday, September 27th, 2004

Got the Hawking Wireless card working on Slackware 10 (Dell Laptop).

I cannot say “finally” because I had never tried earlier :)

Had left the card in the PCMCIA slot during install and it installed drivers or modules for it automatically.

Leaving the card in the slot during installation has nothing to do with it.

It is when the system is rebooting that the Cardbus services are activated and

these devices detected.

Saw that KDE had KWifiManager installed. This KWifi is pretty cool. It shows the signal strength, the access point MAC address,

the IP address. Just like the Windows utility. KWiFiManger simply reports the information being handled by wireless tools. In addition, it also has different configuration profiles too.

It wouldn’t work the first time though after I changed the SSID and activated the configuration.

So I gave it a restart and it worked !

Reboot not really necessary.

I tried this and it worked!

/etc/rc.M

Apparently, this was a re-init of all services for the Multiuser profile,

I guess rc.pcmcia would have done the same.

So that got my Internet working (I saw the IP address was assigned).

It got detected as eth0, which is quite confusing. The onboard NIC became eth1.

In some distro of Linux, I had seen that the wireless connections were referred to by wlan0, wlan1 and so on…

In any case, wireless is working and at last the laptop can be moved out of my room.

It’s only this card that was working and I don’t know how to get the other cards working (as yet).

So here are some commands and snippets I learnt along the way:

/etc/rc.d/wireless - This file is read when initializing the wireless connections when booting up.

Wireless networking is managed via the /etc/rc.d/rc.wireless, /etc/rc.d/rc.wireless.conf and /etc/rc.d/rc.wlan scripts.

Wireless Tools for Linux

http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html

  • iwconfig manipulate the basic wireless parameters
  • iwlist allow to initiate scanning and list frequencies, bit-rates, encryption keys…
  • iwspy allow to get per node link quality
  • iwpriv allow to manipulate the Wireless Extensions specific to a driver (private)
  • ifrename allow to name interfaces based on various static criteria

Some links on KWifiManager

http://www.linuxquestions.org/questions/archive/3/2003/11/4/118736

Slackware 10 on a Dell Laptop

http://www.mikeoliveri.com/utils/dellslack.html

Slackware Network Configuration

http://openskills.info/view/boxdetail.php?IDbox=1103&boxtype=distro

Setting Java Path for Eclipse

Sunday, September 26th, 2004

Installed Eclipse 3.0.2 on a Dell Laptop running Slackware 10.0

Installed Java into /usr/local

This link gives a walkthrough to editing the /etc/profile file.

http://www.linuxforum.com/forums/index.php?showtopic=86431

———————————————————————————

The variable PATH needs to include the path to the java executable.

Best solution - set both variables for all users:

-remove the addition to /home/danny/.bash-profile (we’ll move it to /etc/profile)

-edit /etc/profile

add:

export JAVA_HOME=/home/danny/Development/Java/j2sdk1.4.2_05

export PATH=$PATH:$JAVA_HOME/bin

Home is not set to ../j2sdk1.4.2_05/jre/bin/java as that is an actual file, and it should be set to the top directory of java.

The PATH is set to incluse $JAVA_HOME/bin instead of $JAVA_HOME/jre/bin/ as I think that the former is the correct java to use for the sdk, though both look the same:

CODE
root@lfs:/opt/j2sdk/j2sdk/bin# ./java -version

java version “1.4.2_03″

Java(tm) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)

Java HotSpot(tm) Client VM (build 1.4.2_03-b02, mixed mode)

root@lfs:/opt/j2sdk/j2sdk/bin# cd ../jre/bin

root@lfs:/opt/j2sdk/j2sdk/jre/bin# ./java -version

java version “1.4.2_03″

Java(tm) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)

Java HotSpot(tm) Client VM (build 1.4.2_03-b02, mixed mode)

If it doesn’t work for you then try

export PATH=$PATH:$JAVA_HOME/jre/bin

instead

Once the profile is changed, bash needs to load the profile. You can login again, start another bash session (new console or konsole or whatever) or type:

source /etc/profile

check the settings have taken effect with:

echo $JAVA_HOME

echo $PATH

You may also want to set MANPATH to include $JAVA_HOME/man

export MANPATH=$MANPATH:$JAVA_HOME/man

if your distro uses /etc/man.conf then add the manpath to that instead.

add the line:

MANPATH /home/danny/Development/Java/j2sdk1.4.2_05/man

You mentioned CLASSPATH in the topic, this is from the Beyond Linux From Scratch instructions:

QUOTE


Handling CLASSPATH

When compiling packages, the CLASSPATH environment variable is used by JDK to locate classes at compile-time and run-time. It is tedious to add all the classes used to the CLASSPATH manually. You may add the following lines to your shell startup file to set CLASSPATH automatically to include all JAR files in a specified directory, which in the example below is /usr/lib/auto-java-classpath.

AUTO_CLASSPATH_DIR=/usr/lib/auto-java-classpath

if [ -z $CLASSPATH ]

then

CLASSPATH=.:$AUTO_CLASSPATH_DIR

else

CLASSPATH=$CLASSPATH:.:$AUTO_CLASSPATH_DIR

fi

for i in $(ls $AUTO_CLASSPATH_DIR/*.jar 2>/dev/null)

do

CLASSPATH=$CLASSPATH:$i

done

so you can modify that to use whatever directory you want to have your classes, and put it into /etc/profile

———————————————————————————