## Sunday, 23 September 2012

### ED line editor - tutorial

Ed is a line-oriented text editor.

It can be used interactively or in shell scripts.

Ed is the original text editor for Unix. It was written by Ken Thompson in 1971.

Ed is a small editor with few dependencies that can help you edit some files in situations where no other editor is usable.

#### INSTALLATION (DEBIAN)

`\$ sudo aptitude install ed`
`\$ which ed`
`/bin/ed`
`\$ ed` # run ed program.

#### RUNNING ED EDITOR

`\$ ed file_name` # opens file_name for editing. Changes are not stored until w command is introduced.

#### COMMAND STRUCTURE

Ed works by accepting commands to edit parts of the file.

Commands usually have this structure:

Commands are one letter long.

Address means to which lines command is applied to.

Parameters are passed to command.

## Monday, 17 September 2012

### LUA PRIME CALCULATOR using preprocessing based on Sieve of Eratosthenes

This article shows a lua script to calculate an ordered prime list starting with 2, 3, 5, 7, etc.

We are going to improve former lua prime calculator using a preprocessing table.
This table will allow us to discard quickly some numbers and its multiples.

Within this lua script, first we perform some preprocessing, and after that actual prime testing for remaining numbers are performed.

#### Sieve of Eratosthenes

Sieve of Eratosthenes is an algorithm to calculate a prime number list up to a chosen number.

In this program we will use this algorithm to generate a preprocessing table.

Some examples are useful to show how preprocessing table works:

Tables are generated using a sequence with first prime numbers.

E.g:

Preprocessing table for 2

{2}

So we will test numbers this way:
We start with number one, and sum to it the first number from preprocessing table:
1+2 = 3 (3 is the next number to test for primality)

Once preprocessing table has completed, we start from first element again (2):
3+2 = 5

5+2 = 7

## Monday, 10 September 2012

### How to set Bitlbee (GTalk and Twitter) in Debian

BitlBee is an IRC gateway to other instant messaging networks which use different protocols (e.g: jabber, ICQ, AIM, MSN, etc)

From user point of view BitlBee acts as an IRC server which forwards your messages to other networks like Google Talk, Facebook, Twitter, Identica,
etc.

BitlBee official web page: http://www.biltbee.org

#### INSTALL BITLBEE (DEBIAN)

When writting this article current BitlBee version in Debian unstable was 3.0.5
This version allows us to authenticate using OAth.

`\$ aptitude show bitlbee`
```Package: bitlbee
Version: 3.0.5-1.1
Description: An IRC to other chat networks gateway (default version)```

Install BitlBee IRC gateway:
`\$ sudo aptitude install bitlbee`

If after configuring it we need to restart Bitlbee daemon
`\$ sudo service bitlbee restart`