scroll more lines with mouse wheel on acroread

edit your .Xdefaults and add this at the bottom:


*XmScrollBar.baseTranslations:#augment\n Shift:IncrementUpOrLeft(0)\n Shift:IncrementDownOrRight(0)\n :IncrementUpOrLeft(0)IncrementUpOrLeft(0)IncrementUpOrLeft(0) IncrementUpOrLeft(0)IncrementUpOrLeft(0)IncrementUpOrLeft(0)\n :IncrementDownOrRight(0)IncrementDownOrRight(0)IncrementDownOrRight(0) IncrementDownOrRight(0)IncrementDownOrRight(0)IncrementDownOrRight(0)\n

That’s ONE line! Then to test it open a pdf with acrobat reader on linux and press shift while scrolling the mouse wheel…you’ll notice the difference 🙂 (it now scrolls one page per scroll “click”)

enjoy 🙂

the right way to enable udev in gentoo

I know there are numerous postings and wiki articles on the net on how to enable udev on a linux distribution and specifically for Gentoo. Because I did not find anything complete here’s my version on doing all that. The were 2 reasons I started looking around for udev support, first reason was to have a special device for my olympus c70z so I did not have to “fdisk -l” every time I wanted to check on what device it was, and secondly to improve the usb_key+hotplug+xlockmore stuff I had done earlier.

BEWARE!!!
I am not writing this guide for complete newbies to linux and kernel stuff…I am not going to explain how to compile a kernel and where to put it and and and and…cause it would never end.

First thing to do check your kernel settings!!

Device Drivers -> USB Support
< *> Support for Host-side USB
[*] USB device filesystem
< *> EHCI HCD (USB 2.0) support
< *> OHCI HCD support


For SCSI support
Device Drivers -> SCSI device support
[*] legacy /proc/scsi/ support
< *> SCSI disk support
< *> SCSI generic support


For vfat file system support
File systems -> DOS/FAT/NT Filesystems
< *> MSDOS fs support
< *> VFAT (Windows-95) fs support


Remove devfs support (If you want...)
File systems -> Pseudo filesystems
[ ] /dev file system support (OBSOLETE)
BUT YOU MUST REMOVE !!!! below devfs support.
[ ] Automatically mount at boot (SAY NO TO THIS!!!!)

Then emerge the proper packages:
emerge -uDv udev hotplug baselayout

Edit your /etc/conf.d/rc:
You must have settings like that:
RC_DEVICES="udev"
RC_DEVICE_TARBALL="yes"
RC_DEVFSD_STARTUP="no"

then:
sysctl -w kernel.hotplug="/sbin/udev"
rc-update add hotplug boot

In lilo.conf change the append line of your kernel adding this:
append="gentoo=nodevfs"
and then type lilo to make the proper changes.

If you rebooted now your system with the new kernel it should have been udev enabled.

You might encounter mouse problems, because the old /dev/mouse symlink is lost with udev. Edit /etc/conf.d/gpm and /etc/X11/xorg.conf to replace /dev/mouse with /dev/input/mouse0

What’s next ? udev rules. You must make some rules for udev to properly find your devices.
I am going to explain how I wrote 3 simple rules for my digital camera, my usb stick and my usb-hdd.
1) DIGITAL CAMERA
When plugged in the usb port go check your dmesg. You should see something like:
Attached scsi removable disk sdb at scsi7, channel 0, id 0, lun 0
Attached scsi generic sg1 at scsi7, channel 0, id 0, lun 0, type 0

now do this: udevinfo -a -p /sys/class/scsi_generic/sg1
and a bunch of info like that will appear in front of you:
looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.0/usb2/2-2':
BUS="usb"
ID="2-2"
DRIVER="usb"
SYSFS{bConfigurationValue}="1"
SYSFS{bDeviceClass}="00"
SYSFS{bDeviceProtocol}="00"
SYSFS{bDeviceSubClass}="00"
SYSFS{bMaxPower}=" 0mA"
SYSFS{bNumConfigurations}="1"
SYSFS{bNumInterfaces}=" 1"
SYSFS{bcdDevice}="0100"
SYSFS{bmAttributes}="c0"
SYSFS{detach_state}="0"
SYSFS{devnum}="6"
SYSFS{idProduct}="0109"
SYSFS{idVendor}="07b4"
SYSFS{manufacturer}="OLYMPUS"
SYSFS{maxchild}="0"
SYSFS{product}="C70Z,C7000Z"
SYSFS{serial}="1234567890"

SYSFS{speed}="12"
SYSFS{version}=" 2.00"

We just need the italic ones.
edit /etc/udev/rules.d/10-local.rules
and add something like this:
BUS="usb", KERNEL="sd?1", SYSFS{manufacturer}="OLYMPUS", SYSFS{serial}="1234567890", SYSFS{product}="C70Z,C7000Z", NAME="%k", SYMLINK="c70z"

YOUR VALUES WILL DEFER!!!

now “mkdir -p /mnt/digicam” and add something like this in your /etc/fstab:
/dev/c70z /mnt/digicam vfat noatime,user,rw,sync,uid=1000 0 0

mount /mnt/digicam and your camera is ready to extract the pictures from it!

2) USB KEY
same as above…but the rule and fstab entry will defer slightly:
udev rule:
BUS="usb", SYSFS{serial}="23DE746790310A9B", NAME="%k", SYMLINK="mykey"
fstab entry:
/dev/mykey /mnt/usbkey vfat noatime,user,rw,sync,uid=1000 0 0

3) USB HDD
udev rule:
BUS="scsi", SYSFS{model}="00JB-32EVA0", NAME{all_partitions}="wd-usb"
fstab entry:
/dev/wd-usb1 /mnt/usbdisk ext3 noatime,users 0 0

Remember my old post on pam_usb ? It gets a lot better with udev!
edit /etc/pam.d/login
and change the rule into something like this now:
auth sufficient /lib/security/pam_usb.so proc_basename=/proc/scsi/usb-storage/1 !check_device force_device=/dev/mykey allow_remote=1 fs=vfat debug=1 log_file=/var/log/pam_usb.log

where /dev/mykey is created by udev so it does not matter where the real device is…it will always symlink to mykey!

You can’t make it work ? Read these links…they might help you:
Gentoo udev Guide
Gentoo Wiki – HOWTO_Install_a_digital_camera
UDEV Primer
Using udev for Static Device Naming
Writing UDEV rules

usbutils problems and solution

I just wanted a tool to easily monitor my usb devices, and that should be lsusb . In Gentoo it’s inside usbutils package, but when I tried to emerge it I got a ton of errors like that:

In file included from /usr/include/linux/usb.h:4,
from access.c:34:
/usr/include/linux/mod_devicetable.h:18: error: syntax error before "__u32"
/usr/include/linux/mod_devicetable.h:20: error: syntax error before "class"
/usr/include/linux/mod_devicetable.h:21: error: syntax error before "driver_data"
/usr/include/linux/mod_devicetable.h:31: error: syntax error before "__u32"
/usr/include/linux/mod_devicetable.h:33: error: syntax error before "model_id"
/usr/include/linux/mod_devicetable.h:34: error: syntax error before "specifier_id"
/usr/include/linux/mod_devicetable.h:35: error: syntax error before "version"
/usr/include/linux/mod_devicetable.h:36: error: syntax error before "driver_data"
/usr/include/linux/mod_devicetable.h:99: error: syntax error before "__u16"
/usr/include/linux/mod_devicetable.h:103: error: syntax error before "idProduct"
/usr/include/linux/mod_devicetable.h:104: error: syntax error before "bcdDevice_lo"
/usr/include/linux/mod_devicetable.h:105: error: syntax error before "bcdDevice_hi"
/usr/include/linux/mod_devicetable.h:108: error: syntax error before "bDeviceClass"
/usr/include/linux/mod_devicetable.h:109: error: syntax error before "bDeviceSubClass"
/usr/include/linux/mod_devicetable.h:110: error: syntax error before "bDeviceProtocol"
/usr/include/linux/mod_devicetable.h:113: error: syntax error before "bInterfaceClass"
/usr/include/linux/mod_devicetable.h:114: error: syntax error before "bInterfaceSubClass"
/usr/include/linux/mod_devicetable.h:115: error: syntax error before "bInterfaceProtocol"
/usr/include/linux/mod_devicetable.h:118: error: syntax error before "driver_info"
/usr/include/linux/mod_devicetable.h:135: error: syntax error before "__u16"
/usr/include/linux/mod_devicetable.h:138: error: syntax error before "dev_type"
/usr/include/linux/mod_devicetable.h:139: error: syntax error before "cu_model"
/usr/include/linux/mod_devicetable.h:140: error: syntax error before "dev_model"
/usr/include/linux/mod_devicetable.h:142: error: syntax error before "driver_info"
/usr/include/linux/mod_devicetable.h:155: error: syntax error before "__u8"
/usr/include/linux/mod_devicetable.h:160: error: syntax error before "__u8"
/usr/include/linux/mod_devicetable.h:163: error: syntax error before "__u8"
/usr/include/linux/mod_devicetable.h:165: error: syntax error before '}' token

The solution was to edit /usr/src/linux/include/linux/usb.h and comment out lines 4 and 5:

4 /*#include 5 #include */

Then I emerged usbutils just fine…uncommented the previous lines…and everything is working properly:

# lsusb
Unknown line at line 1809
Duplicate HUT Usage Spec at line 2650
Bus 004 Device 004: ID 058f:9254 Alcor Micro, Inc. Hub
Bus 004 Device 001: ID 0000:0000 Virtual Hub
Bus 003 Device 001: ID 0000:0000 Virtual Hub
Bus 002 Device 001: ID 0000:0000 Virtual Hub
Bus 001 Device 002: ID 05e3:0702 Genesys Logic, Inc.
Bus 001 Device 001: ID 0000:0000 Virtual Hub

distcc with gentoo

I wanted to install gentoo on an old pII at 400MHz I own. The compilation time would take really really long if it was done on that machine only…that’s where I thought about installing distcc to my other gentoo machines. I followed Gentoo Distcc Documentation and in a few minutes I was able to compile stuff concurrently between 3 different machines, an athlonxp 2800+, an athlonxp 2500+ and and that pII 400MHz. I edited /etc/make.conf and replaced
MAKEOPTS="-j2"
with
MAKEOPTS="-j4"

The machines were all i686 and the whole process was a lot faster than it would if I compiled only at that old pII. I am now running an emerge –emptytree just to check if all will be compiled cleanly with distcc without problems.

cancelling echo in audigy2 for voip applications in linux

big title huh?

I had tried various applications for VoIP in Linux, Gnomemeeting, kphone, skype, etc etc and I was always told that the remote party heard an echo of his/her voice. My side was perfect…but the opposite side was unacceptable.
The solution to the echo problem was to tweak audigy2 capture values in alsamixer or alsamixergui.

Fire up alsamixer…you should probably see that the “View: ” title on top says “Playback”. Go to microphone and set it down to 0..that’s right..zero. Then press tab once and the “View: ” title will switch to “Capture”. Set PCM capture to 0 (zero) and mic value around 80-90.
The mic boost (+20db) is usefull to me too…use it if you want.
In alsamixergui: set the first PCM slider as high as you want and the second one to zero. Then go to mic and set the first to zero and the second one to 80-90.

After that the remote parties I talked to stopped bugging me about echo problems. So I think that’s the solution.

Linux IP accounting

Time for some more statistics. Say your box runs as a router and you want to monitor which pc of your lans talks to whom from the outside world…how many bytes, packets, flows, etc…or say you use your box at home for p2p applications and want to monitor what’s going on…more than just keeping track of your traffic. That’s where IP accounting comes handy.
I applied IP accounting at my gentoo box at home. What I needed was inside this excellent documentation. Basically one needs fprobe, to export flows from linux in netflow format, flow-tools to collect those netflows, and FlowScan to process the flow files. Most tools are easily emerged…but remember NOT to emerge flow-tools. If you do that you will have problems with Cflow. Do as the documentation says, download flow-tools from their site, ‘make install’ it and go inside the contrib dir, untar Cflow-1.051.tar.gz and do as the documentation says for it. Most other things are rather straightforward.
One usefull shell script I wrote with the help of Angelos was this:
showtop.sh

#!/bin/bash
echo "<pre>" > /var/netflow/scoreboard/stats.html
/usr/local/netflow/bin/flow-cat -p /var/netflow/ft/ | /usr/local/netflow/bin/flow-stat -f10 -S4 -n | head -n 50 >> /var/netflow/scoreboard/stats.html /usr/local/netflow/bin/flow-cat -p /var/netflow/ft/ | /usr/local/netflow/bin/flow-stat -f8 -S3 -n| head -n 50 >> /var/netflow/scoreboard/stats.html echo "</pre>" >> /var/netflow/scoreboard/stats.html

It creates an html file with 2 top-X lists…
The first one is: a report on top source/destination IP pairs sorted by octets
and the second one is: a top destination IP address report by sorted by outbound traffic
I find it really usefull and I’ve added it to my crontab to run every 5 minutes.

It works for me…try it if you wish and comment with your results…

P.S. I think flow-tools was the first package I had to install manually in my gentoo box since the day I’ve installed it. I think it is possible to create an ebuild to overcome the problems with Cflow…but I was too bored…anyway…have fun with IP accounting.

Simple Port Accounting – part 2

A small addition to the previous post about port accounting with iptables and mrtg.

A new script to count tcp and udp connections.
conns.sh

#!/bin/bash
HOSTNAME="/bin/hostname"
NETSTAT="/bin/netstat"
UPTIME="/usr/bin/uptime"
$NETSTAT -ant | grep -v LISTEN | grep -v Active | grep -v Proto | wc -l
$NETSTAT -anu | grep -v LISTEN | grep -v Active | grep -v Proto | wc -l
$UPTIME | awk '{ print $3, $4, $5 }'
$HOSTNAME

and the part that goes inside your mrtg.conf


Target[conns]: `/etc/mrtg/conns.sh`
Options[conns]: growright, nopercent, gauge
MaxBytes[conns]: 20000
Title[conns]: Connections
YLegend[conns]: Connections
LegendI[conns]:  TCP:
LegendO[conns]:  UDP:
ShortLegend[conns]: conns
PageTop[conns]: <h1>Connection Stats </h1 >

enjoy 🙂 It works for me..I hope it works for you too 🙂

American Judges are nothing more than farmers

Where do american people study to become judges ? How can so foolish people become judges ? Just check this news from a Minessota court…

A Minnesota appeals court has ruled that the presence of encryption software on a computer may be viewed as evidence of criminal intent.

Read about this hilarious matter.. I don’t care if the guy was in child pr0n industry…let him rot in jail…but PGP is NOT evidence that someone is using the power of the dark force to conquer the world. Make this judge a favour and sent him home to farm his fields…

grrrrrrr

Introduction to TOR

Today I’ve decided to use Tor a bit. One can say it’s an anonymity tool…but it’s not only that. It’s something more like an underground internet community. You can read an excellent article about Tor too.

Some quotes from the Tor site:

Tor: An anonymous Internet communication system

Tor is a toolset for a wide range of organizations and people that want to improve their safety and security on the Internet. Using Tor can help you anonymize web browsing and publishing, instant messaging, IRC, SSH, and more.

Your traffic is safer when you use Tor, because communications are bounced around a distributed network of servers, called onion routers. Instead of taking a direct route from source to destination, data packets on the Tor network take a random pathway through several servers that cover your tracks so no observer at any single point can tell where the data came from or where it’s going. This makes it hard for recipients, observers, and even the onion routers themselves to figure out who and where you are. Tor’s technology aims to provide Internet users with protection against “traffic analysis,” a form of network surveillance that threatens personal anonymity and privacy, confidential business activities and relationships, and state security.

To the point…Using Tor and privoxy you have access to what’s inside the Tor network. There are hidden wikis, book collections and even more.
This link goes to Tor Network Hidden Wiki and this one goes to KIRA – online list of Tor featured sites.
Notes from the Underground is pretty cool too.

The complete details of connecting to the Tor world are here: Tor Documentation
Oh…if you want anonymous P2P with Tor…check this page about Tor+azureus.
Check this graffiti I’ve found while surfing a site inside the Tor network…I think that it’s great…

P.S. This was posted using the Tor network…my apache logs are clear about this 🙂

Bluetooth + Gentoo + SE K700i

Today I’ve done some first steps in connecting my new phone (sony ericsson k700i) to my box. I’ve borrowed a bluetooth usb dongle from a friend (thnx a lot chrys!) and started playing with it. First thing to do was read what was already documented. Starting at “HOWTO mobile phone, Bluetooth and GNOME” you can easily get a general idea on what’s needed. But there’s a major part missing… the creation of the correct devices.
That’s done by:
cd /dev && mknod rfcomm0 c 216 0 && mknod rfcomm1 c 216 1 && mknod ttyU0 c 208 0 && mknod ttyU1 c 208 1

Following the tutorial above, after having created the proper devices as stated above, is really easy to send files to your phone through nautilus. Just open it and “Send via bluetooth”.
When I have the time I will write about command line sending and receiving files.

Playing midi files at Gentoo linux

My new phone, Sony Ericsson K700i, supports polyphonic ringtones, mp3 or midi, so I downloaded a few from the internet and I wanted to upload them to the phone. Before doing so I also wanted to listen to them on my box. I had never tested playing midi files on my box so far so when I tried listening to them “out-of-the-box” I ran into problems.
I started reading Gentoo Linux ALSA Guide again.
Basically I just had to:
#emerge awesfx

and then load a soundfont … which is a good soundfont though ? Googling around I came up to this site which has a lot of information on soundfonts and has 2 great soundfonts available for linux. They might be BIG…but it’s worth it if you want extra high quality. The difference between those offered at PersonalCopy and the one provided by creative and included at alsa-project is just HUGE.
Just try them with:
# asfxload 8MBGMSFX.SF2
or
# asfxload UNISON.SF2

and play the same file…You’ll hear the clear difference.
You can use kmid to play the files and/or a collection of midi files. Don’t forget to choose your midi output device though…
# aplaymidi -l will give you the complete list of midi devices in your box. Before choosing the “correct” midi port in kmid try all out with:
# aplaymidi -p midi:port file.mid

Image Editing with gimp

I have just bought my new digital camera…and I want to be able to “play” with it as much as I can. There are stuff you can do with the camera…and stuff you can do at your box. Most photo editing tutorials are about photoshop and other windows utilities. This one provides some helpfull tips for editing pics with gimp. More gimp tutorials can also be found here, here, here, and here.
Some more interesting links:
How To Work With Your Digital Camera’s Histogram
The Arithmetic of Printing Images
Understanding Resolution

I hope that’s enough food for thought and practice for now…

Oh btw…I’ve “installed” Internet Explorer in my Gentoo Linux…for..”fun”…Just follow this nice tutorial if you want to learn how to do it. It’s simple…and useless 🙂

The revenge of Internet Explorer

Who thought that my e-banking troubles were over? huh…
Today when I logged in I saw that I was able to create client certificates to verify money transfers. I can’t do money transfers without this certificate that the bank provides. So…I clicked on a few links with firefox…and ooooops…ERROR…I couldn’t create a certificate with firefox. It couldn’t find the “proper” security devices. I tried with my firefox @ work where I have windows installed. Same error. Then it was time for Internet Explorer. click click click…and I had a perfect certificate. I couldn’t export it though to use it with firefox. So Eurobank forces me to use Windows and IE to make money transfers. I DID NOT SIGN THAT on the agreement. I don’t have the money to buy windows @ home, I use Linux, period. It’s tooooooooo bad that they have some nice security features on their site…like virtual keyboard for typing passwords with a mouse, so you can’t get “sniffed” but they can’t make their site usable for all users.
I am going to call them tomorrow to ask them what can I do, if there is any hidden “link” that works with firefox and can provide me a client certificate…else…I will start looking for a new bank with better e-banking methods that will fully support Linux…and transfer my money there. What’s the use of having my money in a place I can’t “access” them ?

That’s the error message I get (it’s in Greek, sorry):

e-banking

I’ve just updated WordPress to 1.5.1. It supposedly has a lot of bugfixes…we’ll see. Anyway…to the point..

Today I’ve finally activated my e-banking account. The process was quite long…I had to go to a bank, sign some papers, then wait 4 days for a courrier to come and give me my passwords. After doing that I had to activate the account via telephone. But wait…I didn’t have telephone-banking enabled…so another 2 day delay until my telephone-banking account was enabled, and then I could finally enable my e-banking. When I first logged in I saw a very stupid page warning me that I should click on “the yellow locker in Internet Explorer” to make sure I was inside the right domain, bank’s domain.
– Well I don’t have IE…what should I do now master ?
– Use the force and click “CONTINUE” young Luke….
I clicked once…clicked twice…opened the url in another Tab…another Window…nothing…the frame would not let me go. I guess it had a special IE thingie that was not satisfied by my Firefox’s “click”…
Anyway…I closed the window…and tried re-logging in. No stupid welcome screen. Yuppi!
Browsing around, it felt like working. But I can’t be sure unless I have to transfer money to another account…then I shall see if I have one more of those stupid “use IE only please” warnings. I have the bank documents I signed in front of me…I see nowhere any term forcing me to use IE or windows only. Is e-banking only for the “serious” windows users ?
Oh and what’s the name of the bank ? Eurobank!
From the other hand it’s the only bank in Greece that offers the creation of digital certificates in order to make money transfers, and not a bunch of passwords that you have to change all the time.
So the score is… 1-1

missed me ?

I am on easter vacations (it’s Greece here…orthodox easter is after the catholic one) in my home town since 4-5 days now…I am on dialup so bare with my absence. It’s so so hard to be “online” with dialup..I can’t even read my emails properly. I was used to adsl@home and my university’s line…and now I feel really weird. I got no tech/IT/whatever news from here. My only “news” is that the PortableFirefox I have inside my usb key is a life savior. I can go with it in any friend’s house or netcafe and have everything I want with me…including my passwords that I don’t even have to type 🙂

The only new thing I have found lately and it’s relatively handy is this: If you want to get rid of annoying error popups in firefox go to about:config, find browser.xul.error_pages.enabled and change its value to true. No more error popups, instead you get informative error html pages, I really liked it…