To known only uncommented lines

Whenever I look at any config files, it has some settings as well as comments on it.
Now I want to extract only the settings to a different file to concentrate on it,add more,delete etc. and keep the commented file for reference only.
How do I separate the settings from the comments.
For eg, In /etc/Muttrc
#
# System configuration file for Mutt
#

# default list of header fields to weed when displaying
#
ignore "from " received content- mime-version status x-status message-id
ignore sender references return-path lines

# imitate the old search-body function
macro index \eb '/~b ' 'search in message bodies'
---------------------------------------

Separate the following lines from above.

ignore "from " received content- mime-version status x-status message-id
ignore sender references return-path lines
macro index \eb '/~b ' 'search in message bodies'



:g/^#/d


and then saving to a different file should do.

man page under vim

<leader> K - thats it!

which means that the cursor is under the topic and you press Capital K.

ctags and some vim stuff

If you are editing a C program using vim, then create a tag file using ctags

:!ctags . [ . for the current file ]
OR
:!ctags * [ * for all the .c and .h files, if you are in a src directory]

Now, the next time you stumble across a function name,variable name and you want to know its declaration, then just do a CNRL + ]. Thats it! Quite useful.

Another feature of Vim is Auto-completion. for example
#include<expat.h> has number of XML related declarations typing the first few characters of variable and then doing CNTL+N
should provide you list for the auto-completion. Interesting, huh?

XML_ERROR_JUNK_AFTER_DOC_ELEMENT
XML_SetProcessingInstructionHandler
XML_SetUnparsedEntityDeclHandler
XML_SetExternalEntityRefHandlerArg

I could have never typed the above properly (without losing my sense, CNTL+N helped me)


...creating a tags file is the first thing I do when browsing a program
- Bram Moolenar in Vim: Seven habits of effective text editing.

gt

This is gt a shell script in my /usr/local/bin


#!/bin/bash

# Calling gnome-terminal which fills the display area
# hides the menu bar
# when used as a startup, this would give a terminal over the X
# Thus helping the people who have the habit of opening the gnome-terminal the first thing, they login in init 5.
# Those kind prefer init 3 in the /etc/initrd, but this script should help provide a near possible setup ;)

exec gnome-terminal --geometry=125x39+0+0 --hide-menubar --tab --active --tab --tab

exit 0

I have put this script to load as a startup program in GNOME using gnome-session-properties.
looking for command line way to include scripts / bins in the startup (when X starts).
Peeking through. the .gnome2 in the ~/ had some file called session-manual which had

[Default]
num_clients=2
0,RestartStyleHint=3
0,Priority=50
0,RestartCommand=/usr/bin/firefox
1,RestartStyleHint=3
1,Priority=50
1,RestartCommand=/usr/local/bin/gt

As always, there should be a better way, a more understandable way, to include a script/ bin to start automatically at the startup.



~

Commenting Lines using vim for bash,conf file etc

It was needed that I comment a number of lines in a file. The comments of a configuration file are usally like a # in the begining of the line.
So
Line 1
Line 2
Line 3
Should become

#Line 1
#Line 2
#Line 3

HOWTO:

1) Go to the First Column of the First Line.
2) Select the Block using cntl-v (for Linux) and cntl-q(for Windows, because cntl-v is mapped to paste function in gvim under windows)
3) With the Selected test, give the command :s/^/#/
4) That should do!

But vim users always look for yet another way, so I am.

Changeformat.sh

#!/bin/sh

# Change the Format from the ogg files in a directory to aiff

for i in `ls -1 *.ogg`
do
sox $i `echo $i|sed -e "s/ogg/aiff/"`

done

exit 0

Rapple

Rapple is Lightweight XML based transformation tool written in C that builds upon expat, tidylib and XSLT to tranform authored web content (incl. Word processor generated HTML) into styled web content suitable for publication.

Its a nice feeling when becoming member of a sourceforge project.
Thanks a lot Alan, for including me in the development list.
Try the Rapple Demo now!!

Is ``int* p;'' right or is ``int *p;'' right?

Both are "right" in the sense that both are valid C and C++ and both have exactly the same meaning. As far as the language definitions and the compilers are concerned we could just as well say ``int*p;'' or ``int * p;''

The choice between ``int* p;'' and ``int *p;'' is not about right and wrong, but about style and emphasis. C emphasized expressions; declarations were often considered little more than a necessary evil. C++, on the other hand, has a heavy emphasis on types.

A ``typical C programmer'' writes ``int *p;'' and explains it ``*p is what is the int'' emphasizing syntax, and may point to the C (and C++) declaration grammar to argue for the correctness of the style. Indeed, the * binds to the name p in the grammar.

A ``typical C++ programmer'' writes ``int* p;'' and explains it ``p is a pointer to an int'' emphasizing type. Indeed the type of p is int*. I clearly prefer that emphasis and see it as important for using the more advanced parts of C++ well.

The critical confusion comes (only) when people try to declare several pointers with a single declaration:

 int* p, p1; // probable error: p1 is not an int*
Placing the * closer to the name does not make this kind of error significantly less likely.
 int *p, p1; // probable error?
Declaring one name per declaration minimizes the problem - in particular when we initialize the variables. People are far less likely to write:
 int* p = &i;
int p1 = p; // error: int initialized by int*
And if they do, the compiler will complain. Whenever something can be done in two ways, someone will be confused. Whenever something is a matter of taste, discussions can drag on forever. Stick to one pointer per declaration and always initialize variables and the source of confusion disappears.

Bjarne Stroustrup

Network Install of Fedora Core

Tried with a Network Install of Fedora Core 4 Test 2. Not from the Fedora Download Server, but from the internal server where Linux isos are kept.

Network Install is easy as breeze.
There was directory called os where all the rpms,srpms where located.

1) Download and Write boot.iso. This was present inside: /os/images/
2) Boot using boot cd and select Network Install option ( I selected http)
3) Determines the DHCP, prompts for the Server name or IP and then Folder in which the Fedora Packages for the architecture are located.
4) Rest of Install is same as you with the cd.

Difference between network install and cd based install is, you dont have to download and write CDs and the network install is slower than install using cds. ( you can start the install at night,go to sleep and get the Fedora System up in the morning).

Internet through Tata Indicom

Using LG LSP -345
To Connect to Internet, got the help from avinashbrathod's page.

On Fedora Core 3:
Step 1: Setup wvdial.conf
#cat /etc/wvdial.conf
[Modem0]
Modem=/dev/ttyS0
Baud=115200
SetVolume=0
Dial Command = ATDT
init1=ATZ
init2=AT+CRM=1
FlowControl=Hardware(CRTSCTS)
[Dialer Indicom]
Username=internet
Password=internet
Phone=#777
Stupid Mode=1
Inherits = Modem0

Step 2:
#wvdial Indicom

[root@localhost Modem]# wvdial indicom
--> WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
ATQ0
OK
--> Re-Sending: ATZ
ATZ
OK
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
ATQ0
OK
--> Re-Sending: ATZ
ATZ
OK
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT+CRM=1
AT+CRM=1
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Tue Apr 12 10:43:17 2005
--> pid of pppd: 3613
--> Using interface ppp0

Ip addresses will be displayed.
This will have Primary DNS and Secondary DNS Addresses as well


Step 3: Copy the Primary DNS and Secondary DNS address to /etc/resolv.conf


nameserver [primary DNS]
nameserver [primary DNS]

Step 4: Shoot your FireFox and Go.