07 October, 2006

OO Browser in XEmacs

Use OOBR(OO-Browser)

OORB shows class structures etc., when you make a program with the language which has classes like C++.

After you execute M-x oobr, you should answer the following questions. The directory under which source (header) files are, the directory under which library header files are, and the path of files such as OOBR, OOBR-FTR. The emacs window is divided after OOBR file is made. Frankly speaking, I am not familiar with OOBR yet. But I think you can use it with the following commands.

  • v : Show the definition of class.
  • e : Edit class.
  • m : Search class with the regular expression.
  • c : Show the list of child classes.
  • p : Show the list of parent classes.
  • t : Show the list of top classes.

narrowing

  1. Select the function
  2. Do narrowing.(C-x n n)
  3. Return to the top.(C-x C-x)

Then, you can see only this function. By typing C-x n w, you reset the state.

using emacs tags

etags source.cc
  • M-. [symbol-name] : Jump to the definition of the symbol.
  • C-x 4 . [symbol-name] : Show the definition of the symbol on another window.
  • M-, : Show the next matching.
  • M-? [symbol-name] : Show the declaration of the symbol on the mini-buffer.

04 October, 2006

Secondary Mark in Emacs

(global-set-key [(control shift down-mouse-1)] 'mouse-drag-secondary)

01 October, 2006

30 September, 2006

Add extra types to emacs c++ mode (e.g. Root)

(setq c++-font-lock-extra-types
'(
"TFile"
"TProfile" "TH1D" "TH1F"
) )

02 August, 2006

seek and replace

sed -i 's/prima/dopo/g' filewithsomethingtobereplaced

# delete ALL blank lines from a file (same as "grep '.' ")
sed '/^$/d' # method 1
sed '/./!d' # method 2
sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'

# remove all non-consecutive duplicate lines
awk '!x[$0]++' new > newfile

more here

13 July, 2006

Better Goto-line and Other-Window shortcuts

  • (global-set-key "\M-l" 'goto-line)
  • (global-set-key [(control tab)] 'other-window)

25 May, 2006

Slow Font Change in Emacs

As the title implies my emacs would always take its sweet time changing the font from courier 12 (default) to adobe-courier--...20 *** etc. Apparently, it's much quicker if you keep that option out of .emacs and create an alias with a -font option. E.g.
  • alias emacs='emacs -font -adobe-courier-bold-r-*-*-20-*-*-*-*-*-*-*'
Graças a Deus!

05 May, 2006

Fixme Comments in emacs

  • C++

(font-lock-add-keywords

'c++-mode
'(("\\<\\(FIXME\\)" 1 font-lock-warning-face t)))
(modify-face (quote font-lock-warning-face) "Red" "yellow" nil t nil t nil nil)

  • Perl
(font-lock-add-keywords
'perl-mode
'(("\\<\\(FIXME\\)" 1 font-lock-warning-face t)))
(modify-face (quote font-lock-warning-face) "Red" "yellow" nil t nil t nil nil)

  • Also the more decorations - the merrier
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(setq font-lock-maximum-size nil)
(setq font-lock-support-mode 'jit-lock-mode)
(setq jit-lock-stealth-time 0)

Skip a word with Ctrl right/left arrow

Brillant!! Finally found out how to make this work in xterm.
Put the following in your .inputrc

## rxvt
"\eOd": backward-word
"\eOc": forward-word

## xterm
"\e[1;5D": backward-word
"\e[1;5C": forward-word

"Less is more" and other useful exports and aliases

alias any='find . -iname *$1*'
alias grep='grep --color'
alias purge='rm *~ ; rm \#*'
alias nemacs='emacs -nw'
alias pico='nano'
alias pss='ps -ef |grep'
alias more='less'
alias bc='bc -ql'
alias lprodd='lpr -o page-set=odd'
alias lpreven='lpr -o page-set=even'

export PS1=" \u \w $ "
export today=$(date +%d%b%y)

22 April, 2006

Mplayer and framedropping

mplayer -framedrop helps when the image falls behind the sound.
I also had to change -vo x11 to -vo xv, in so that the animation would become smoother.

12 April, 2006

Font Server

After an improper restart (x-server hung up) the X-server wouldn't start, saying something about FontPath being specified as user:/ 7100 (which it is, in xorg.conf), and that it can't find font 'fixed'. Turns out it was caused by the xfs server. It hadn't started despite a couple of reboots. Doing
    • /etc/init.d/xfs start
seems to have fixed the problem. Brilliant!

08 April, 2006

Fix the sound problem with the firefox flash plugin

This is something that keeps recurring every other linux upgrade or reinstallation. The solution is to simply change the permissions on the plugins directory:
  • chmod a+rwx /usr/lib/firefox-xxx/plugins

Putting Nvidia to Sleep

Turns out Hibernation (which now comes with the FC package) can coexist with the NVIDIA drivers. One of the biggest hurdles in the process was the fact that online posters kept referring to 8178 as the latest Nvidia driver. It's not, as I found out by visiting their official website. There, in the download section
  • get the driver version - NVIDIA-Linux-x86-1.0-8756-pkg1.run (if you have a 32 bit architecture) and run it as usual.
  • In my case I had to downgrade from kernel version 2.6.16-1.2084_FC5 to 2.6.16-1.2080_FC5, since 1) I couldn't find the source package for the 84-version, and 2) because I vaguely recalled somebody claiming to have less headache with hibernation after going through the analogous downgrade.
  • One more thing - not sure if this played any role in making everything work, but following some other guys suggestion I added
Option "NvAgp" "1"
to my /etc/X11/xorg.conf. Probably not, because I put it in the "Screen" section, instead of "Device", where chances are it's ought to be.
    • BY THE WAY, installing FC5 onto LVM's doesn't change a thing. Although smartd service stopped complaining. But hibernation is ok.

27 March, 2006

Wi-Fi

  • get WG511DCB.arm from prism54.com or somewhere else (not as easy to find as you'd think) [1.0.4.3.arm?]
  • rename it into isl3890
  • copy it into /lib/firmware
  • add "alias eth1 islpci_cb" to you /etc/modprobe
  • bring up the interface after instering the PCMCIA card - "/sbin/ifconfig eth1 up" (/sbin/ifconfig/ eth0 down)
  • it helps to have wlassistant installed (yum does it for you painfully enough)
  • Try to connect to the network of choice. Don't forget to select DHCP in the network config.
  • Cross your fingers and wait
  • Alternatively
http://sourceforge.net/projects/ndiswrapper
Unfortunately this involves patching and recompiling the kernel, which is always fun.

Check your architecture

rpm -q --qf '%{ARCH}\n' kernel

24 March, 2006

Further Emacs Improvements

    • (setq-default line-spacing 2)

23 March, 2006

Mounting NTFS (Fedora)

Get the module rpm from here (see step 2 first)
  1. Become a root
    • su
  2. Check your kernel version (do this before you download the rpm)
    • uname -r
  3. Go to where you saved the rpm and install it
    • rpm -ivh ntfs-blah-blah-blach.rpm
  4. Create a mountpoint for your windows partition
    • mkdir /mnt/win
  5. Check the device identifier (look for ntfs in the output)
    • /sbin/fdisk -l
  6. Add following to your /etc/fstab
    • /dev/hda1 /mnt/windows ntfs ro,defaults,umask=0222 0 0
  7. Enjoy
Read this and more useful FC5 instructions here