Showing posts with label debian. Show all posts
Showing posts with label debian. Show all posts

Saturday, 26 January 2008

Debian printing via CUPS

Task: to print documents via local printers in Linux.

Solve: it is required to install CUPS printing system and add the printer, which can take less than minute.


Let's firing up the CUPS
The CUPS is Common UNIX Printing System. Before you install CUPS, you ought to look if you printer is supported, starting from here. If you printer is supported, install the next packages:

aptitude install cupsys gs-esp foomatic-bin foo2zjs
It is significant to install not only CUPS itself, but a programs used by him.

It is really common mistake when people installing only cupsys,package and forgetting to install foo2zjs when using Hewlett Packard printers. As a result, during the print process, errors like listed below appearing:
I [23/Aug/2005:14:41:46 +0400] Adding end banner page "none" to job 7.
I [23/Aug/2005:14:41:46 +0400] Job 7 queued on 'HPDeskJet930C' by 'penta4'.
E [23/Aug/2005:14:41:46 +0400] Unable to convert file 0 to printable format for job 7!
I [23/Aug/2005:14:41:46 +0400] Hint: Do you have ESP Ghostscript installed?
I [23/Aug/2005:14:41:46 +0400] Hint: Try setting the LogLevel to "debug".

When all packages will be installed, you must add printers and start to print.


In press!

For new printer to add or to change settings of already installed printer, launching any browser and go to the address:

http://localhost:631

After some time, settings page should appeare:


The CUPS page may loading in a long time if there is misconfigured DNS server in the local machine or in network. It is preferable to deactivate unnecessary network interface
ifconfig eth0 down
Pushing Printers menu item - if there are no printers, CUPS must confirm that. For new printer to add, a root privileges are required:

Next, writing printer's name with Latin font and without spaces. After that considering a printer's connection type (in my case, it's a USB printer):

Thus, choosing a printer from a list:

A few clicks after and all work is done. It is a good idea to enter in Printers menu and check if it appearing in list of ready-to-print devices.

It can be easily configurable resolution, paper size and so on.


Printing from the GiMP

To print from GIMP, several additional packages are required:

aptitude install cupsys-driver-gimpprint gimp-print

Now open the GIMP, any picture and select File - Print. After that, a big dialog box should appear, where all printer properties can be tweaked.

Here are some obstacles: gimp-print by default assuming you printer definitely postscript-compatible, what is sometimes wrong. To prevent incorrect printer output, printer must be selected directly:

That means to push Configure printer, selecting a model, approving and saving tweaks. Finally, all should work perfectly.

Read more...

Wednesday, 23 January 2008

Howto simply configure network card in Debian

Besides presence of eye-candy graphical configurators in Linux, in many situations it is more straightforward to change config files. It is really simple, and below it is shown how to do it.

How to see current network card settings
For brief review of network settings, it is enough to type in command prompt:

# ifconfig
or
sudo ifconfig
And something like this should appear:

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:104 errors:0 dropped:0 overruns:0 frame:0
          TX packets:104 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9387 (9.1 KiB)  TX bytes:9387 (9.1 KiB)
eth0      Link encap:Ethernet  HWaddr 00:0A:E4:53:AA:2D
          inet addr:192.168.1.5  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:21 Base address:0x2c00

It is evident, that there are two interfaces had been configured: loopback named lo, and conventional Ethernet card eth0.


How to configure network connection in Linux
To do so, you need root privileges and _your_favorite_text_editor, as well as knowledge of which IP address you need to enter.

To find out which network interface need to be configured, type:
dmesg | grep -i Eth
and next strings should appear:
8139too Fast Ethernet driver 0.9.28
eth0: RealTek RTL8139 at 0xdf822c00, 00:15:f2:51:ad:da, IRQ 21
eth0: Identified 8139 chip type 'RTL-8101'
It looks like it is eth0 (because ethernet, 0 - zero device, pretty logical). Here and below it is assumed that interface is eth0


Configuring Linux network with static IP
Just edit the file:
# nano /etc/network/interfaces
or
sudo nano /etc/network/interfaces
For your local network static IPs are surely enough. In particular, for static IP networking you need to enter: IP-address, netmask and gateway. Change  /etc/network/interfaces to something like this:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.5
    netmask 255.255.255.0
    gateway 192.168.1.1
In this example, IP-address 192.168.1.5 is set.


Configuring Linux network with dynamic IP addresses
Continue to edit network config:
# nano /etc/network/interfaces
or
sudo nano /etc/network/interfaces
It is simpler here:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Similarly, network interface can be configured via command line:
#dhcpcd eth0
For this, you should install in Debian aptitude install dhcp3-client.


Configuring DNS nameserver in Linux
If you don't configure DNS, you cannot connect to any Internet resource by it's name. But it's very simple to tweak it: just edit or create file /etc/resolv.conf
# nano /etc/resolv.conf
or
sudo nano
/etc/resolv.conf
And type addresses like this:
nameserver   192.168.1.1
nameserver   192.168.2.1
as much as it is need. The word nameserver is required. It is curious, but in fresh Debian installation there is no resolv.conf...


For changes to take place immediately...
... one can reboot the system, or type:
# /etc/init.d/networking restart 
or
sudo /etc/init.d/networking restart 
That's all, changes will be applied for all network interfaces.
Read more...

Thursday, 6 December 2007

Yet another Linux to Windows printing tip

Problem: one have a printer shared for networks printing and connected to a windows machine. From the other side, there is Linux-powered machine with CUPS installed and we want to print on windows shared printer.
Solve: with CUPS webform, adding printer and specifying login guest for printing without a password in a windowish printer.

Let's consider a common situation: we have winXP computer with network address 192.168.1.1, it has network shared printer LaserJet 1200 visible by SAMBA with name HPLaserJ. From another windows machines all printed without problems, but from Linux machine with CUPS when you attempt to print something you getting error.

Connection failed with error NT_STATUS_ACCESS_DENIED

If you attempt to print on it via IPP, you get:
Unable to connect to SAMBA host, will retry in 60 seconds...foomatic-rip version $Revision$ running...

There is no password on shared printer in windows - it is empty.

Solve of this puzzle is ridiculously simple. Just add in CUPS webform new printer, choose "Windows printer via Samba", and in address field write:
smb://guest@192.168.1.1/HPLaserJ

And that's all! Printing without a problems!

It's incredible that in huge and pretty goofy CUPS documentation this useful example is missing.

In KDE applications you ought to choose local printing address 127.0.0.1:631.

Read more...

Saturday, 24 November 2007

How to configure webcam in Debian Linux

The friend of mine had been presented to me a webcam recently. On the box of Logitech QuickCam, there were logo of an alternative operation system, but in Debian configuration of a webcam is as easy as 1-2-3. Here are tips for configuration of a webcam.

Preparation
Some preparing words - if you didn`t compile your own kernel, this section can be omitted.
Webcam interface in kernel is almost like TVtuner - it is ordinary video device with /dev/video0 output. That`s why all articles about TVtuner configuration can help you as well. So, in kernel must be turned on:

  • v4l and all of it protocols (v4l monolithically, protocols - as modules)
  • i2c and it protocols (as well as during TVtuner configuration)
If it is enabled in kernel, you shouldn`t get any problems.


Installation
In the camera`s box was wrote: installation as simple as 1-2-3. So, I get pretty the same:

1. Installing software.
Instead of use of tonnes of proprietary garbage, let`s install from Debian repository:
sudo aptitude install gspca-source camorama
In the /usr/src directory, archive with driver source gspca-source.tar.bz2 will appear. Unpack it and change directory to /usr/src/modules/gspca and execute following:
make
Module must compile without errors. Next, do this:
sudo make install
This command will install your module in directory, were other kernel modules are placed. Optionally it can be executed:
sudo depmode -a
That`s itl, our goal is to load module of a webcam:
sudo modprobe gspca
Next step is to plug camera in USB and start the software.


2. Plugging the webcam
After you plug webcam into USB, it turns on green LED and in kernel logs should appear something like this:

usb 4-1: new full speed USB device using uhci_hcd and address 6
usb 4-1: configuration #1 chosen from 1 choice
/usr/src/modules/gspca/gspca_core.c: USB SPCA5XX camera found.(ZC3XX)
/usr/src/modules/gspca/gspca_core.c: [spca5xx_probe:3887] Camera type JPEG
/usr/src/modules/gspca/Vimicro/zc3xx.h: [zc3xx_config:515] Sensor ID:7
/usr/src/modules/gspca/Vimicro/zc3xx.h: [zc3xx_config:597] Find Sensor HV7131R(c)
/usr/src/modules/gspca/gspca_core.c: [spca5xx_getcapability:1165] maxw 640 maxh 480 minw 176 minh 144
usbcore: registered new interface driver gspca
/usr/src/modules/gspca/gspca_core.c: gspca driver 01.00.04 registered

It looks like the webcam had been recognised. Now the device file /dev/video0 must appear - this is actually our camera. After that, webcam's soft should be launched:
$ camorama
If all was done correctly, you should see video in a small window of Camorama. It can be something like this:


3. Start using the camera
Now you can use your cam in Wengophone for video conference with friends and colleagues. It is need to say that image processing from webcam consumes processor time very moderate, around 4-5% on my Pentium M 1.75 GHz laptop.

Besides video conferences in VoIP, one can turn fantasy on and find many interesting applications to webcam. You may use it as security camera or telemetric device: streamer program can grab pictures from it with a prescribed frequency.


Conclusion
Except that there were mentioned only RedmondOS, Logitech QuickCam Messanger webcam works great in Linux, and configured in same three steps minus tons of useless proprietaty garbage.

During the tweaking I used these great guidelines because of my custom-made kernel. Those who use distribution kernel, this guide may be helpful.

I am very grateful to my good old friend :-) for presented webcam - thanks a lot!
Read more...

Wednesday, 14 November 2007

Quick PDF sorting and searching: SWISH++

Problem: using SWISH++ it is possible to search and sort PDF-files automatically
Solve: tools like pdftotext, find, scripts on Bash or Perl are required to perform quick and fast search within PDF and indexing PDF documents.

The common way is to use Beagle or some other searching stuff, but I show how SWISH++ can do the same, but much, much more fast and resource-efficient.


Introduction: How indexing within PDF
Perl-lovers likes to say that "there is more than one way to do it". So, that`s my way to do it. Briefly, solve consists from these steps:

  • use find to search all pdf documents and converting them to text with pdftotext tool
  • indexing this text files with index++ and getting index file
  • experimentally choosing level of relevant
  • searching in index file with keywords using search++
  • found files moving into required directory

Searching in PDF-documents and getting text from them

Simply asking find tool to search all *.pdf files and for everyone executing pdftotext in quiet mode. This can be achieved by command:
find -name '*.pdf' -exec pdftotext -nopgbrk -q {} \;
It is possible only for English, and other languages are not supported..

Making index file
Here it is even more simply: just ask index++ to index all of our textual files from current directory to the deep:
index++ -e "text:*.txt" .
Dot at the end is required!


What is SWISH++
There are a few mentions about SWISH++ in the Net - only homepage of project and article about application this system to real search engine. Some guys tells that SWISH++ is fastest search engine ever.
Description of this excellent search system can be found in debian package - Simple Document Indexing System for Humans: C++ version. Especially it is suitable for fast and efficient search engine.
Here are some advantages of SWISH++
  • Lightning-fast indexing
  • Indexes META elements, ALT, and other attributes
  • Selectively not index text within HTML or XHTML elements
  • Intelligently index mail and news files
  • Index Unix manual page files
  • Apply filters to files on-the-fly prior to indexing
  • Index non-text files such as Microsoft Office documents (antiword required)
  • Modular indexing architecture
  • Index new files incrementally
  • Index remote web sites
  • Handles large collections of files
  • Lightning-fast searching
  • Optional word stemming (suffix stripping)
  • Ability to run as a search server
  • Easy-to-parse results format
SWISH++ consist of two tools: index++ и search++. First tool indexing files, and second one searches within index. It`s like your personal Google, but small, fast and console. :-)


Indexing files
index++ make index file, which contains indexed text documents, made by pdftotext (oh, yea, UNIX-way!). It supports such formats as text, HTML, XML, LaTeX, mail - all that can be converted to text with may be little bit of tag-reached. On my desktop machine indexing is very fast: Intel Р4 630 3GHz with 2GB RAM indexing 270 in 5 seconds.

With level verbosity of 3, one can get more information about indexing process:
index++ -v3 -e "text:*.txt" .
Dot at the end is important, manual page can say more. Output will be like this:

watters_etal_paleobio_2001.txt (2704 words) WaveMetriconChip64.txt (1351 words) wshedtopoalgoJMIV.txt (4042 words) Ye.IJDAR.1.txt (4470 words) YucelITIP01.txt (1678 words) ./edg: morphology.txt (753 words) LuengoEtAl_IbPRIA05.txt (1227 words) Cuisenaire2005_1250.txt (1162 words) icpr2004_nucleus.txt (1234 words) OrtizEtAl_SPIE01.txt (1463 words) Angulo_VIIP04.txt (1658 words) 682.txt (1901 words) comorph.txt (1948 words) index++: ranking index... index++: writing index... index++: done: 00:05 (min:sec) elapsed time 548 files, 271 indexed 2465116 words, 1046139 indexed, 56281 unique
The result will be swish++.index file were are all information about indexed files.
Great: this huge collection of articles indexed so fast! Now we are ready to search something in it.


Searching files
Let`s find something in our collection of files with keywords. It is possible by asking search++ to find in database swish++.index. For example, I can search papers about morphology analysis of images but without mentions about medicine:

$ search++ morphology and erosion and dilation not medicine
And here are results (output is reduced):
# results: 125
99 ./Krylov2.txt 3771 Krylov2.txt
49 ./13300407.txt 3103 13300407.txt
46 ./morph1.slides.printing.6.txt 4369 morph1.slides.printing.6.txt
37 ./lecture_morphology_sara.txt 6746 lecture_morphology_sara.txt
30 ./SIGGRAPH2002_Sketch-Mitchell.txt 5308 SIGGRAPH2002_Sketch-Mitchell.txt
26 ./MorphologicalImageProcessing.txt 7642 MorphologicalImageProcessing.txt
25 ./phdsymp2002_ledda.txt 8298 phdsymp2002_ledda.txt
23 ./lab2_manual.txt 9313 lab2_manual.txt
23 ./Project 1.txt 9946 Project 1.txt
22 ./morphology.txt 11212 morphology.txt
22 ./edg/morphology.txt 11212 morphology.txt
22 ./slides-6-geometry.txt 11717 slides-6-geometry.txt
22 ./V1BFOGG8.txt 10797 V1BFOGG8.txt
18 ./71650638.txt 13978 71650638.txt
First column is relevantness, second - relative file placement, third - file size, and fourth - name. Simple and clean. So it`s very simple to search article if you remember something about it (author name, keywords, or even phare from it).


What we get
I have vast collection of science articles in English, and it`s very hard to remember exact name and content each of paper. Using this approach, I had sorted more than 2400 papers in about 2 hours. Task for SWISH++ was more difficult because of homogeneity of paper`s content. Precision was estimated as approximately 60-70%. Of course, sorted papers had been viewed by me, so it was semi-automatic-alike mode ;-)


Links: I can`t say all about this shiny search system in one post, but I tried to show how quickly and easily I working with loads of PDFed articles in my Debian box.
For further information, you may be interest in sourceforge page of project. Here are many articles aobut search engines, and, particularly, about SWISH++, and documentation about SWISH-e is here. I hope that with this post, there will be one more article about this very useful system - SWISH++.
Read more...

Friday, 12 October 2007

Quickly and fastly installing LaTeX: LaTeX in Debian Quick HOWTO

Problem: it`s needed to quickly and simply make scientific articles, books, monographs and practically all that have many formulas and graphs.
Solve: installation LaTeX in Debian - a work of a moment.


In UNIX-like systems packages for LaTeX called tetex or texlive. So, let`s open terminal and type as root:

#aptitude install tetex-bin tetex-extra latex-ucs
This will occupy about 120Mb of disk space, let`s approve it. For installation, only first DVD-disk is required. While packages are installing, let`s open your preferable text editor and type something like this:
\documentclass[a4paper, 12pt]{article}
\usepackage[T2A]{fontenc}
\usepackage[english]{babel}
\usepackage[pdftex,unicode]{hyperref}

\begin{document}
This is our first LaTeX document.
\end{document}
Saving this document with any name and *.tex extension, for example newlatexdoc.tex
Next in console, in that directory were you just saved already typed text, give a command:
$ pdflatex newlatexdoc.tex
Besides many files, will be sought-for file newlatexdoc.pdf
That`s all, and you already stared in great world of LaTeX.

Read more...