Tech and travel

Posts

Killing an Oracle session

2007-09-26

Every time you log into Oracle, you create a session. This is an easy way to kill these Oracle sessions, thanks to this article. First, select the session ID and serial number as such : SELECT s.sid, s.serial#, s.osuser, s.program FROM v$session s; The osuser and program field can be used to identify the session. Then you can kill the session using : ALTER SYSTEM KILL SESSION 'sid,serial#'; It’s also possible to kill the session immediately (but that’s considered rude) : ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;

Cambridge

2007-09-25

Some pictures of Cambridge (in the UK) were added to the website. It’s near where I live these days. Some of the colleges are shown, as well as photos from a visit to Wimpole Hall. This last one is a stately home in the countryside.

King's college chapel, the symbol of Cambridge

King's college chapel, the symbol of Cambridge

Asking for a value in Perl

2007-09-20

The following Perl snippet is useful if you want to ask for a value from the user. The get_new_value function takes the variable name and a default value as parameter. These are printed on screen. The default value is used if no input is given. use strict; sub get_new_value { my($param_name, $param_current_value) = @_; print "$param_name [$param_current_value] :"; chomp(my $input=<stdin>); my $new_value = $input eq "" ? $param_current_value : $input; return $new_value; } my $var = get_new_value('VAR', $ENV{VAR});

Highlight the current line in Vim

2007-08-15

To highlight the current line in Vim, you have to set the cursorline setting. :set cursorline :set cul These two are the same. This can also be set in your _vimrc file, you don’t need the colon then. Here’s an extract from my vimrc file: set cursorline set nowrap set ic " Ignore case set ai " autoindent set tabstop=4 set shiftwidth=4 set expandtab set cul " Cursor highlight map <f1> ^hhxxj0 map <f2> ^i <esc>j0 The last 2 entries add mappings for F1 and F2, to dedent and indent the current line.

Substituting from this line to the end of the file (in Vim)

2007-08-07

In vim, if you want to change something from the current line until the end of the line, you can use .,$ as the range segment of the s command. :.,$s/COMPILE/COMPILE BODY/g Substituting over the full file is done by using the % range, which is a shortcut for 1,$, ie from the first to the last line. :%s/COMPILE/COMPILE BODY/g

Copyright (c) 2024 Michel Hollands