oki have the images from one day on the camera card and i need to copy them
this works!
ls /mnt/usb/dcim/100ncd80/ -ltr |grep 2009-10-20|perl -pe 's/.*(dsc.*)/$1/'
lists the images i want
so
cd /mnt/usb/dcim/100ncd80/
then
ls -ltr |grep 2009-10-20|perl -pe 's/.*(dsc.*)/$1/'|xargs -I {} cp {} /home/debianuser/conferences/conf20091118
this works well!
and here is the flip images script to rotate the images
cat bin/flip_journal.pl
#!/usr/bin/perl -w
use strict;
my $angle=shift;
my $dir=shift;
if (!($angle && $dir)) {print"missing either the angle or the directory"; die;}
opendir (IN,$dir);
my @list;
@list=readdir (IN);
foreach (@list)
{
next if ($_ eq '.' || $_ eq '..');
system ("convert -rotate $angle $_ $_ ");
}
Tuesday, November 17, 2009
Tuesday, November 10, 2009
sleep article on notebook vs sleepd
http://www.linux.com/archive/feature/55988
idea of using gnome-power-manager
now see the comment
Suspend assumes gnome/kde is running
Pressing the suspend-key will call /etc/acpi/sleebtn.sh, which uses acpi_fakekey to generate an event on /dev/input/event*, which is received by gnome-power-manager or similar applications.
To get suspend to work without gnome-power-manager,
replace the acpi_fakekey line in sleepbtn.sh with the line:/etc/acpi/sleep.sh sleep
now we need to compare to setting this up with the sleepd
idea of using gnome-power-manager
now see the comment
Suspend assumes gnome/kde is running
Pressing the suspend-key will call /etc/acpi/sleebtn.sh, which uses acpi_fakekey to generate an event on /dev/input/event*, which is received by gnome-power-manager or similar applications.
To get suspend to work without gnome-power-manager,
replace the acpi_fakekey line in sleepbtn.sh with the line:/etc/acpi/sleep.sh sleep
now we need to compare to setting this up with the sleepd
Saturday, October 31, 2009
more on .stumpwmrc
(in-package :stumpwm)
;;(setf *new-window-preferred-frame* :empty)
(setf *mouse-focus-policy* :sloppy)
;; really messed stuff up check this (set-prefix-key (kbd "F20")) ; F20 = start key i think?
(defcommand windowlist-pull (&optional (fmt *window-format*)) (:rest)
(if (null (group-windows (current-group)))
(message "No Managed Windows")
(let* ((group (current-group))
(window (select-window-from-menu (sort-windows group) fmt)))
(if window
(pull-window window)
(throw 'error :abort)))))
(define-key *root-map* (kbd "C-z") "windowlist-pull")
(defcommand conkeror () () (run-shell-command "conkeror"))
(define-key *root-map* (kbd "c") "conkeror")
(defcommand konsole () () (run-shell-command "konsole"))
(define-key *root-map* (kbd "x") "konsole")
(defcommand emacsa () () (run-shell-command "emacs"))
(define-key *root-map* (kbd "e") "emacsa")
(defcommand iceweasel () () (run-shell-command "iceweasel"))
(define-key *root-map* (kbd "i") "iceweasel")
;;(setf *new-window-preferred-frame* :empty)
(setf *mouse-focus-policy* :sloppy)
;; really messed stuff up check this (set-prefix-key (kbd "F20")) ; F20 = start key i think?
(defcommand windowlist-pull (&optional (fmt *window-format*)) (:rest)
(if (null (group-windows (current-group)))
(message "No Managed Windows")
(let* ((group (current-group))
(window (select-window-from-menu (sort-windows group) fmt)))
(if window
(pull-window window)
(throw 'error :abort)))))
(define-key *root-map* (kbd "C-z") "windowlist-pull")
(defcommand conkeror () () (run-shell-command "conkeror"))
(define-key *root-map* (kbd "c") "conkeror")
(defcommand konsole () () (run-shell-command "konsole"))
(define-key *root-map* (kbd "x") "konsole")
(defcommand emacsa () () (run-shell-command "emacs"))
(define-key *root-map* (kbd "e") "emacsa")
(defcommand iceweasel () () (run-shell-command "iceweasel"))
(define-key *root-map* (kbd "i") "iceweasel")
Wednesday, October 21, 2009
how to ssh through ssh to a secondary destination
sh -t -t dest.in.at.ion ssh sec.ondary.destina.ation
Sunday, October 18, 2009
stumpwmrc and conkerrc
.stumpwmrc
in-package :stumpwm)
;;(setf *new-window-preferred-frame* :empty)
(setf *mouse-focus-policy* :sloppy)
;; really messed stuff up check this (set-prefix-key (kbd "F20")) ; F20 = start key i think?
(defcommand windowlist-pull (&optional (fmt *window-format*)) (:rest)
(if (null (group-windows (current-group)))
(message "No Managed Windows")
(let* ((group (current-group))
(window (select-window-from-menu (sort-windows group) fmt)))
(if window
(pull-window window)
(throw 'error :abort)))))
(define-key *root-map* (kbd "C-z") "windowlist-pull")
------------------
while for the
.conkerorrc
let (home = get_home_directory()) {
home.append("home.html");
homepage = home.path;
}
define_key(content_buffer_normal_keymap, "b", "back");
define_key(content_buffer_normal_keymap, "C-b", "bookmark");
proxy_server_default = "localhost";
proxy_port_default = 8080;
function set_proxy_session (window, server, port) {
if (server == "N") {
session_pref ('network.proxy.type', 0); //direct connection
window.minibuffer.message ("Direction connection to the internet enabled for this session");
} else {
if (server == "") server = proxy_server_default;
if (port == "") port = proxy_port_default;
session_pref ('network.proxy.socks', server);
session_pref ('network.proxy.socks_port', port);
session_pref ('network.proxy.type', 1);
window.minibuffer.message ("All protocols using "+server+":"+port+" for this session");
}
}
interactive ("set-proxy-session", "set the proxy server for all protocols for this session only",
function (I) {
set_proxy_session (
I.window,
(yield I.minibuffer.read ($prompt = "server ["+proxy_server_default+"] or N: ")),
(yield I.minibuffer.read ($prompt = "port ["+proxy_port_default+"]: ")));
});
in-package :stumpwm)
;;(setf *new-window-preferred-frame* :empty)
(setf *mouse-focus-policy* :sloppy)
;; really messed stuff up check this (set-prefix-key (kbd "F20")) ; F20 = start key i think?
(defcommand windowlist-pull (&optional (fmt *window-format*)) (:rest)
(if (null (group-windows (current-group)))
(message "No Managed Windows")
(let* ((group (current-group))
(window (select-window-from-menu (sort-windows group) fmt)))
(if window
(pull-window window)
(throw 'error :abort)))))
(define-key *root-map* (kbd "C-z") "windowlist-pull")
------------------
while for the
.conkerorrc
let (home = get_home_directory()) {
home.append("home.html");
homepage = home.path;
}
define_key(content_buffer_normal_keymap, "b", "back");
define_key(content_buffer_normal_keymap, "C-b", "bookmark");
proxy_server_default = "localhost";
proxy_port_default = 8080;
function set_proxy_session (window, server, port) {
if (server == "N") {
session_pref ('network.proxy.type', 0); //direct connection
window.minibuffer.message ("Direction connection to the internet enabled for this session");
} else {
if (server == "") server = proxy_server_default;
if (port == "") port = proxy_port_default;
session_pref ('network.proxy.socks', server);
session_pref ('network.proxy.socks_port', port);
session_pref ('network.proxy.type', 1);
window.minibuffer.message ("All protocols using "+server+":"+port+" for this session");
}
}
interactive ("set-proxy-session", "set the proxy server for all protocols for this session only",
function (I) {
set_proxy_session (
I.window,
(yield I.minibuffer.read ($prompt = "server ["+proxy_server_default+"] or N: ")),
(yield I.minibuffer.read ($prompt = "port ["+proxy_port_default+"]: ")));
});
Sunday, September 13, 2009
create a fixed device for udev
i stole this from
http://www.debianhelp.co.uk/udev.htm
fconfig eth0
eth0 Link encap:Ethernet HWaddr 00:AB:CD:12:34:56
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:3
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:180 (180.0 b)
Interrupt:185 Base address:0xc000
In the above example HWaddr is your MAC address 00:AB:CD:12:34:56
Using udev
Create a new file in the udev rules directory, e.g. /etc/udev/rules.d/010_netinterfaces.rules
In it specify the renaming in the following way for each interface on its own line
KERNEL="oldnameprefix*", SYSFS{address}=="MACaddress", NAME="newname"
where the oldnameprefix is typically eth. Note that in the MAC address, the hexadecimal digits should be in lowercase, otherwise udev fails to match them properly with the network interface.
You have quite a bit of freedom in choosing the new name, We recommend to keep it short and without any spaces or weird characters though. You can e.g. specify a fixed eth0, eth1, eth2 for specific MAC addresses, or you can name them after their use, or anything really. Remember that some applications that poke on a low level may dislike them not being called in the normal fashion of eth0, eth1..etc
Examples using udev
Example: Three network interfaces being present on a computer, setting a fixed eth0, eth1 and eth2 as their names.
KERNEL=="eth*", SYSFS{address}=="00:12:34:fe:dc:ba", NAME="eth0"
KERNEL=="eth*", SYSFS{address}=="00:56:78:98:76:54", NAME="eth1"
KERNEL=="eth*", SYSFS{address}=="00:90:ab:32:10:fe", NAME="eth2"Example: Three network interfaces (one Intel, one NVIDIA, and one 3Com) being present on a computer, naming them after the manufacturer of the interfaces.
KERNEL=="eth*", SYSFS{address}=="00:12:34:fe:dc:ba", NAME="eth-intel"
KERNEL=="eth*", SYSFS{address}=="00:56:78:98:76:54", NAME="eth-nv"
KERNEL=="eth*", SYSFS{address}=="00:90:ab:32:10:fe", NAME="eth-3com"
Updating network configuration
If you named the interfaces in a different fashion as they were named before, the network configuration needs to be updated for the new interface device names to be used.
Edit the /etc/network/interfaces file, and change all instances of the old names to the new names.
E.g. if you previously used eth0 and have renamed it newname, you'd replace all instances of eth0 in that file with newname
But if you just put a fixed eth0, eth1, ... as their names, you just need to make sure the one you want to have as the primary network interface is set to the one you want in the file.
Example
Having renamed the existing eth0, eth1, and eth2 to eth-intel, eth-nv and eth-3com, choosing to use the eth-intel one as the primary interface
The /etc/network/interfaces file before changes
# The primary network interface
auto eth0
iface eth0 inet dhcp
# Currently unused network interfaces
iface eth1 inet dhcp
iface eth2 inet dhcpThe file after changes:
# The primary network interface
auto eth-intel
iface eth-intel inet dhcp
# Currently unused network interfaces
iface eth-nv inet dhcp
iface eth-3com inet dhcp
Reboot and verify your configuration
Reboot the computer and verify that the new network interface names are in use with e.g. ifconfig
#ifconfig newname
Where newname is the new interface name you specified. Repeat procedure for each one you renamed.
http://www.debianhelp.co.uk/udev.htm
fconfig eth0
eth0 Link encap:Ethernet HWaddr 00:AB:CD:12:34:56
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:3
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:180 (180.0 b)
Interrupt:185 Base address:0xc000
In the above example HWaddr is your MAC address 00:AB:CD:12:34:56
Using udev
Create a new file in the udev rules directory, e.g. /etc/udev/rules.d/010_netinterfaces.rules
In it specify the renaming in the following way for each interface on its own line
KERNEL="oldnameprefix*", SYSFS{address}=="MACaddress", NAME="newname"
where the oldnameprefix is typically eth. Note that in the MAC address, the hexadecimal digits should be in lowercase, otherwise udev fails to match them properly with the network interface.
You have quite a bit of freedom in choosing the new name, We recommend to keep it short and without any spaces or weird characters though. You can e.g. specify a fixed eth0, eth1, eth2 for specific MAC addresses, or you can name them after their use, or anything really. Remember that some applications that poke on a low level may dislike them not being called in the normal fashion of eth0, eth1..etc
Examples using udev
Example: Three network interfaces being present on a computer, setting a fixed eth0, eth1 and eth2 as their names.
KERNEL=="eth*", SYSFS{address}=="00:12:34:fe:dc:ba", NAME="eth0"
KERNEL=="eth*", SYSFS{address}=="00:56:78:98:76:54", NAME="eth1"
KERNEL=="eth*", SYSFS{address}=="00:90:ab:32:10:fe", NAME="eth2"Example: Three network interfaces (one Intel, one NVIDIA, and one 3Com) being present on a computer, naming them after the manufacturer of the interfaces.
KERNEL=="eth*", SYSFS{address}=="00:12:34:fe:dc:ba", NAME="eth-intel"
KERNEL=="eth*", SYSFS{address}=="00:56:78:98:76:54", NAME="eth-nv"
KERNEL=="eth*", SYSFS{address}=="00:90:ab:32:10:fe", NAME="eth-3com"
Updating network configuration
If you named the interfaces in a different fashion as they were named before, the network configuration needs to be updated for the new interface device names to be used.
Edit the /etc/network/interfaces file, and change all instances of the old names to the new names.
E.g. if you previously used eth0 and have renamed it newname, you'd replace all instances of eth0 in that file with newname
But if you just put a fixed eth0, eth1, ... as their names, you just need to make sure the one you want to have as the primary network interface is set to the one you want in the file.
Example
Having renamed the existing eth0, eth1, and eth2 to eth-intel, eth-nv and eth-3com, choosing to use the eth-intel one as the primary interface
The /etc/network/interfaces file before changes
# The primary network interface
auto eth0
iface eth0 inet dhcp
# Currently unused network interfaces
iface eth1 inet dhcp
iface eth2 inet dhcpThe file after changes:
# The primary network interface
auto eth-intel
iface eth-intel inet dhcp
# Currently unused network interfaces
iface eth-nv inet dhcp
iface eth-3com inet dhcp
Reboot and verify your configuration
Reboot the computer and verify that the new network interface names are in use with e.g. ifconfig
#ifconfig newname
Where newname is the new interface name you specified. Repeat procedure for each one you renamed.
Friday, September 11, 2009
debian apt-get dist-upgrade makes login as root fail
i tried many rescue attempts
using
Linux init=/bin/sh
mount -o remount,rw /
passwd
but rejected new passwd ...
so then i found this
passwd -d root
passwd root
enter passwd twice and it works
good.
i found this at
http://openplug.org/plugforum/index.php?topic=110.0
great rescue....
using
Linux init=/bin/sh
mount -o remount,rw /
passwd
but rejected new passwd ...
so then i found this
passwd -d root
passwd root
enter passwd twice and it works
good.
i found this at
http://openplug.org/plugforum/index.php?topic=110.0
great rescue....
vpnc: receiving packet message too long
check the router eth1 it has mtu set too small to 576 need to reset it to 1500
so go to
/etc/rc.local
add line
ifconfig eth0 mtu 1500
and done
hat tip:
http://metauser.net/2008/11/15/vpnc-receiving-packet-message-too-long/
so go to
/etc/rc.local
add line
ifconfig eth0 mtu 1500
and done
hat tip:
http://metauser.net/2008/11/15/vpnc-receiving-packet-message-too-long/
Saturday, August 1, 2009
run X apps as root
su
password
cd
rm .Xauthority
ln -s /home/user_name/.Xauthority .Xauthority
that should do it.
there are other ways as well...
password
cd
rm .Xauthority
ln -s /home/user_name/.Xauthority .Xauthority
that should do it.
there are other ways as well...
Friday, June 12, 2009
postgresql backup information
see http://linux-addiction.blogspot.com/2009/02/how-to-backup-and-restore-postgresql.html
How To Backup and Restore PostgreSQL Database Using pg_dump and psql
pg_dump is an effective tool to backup postgres database. It creates a *.sql file with CREATE TABLE, ALTER TABLE, and COPY SQL statements of source database. To restore these dumps psql command is enough.
Using pg_dump, you can backup a local database and restore it on a remote database at the same time, using a single command. In this article, let us review several practical examples on how to use pg_dump to backup and restore.
For the impatient, here is the quick snippet of how backup and restore postgres database using pg_dump and psql:
Backup: $ pg_dump -U {user-name} {source_db} -f {dumpfilename.sql}
Restore: $ psql -U {user-name} -d {desintation_db}-f {dumpfilename.sql}
How To Backup Postgres Database
1. Backup a single postgres database
This example will backup erp database that belongs to user geekstuff, to the file mydb.sql
$ pg_dump -U geekstuff erp -f mydb.sql
It prompts for password, after authentication mydb.sql got created with create table, alter table and copy commands for all the tables in the erp database. Following is a partial output of mydb.sql showing the dump information of employee_details table.
--
-- Name: employee_details; Type: TABLE; Schema: public; Owner: geekstuff; Tablespace:
--
CREATE TABLE employee_details (
employee_name character varying(100),
emp_id integer NOT NULL,
designation character varying(50),
comments text
);
ALTER TABLE public.employee_details OWNER TO geekstuff;
--
-- Data for Name: employee_details; Type: TABLE DATA; Schema: public; Owner: geekstuff
--
COPY employee_details (employee_name, emp_id, designation, comments) FROM stdin;
geekstuff 1001 trainer
ramesh 1002 author
sathiya 1003 reader
\.
--
-- Name: employee_details_pkey; Type: CONSTRAINT; Schema: public; Owner: geekstuff; Tablespace:
--
ALTER TABLE ONLY employee_details
ADD CONSTRAINT employee_details_pkey PRIMARY KEY (emp_id);
2. Backup all postgres databases
To backup all databases, list out all the available databases as shown below.
Login as postgres / psql user:
$ su postgres
List the databases:
$ psql -l
List of databases
Name | Owner | Encoding
-----------+-----------+----------
article | sathiya | UTF8
backup | postgres | UTF8
erp | geekstuff | UTF8
geeker | sathiya | UTF8
Backup all postgres databases using pg_dumpall:
You can backup all the databases using pg_dumpall command.
$ pg_dumpall > all.sql
Verify the backup:
Verify whether all the databases are backed up,
$ grep "^[\]connect” all.sql
\connect article
\connect backup
\connect erp
\connect geeker
3. Backup a specific postgres table
$ pg_dump --table products -U geekstuff article -f onlytable.sql
To backup a specific table, use the –table TABLENAME option in the pg_dump command. If there are same table names in different schema then use the –schema SCHEMANAME option.
How To Restore Postgres Database
1. Restore a postgres database
$ psql -U erp -d erp_devel -f mydb.sql
This restores the dumped database to the erp_devel database.
Restore error messages
While restoring, there may be following errors and warning, which can be ignored.
psql:mydb.sql:13: ERROR: must be owner of schema public
psql:mydb.sql:34: ERROR: must be member of role "geekstuff"
psql:mydb.sql:59: WARNING: no privileges could be revoked
psql:mydb.sql:60: WARNING: no privileges could be revoked
psql:mydb.sql:61: WARNING: no privileges were granted
psql:mydb.sql:62: WARNING: no privileges were granted
2. Backup a local postgres database and restore to remote server using single command:
$ pg_dump dbname | psql -h hostname dbname
The above dumps the local database, and extracts it at the given hostname.
3. Restore all the postgres databases
$ su postgres
$ psql -f alldb.sql
4. Restore a single postgres table
The following psql command installs the patientinfo table in the database pacs.
$ psql -f patientinfo.sql pacs
How To Backup and Restore PostgreSQL Database Using pg_dump and psql
pg_dump is an effective tool to backup postgres database. It creates a *.sql file with CREATE TABLE, ALTER TABLE, and COPY SQL statements of source database. To restore these dumps psql command is enough.
Using pg_dump, you can backup a local database and restore it on a remote database at the same time, using a single command. In this article, let us review several practical examples on how to use pg_dump to backup and restore.
For the impatient, here is the quick snippet of how backup and restore postgres database using pg_dump and psql:
Backup: $ pg_dump -U {user-name} {source_db} -f {dumpfilename.sql}
Restore: $ psql -U {user-name} -d {desintation_db}-f {dumpfilename.sql}
How To Backup Postgres Database
1. Backup a single postgres database
This example will backup erp database that belongs to user geekstuff, to the file mydb.sql
$ pg_dump -U geekstuff erp -f mydb.sql
It prompts for password, after authentication mydb.sql got created with create table, alter table and copy commands for all the tables in the erp database. Following is a partial output of mydb.sql showing the dump information of employee_details table.
--
-- Name: employee_details; Type: TABLE; Schema: public; Owner: geekstuff; Tablespace:
--
CREATE TABLE employee_details (
employee_name character varying(100),
emp_id integer NOT NULL,
designation character varying(50),
comments text
);
ALTER TABLE public.employee_details OWNER TO geekstuff;
--
-- Data for Name: employee_details; Type: TABLE DATA; Schema: public; Owner: geekstuff
--
COPY employee_details (employee_name, emp_id, designation, comments) FROM stdin;
geekstuff 1001 trainer
ramesh 1002 author
sathiya 1003 reader
\.
--
-- Name: employee_details_pkey; Type: CONSTRAINT; Schema: public; Owner: geekstuff; Tablespace:
--
ALTER TABLE ONLY employee_details
ADD CONSTRAINT employee_details_pkey PRIMARY KEY (emp_id);
2. Backup all postgres databases
To backup all databases, list out all the available databases as shown below.
Login as postgres / psql user:
$ su postgres
List the databases:
$ psql -l
List of databases
Name | Owner | Encoding
-----------+-----------+----------
article | sathiya | UTF8
backup | postgres | UTF8
erp | geekstuff | UTF8
geeker | sathiya | UTF8
Backup all postgres databases using pg_dumpall:
You can backup all the databases using pg_dumpall command.
$ pg_dumpall > all.sql
Verify the backup:
Verify whether all the databases are backed up,
$ grep "^[\]connect” all.sql
\connect article
\connect backup
\connect erp
\connect geeker
3. Backup a specific postgres table
$ pg_dump --table products -U geekstuff article -f onlytable.sql
To backup a specific table, use the –table TABLENAME option in the pg_dump command. If there are same table names in different schema then use the –schema SCHEMANAME option.
How To Restore Postgres Database
1. Restore a postgres database
$ psql -U erp -d erp_devel -f mydb.sql
This restores the dumped database to the erp_devel database.
Restore error messages
While restoring, there may be following errors and warning, which can be ignored.
psql:mydb.sql:13: ERROR: must be owner of schema public
psql:mydb.sql:34: ERROR: must be member of role "geekstuff"
psql:mydb.sql:59: WARNING: no privileges could be revoked
psql:mydb.sql:60: WARNING: no privileges could be revoked
psql:mydb.sql:61: WARNING: no privileges were granted
psql:mydb.sql:62: WARNING: no privileges were granted
2. Backup a local postgres database and restore to remote server using single command:
$ pg_dump dbname | psql -h hostname dbname
The above dumps the local database, and extracts it at the given hostname.
3. Restore all the postgres databases
$ su postgres
$ psql -f alldb.sql
4. Restore a single postgres table
The following psql command installs the patientinfo table in the database pacs.
$ psql -f patientinfo.sql pacs
Thursday, May 7, 2009
repair usb drive
nice article in linux-journal
http://www.linuxjournal.com/article/8366
How a Corrupted USB Drive Was Saved by GNU/Linux
June 14th, 2005 by Collin Park in
* HOWTOs
Would SUSE and fsck be able to recover the data in a usable way?
Average:
Cancel rating
Poor
Okay
Good
Great
Awesome
Your rating: None Average: 5 (15 votes)
My friend's brother had a 512MB Lexar Media Jumpdrive Pro USB drive that became corrupted after using it with Windows 2000. His IT department was able to get back some but not all of the file contents, but without any file names. On his own, he tried some recovery utilities, but all failed. Using a typical Linux distro--in this case SuSE 8.0--however, it wasn't hard to recover almost all of the data from the drive along with the filenames and to burn a CD-ROM of the contents.
USB Drive Ruined by Windows
Here's what I heard about the data loss:
Date: Sun, 1 Aug 2004 17:06:03 -0700
Subject: USB
... My USB drive is a
Lexar Media USB Jumpdrive Pro 2.0 (512 MB). I was working
on it in a computer with Windows 2000 and logged off before
ejecting the drive. Next time when I tried to use it,
it showed up as a Removable drive rather than the usual
Lexar Media drive and when I tried to open it, it said the
drive was not formatted; and under Properties, 0 bytes free
and used space and file system "RAW"
According to Lexar tech support, there is a bug with
Windows 2000 (that MS never bothered to fix) and can corrupt
the drive when it is removed without proper eject. They
recommend EasyRecovery Pro for data recovery which did
allow me to recover some files (> 500) using their RAW data
recovery program (all other tool failed because usually
said "no recognizable file on disc"). Unfortunately,
all the file names are lost and some files are gone.
The big questions was "can Linux read the drive?" A Web search of "linux usb jumpdrive pro" gave me hope that my kernel, 2.4.18 on SuSE 8.0, would recognize the drive in question. So, as root, I typed:
# tail -f /var/log/messages
and plugged the drive into a USB socket. Here's what appeared; I removed "Aug 5 01:32:15 linux kernel:" from each line below):
usb.c: registered new driver usb-storage
scsi0 : SCSI emulation for USB Mass Storage devices
usb-uhci.c: interrupt, status 3, frame# 1313
Vendor: LEXAR Model: JUMPDRIVE PRO Rev: 0
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 1001952 512-byte hdwr sectors (513 MB)
sda: Write Protect is off
sda: sda1
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 4
USB Mass Storage support registered.
also according to one of the responders can try
http://www.brzitwa.de/mb/gpart/
http://www.linuxjournal.com/article/8366
How a Corrupted USB Drive Was Saved by GNU/Linux
June 14th, 2005 by Collin Park in
* HOWTOs
Would SUSE and fsck be able to recover the data in a usable way?
Average:
Cancel rating
Poor
Okay
Good
Great
Awesome
Your rating: None Average: 5 (15 votes)
My friend's brother had a 512MB Lexar Media Jumpdrive Pro USB drive that became corrupted after using it with Windows 2000. His IT department was able to get back some but not all of the file contents, but without any file names. On his own, he tried some recovery utilities, but all failed. Using a typical Linux distro--in this case SuSE 8.0--however, it wasn't hard to recover almost all of the data from the drive along with the filenames and to burn a CD-ROM of the contents.
USB Drive Ruined by Windows
Here's what I heard about the data loss:
Date: Sun, 1 Aug 2004 17:06:03 -0700
Subject: USB
... My USB drive is a
Lexar Media USB Jumpdrive Pro 2.0 (512 MB). I was working
on it in a computer with Windows 2000 and logged off before
ejecting the drive. Next time when I tried to use it,
it showed up as a Removable drive rather than the usual
Lexar Media drive and when I tried to open it, it said the
drive was not formatted; and under Properties, 0 bytes free
and used space and file system "RAW"
According to Lexar tech support, there is a bug with
Windows 2000 (that MS never bothered to fix) and can corrupt
the drive when it is removed without proper eject. They
recommend EasyRecovery Pro for data recovery which did
allow me to recover some files (> 500) using their RAW data
recovery program (all other tool failed because usually
said "no recognizable file on disc"). Unfortunately,
all the file names are lost and some files are gone.
The big questions was "can Linux read the drive?" A Web search of "linux usb jumpdrive pro" gave me hope that my kernel, 2.4.18 on SuSE 8.0, would recognize the drive in question. So, as root, I typed:
# tail -f /var/log/messages
and plugged the drive into a USB socket. Here's what appeared; I removed "Aug 5 01:32:15 linux kernel:" from each line below):
usb.c: registered new driver usb-storage
scsi0 : SCSI emulation for USB Mass Storage devices
usb-uhci.c: interrupt, status 3, frame# 1313
Vendor: LEXAR Model: JUMPDRIVE PRO Rev: 0
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 1001952 512-byte hdwr sectors (513 MB)
sda: Write Protect is off
sda: sda1
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 4
USB Mass Storage support registered.
also according to one of the responders can try
http://www.brzitwa.de/mb/gpart/
Friday, May 1, 2009
MPX merged into X!! multi user mouse ideas
would like to use multiple mice at once
MPX for X gives multiple input devices multipointer x server
can convert already created applications to multipoint
http://www.neowin.net/forum/index.php?s=32dde4535c5ff99aacf474b8db4d4a54&showtopic=574028&pid=588710663&st=0entry588710663
now look at this
http://wearables.unisa.edu.au/mpx/?q=node/144
http://lists.freedesktop.org/archives/xorg/2008-May/035641.html
For those of you watching xorg-commits, you may have noticed that MPX has been
merged into master [1].
The client-side libraries and protocol headers have been merged quietly last
week already, this time is just the xserver itself.
A change in the previously proposed schedule [2]: the XKB rework didn't make
it. With the recent SSL issue and other workloads, Daniel wasn't able to get
it ready in time. We agreed on merging MPX without it, as it should not affect
XKB much anyway.
A number of changes went in since the announce, the most important being the
return of input device cordinate scaling. Tablets can thus be used. Thanks to
Magnus Vigerloef for his help on this matter.
The input ABI has been bumped and all the input drivers on fdo have been
updated to compile with the new API. You will need to get the latest version
however. I don't think the ABI will remain stable until the next release, but
I figured input modules not loading encourages people to fetch the latest
release rather than complaining about them not compiling anymore.
The video ABI has not been bumped yet, but you _must recompile_ your video
driver. No API changes, a recompile is enough.
As previously mentioned, existing setups should not be affected and anything
that changes is most likely a bug. Unless you create additional cursors/foci,
in which case the border between bug and broken UI paradigm is somewhat
blurry.
For the impatient, run the following commands:
Update xorg/app/xinput to the most recent version.
xinput --list --short
xinput --create-master "foobar"
xinput --reattach "MyMouse" "foobar pointer"
xinput --reattach "MyKeyboard" "foobar keyboard"
It is at this point you have a second set of devices that work independently.
It is at this point that you may realise that neither GNOME, KDE, nor any
other environment actually works decently with multiple devices. So start
fixing them right now.
To go back to a standard setup:
xinput --reattach "MyMouse" "Virtual core pointer"
xinput --reattach "MyKeyboard" "Virtual core keyboard"
xinput --remove-master "foobar pointer"
Have fun. Input bugs that result from the MPX merge can be assigned to me.
So long, and thanks for all the mice.
Cheers,
Peter
outrageous!
MPX for X gives multiple input devices multipointer x server
can convert already created applications to multipoint
http://www.neowin.net/forum/index.php?s=32dde4535c5ff99aacf474b8db4d4a54&showtopic=574028&pid=588710663&st=0entry588710663
now look at this
http://wearables.unisa.edu.au/mpx/?q=node/144
http://lists.freedesktop.org/archives/xorg/2008-May/035641.html
For those of you watching xorg-commits, you may have noticed that MPX has been
merged into master [1].
The client-side libraries and protocol headers have been merged quietly last
week already, this time is just the xserver itself.
A change in the previously proposed schedule [2]: the XKB rework didn't make
it. With the recent SSL issue and other workloads, Daniel wasn't able to get
it ready in time. We agreed on merging MPX without it, as it should not affect
XKB much anyway.
A number of changes went in since the announce, the most important being the
return of input device cordinate scaling. Tablets can thus be used. Thanks to
Magnus Vigerloef for his help on this matter.
The input ABI has been bumped and all the input drivers on fdo have been
updated to compile with the new API. You will need to get the latest version
however. I don't think the ABI will remain stable until the next release, but
I figured input modules not loading encourages people to fetch the latest
release rather than complaining about them not compiling anymore.
The video ABI has not been bumped yet, but you _must recompile_ your video
driver. No API changes, a recompile is enough.
As previously mentioned, existing setups should not be affected and anything
that changes is most likely a bug. Unless you create additional cursors/foci,
in which case the border between bug and broken UI paradigm is somewhat
blurry.
For the impatient, run the following commands:
Update xorg/app/xinput to the most recent version.
xinput --list --short
xinput --create-master "foobar"
xinput --reattach "MyMouse" "foobar pointer"
xinput --reattach "MyKeyboard" "foobar keyboard"
It is at this point you have a second set of devices that work independently.
It is at this point that you may realise that neither GNOME, KDE, nor any
other environment actually works decently with multiple devices. So start
fixing them right now.
To go back to a standard setup:
xinput --reattach "MyMouse" "Virtual core pointer"
xinput --reattach "MyKeyboard" "Virtual core keyboard"
xinput --remove-master "foobar pointer"
Have fun. Input bugs that result from the MPX merge can be assigned to me.
So long, and thanks for all the mice.
Cheers,
Peter
outrageous!
Saturday, March 21, 2009
combine and read gnome developer mails
i like to grab the emails from the sites and read them offline using mutt -f all-mails.txt
well i download the tarballs and then combine into one big file using a perl script.
then i read with mutt -f.
sometimes there is a problem they replaced me@address.com by me at address.com which messes us
with the reading by mutt. so i do alt-x replace string _at_ by @ in emacs (_=space) and i am done.
now it shows up in mutt.
well i download the tarballs and then combine into one big file using a perl script.
then i read with mutt -f.
sometimes there is a problem they replaced me@address.com by me at address.com which messes us
with the reading by mutt. so i do alt-x replace string _at_ by @ in emacs (_=space) and i am done.
now it shows up in mutt.
Sunday, March 15, 2009
ssh with no key for backup purposes
may use rsa or dsa
There are those of us that do a lot of ssh during the course of a day. I know I do quite a bit for accessing my files from my office. In any event you’ll probably want to setup public key authentication which allows you to login via ssh without a password.
Of course this adds a level of convenience for you, but could be considered less-secure. While its difficult to spoof an rsa/dsa encryption key (probably more difficult than a simple password) anyone that has access to your machine would be able to access the remote machines via this authenticated key.
There are a few quick steps for setting this up that I’ll outline below.
First you’ll need to generate your local public key. This is the public end of a local public / private pair that you’ll share with the remote machine to identify you.
ssh-keygen -t rsa (on your local machine)
Second you’ll need to copy this key to the remote machine using a command such as:
scp ~/.ssh/id_rsa.pub user@yourserver.com:
Lastly, log into the remote machine via ssh (using your password for the last time!) and use this command to add the newly generated key to the list of authenticated keys:
cat id_rsa.pub >> .ssh/authorized_keys
You’ll also probably want to delete the original key as well.
rm id_rsa.pub
At this point a copy of your key is now stored on the remote machine as an authorized keys and any ssh connection coming from the local machine will match that key and connect with the key authentication instead of a password. So nice.
…just remember that anyone with access to your machine will now have this access as well. Definitely keep this in mind if you’re using any kind of a public machine.
There are those of us that do a lot of ssh during the course of a day. I know I do quite a bit for accessing my files from my office. In any event you’ll probably want to setup public key authentication which allows you to login via ssh without a password.
Of course this adds a level of convenience for you, but could be considered less-secure. While its difficult to spoof an rsa/dsa encryption key (probably more difficult than a simple password) anyone that has access to your machine would be able to access the remote machines via this authenticated key.
There are a few quick steps for setting this up that I’ll outline below.
First you’ll need to generate your local public key. This is the public end of a local public / private pair that you’ll share with the remote machine to identify you.
ssh-keygen -t rsa (on your local machine)
Second you’ll need to copy this key to the remote machine using a command such as:
scp ~/.ssh/id_rsa.pub user@yourserver.com:
Lastly, log into the remote machine via ssh (using your password for the last time!) and use this command to add the newly generated key to the list of authenticated keys:
cat id_rsa.pub >> .ssh/authorized_keys
You’ll also probably want to delete the original key as well.
rm id_rsa.pub
At this point a copy of your key is now stored on the remote machine as an authorized keys and any ssh connection coming from the local machine will match that key and connect with the key authentication instead of a password. So nice.
…just remember that anyone with access to your machine will now have this access as well. Definitely keep this in mind if you’re using any kind of a public machine.
Thursday, March 12, 2009
perl objects
how to do it easily?
class::accessor
moose
class::struct
class::methodmaker
ideas for distrbution
hxs
http://mathforum.org/~ken/perl_modules.html
module::build
look at graham barr tutorial article on glade and gtk2
class::accessor
moose
class::struct
class::methodmaker
ideas for distrbution
hxs
http://mathforum.org/~ken/perl_modules.html
module::build
look at graham barr tutorial article on glade and gtk2
Friday, February 6, 2009
where are the install scripts for packages kept?
/var/lib/dpkg/info
Look for.preinst
and there they are!
Look for
and there they are!
Sunday, February 1, 2009
Wednesday, January 28, 2009
emacs change from Unix to Dos endings?
How to change file line endings between Mac/Dos/Unix?
Open the file, then do “Alt+x set-buffer-file-coding-system” (Ctrl+x Enter f). Give it a value of mac, dos, unix. Then, when you save the file, it'll be saved with the proper encoding for newlines.
alternatively
ctl-x return f then dos
Note: Unixes (including Linuxes and Mac OS X) uses LF (ascii 10; line feed) for newline. Mac OS Classic uses CR (ascii 13; carriage return) for newline. (Mac OS X prefers LF but accepts CR too) Windows uses CR followed by LF ("\r\n") for its newline char. See wikipedia newline for detail.
To do it batch on a list of files, use the following lisp code:
(defun to-unix-eol (fpath)
"Change file's line ending to unix convention."
(let (mybuffer)
(setq mybuffer (find-file fpath))
(set-buffer-file-coding-system 'unix) ; or 'mac or 'dos
(save-buffer)
(kill-buffer mybuffer)
)
)
(mapc 'to-unix-eol
(list
"~/whatever/myfile1"
"~/whatever/myfile2"
"~/whatever/myfile3"
; ...
)
)
If you want the function to work on marked files in dired, then use the following code:
(defun dired-2unix-marked-files ()
"Change to unix line ending for marked (or next arg) files."
(interactive)
(mapc 'to-unix-eol (dired-get-marked-files))
)
Select the code and do “Alt+x eval-region”, then “Alt+x dired”, then press “m” to mark the files you want, then do “Alt+x dired-dos2unix-marked-files”.
hat tip:
http://xahlee.org/emacs/emacs_adv_tips.html
Open the file, then do “Alt+x set-buffer-file-coding-system” (Ctrl+x Enter f). Give it a value of mac, dos, unix. Then, when you save the file, it'll be saved with the proper encoding for newlines.
alternatively
ctl-x return f then dos
Note: Unixes (including Linuxes and Mac OS X) uses LF (ascii 10; line feed) for newline. Mac OS Classic uses CR (ascii 13; carriage return) for newline. (Mac OS X prefers LF but accepts CR too) Windows uses CR followed by LF ("\r\n") for its newline char. See wikipedia newline for detail.
To do it batch on a list of files, use the following lisp code:
(defun to-unix-eol (fpath)
"Change file's line ending to unix convention."
(let (mybuffer)
(setq mybuffer (find-file fpath))
(set-buffer-file-coding-system 'unix) ; or 'mac or 'dos
(save-buffer)
(kill-buffer mybuffer)
)
)
(mapc 'to-unix-eol
(list
"~/whatever/myfile1"
"~/whatever/myfile2"
"~/whatever/myfile3"
; ...
)
)
If you want the function to work on marked files in dired, then use the following code:
(defun dired-2unix-marked-files ()
"Change to unix line ending for marked (or next arg) files."
(interactive)
(mapc 'to-unix-eol (dired-get-marked-files))
)
Select the code and do “Alt+x eval-region”, then “Alt+x dired”, then press “m” to mark the files you want, then do “Alt+x dired-dos2unix-marked-files”.
hat tip:
http://xahlee.org/emacs/emacs_adv_tips.html
Sunday, January 25, 2009
autohotkey for linux
- autohotkey on windows allows easy scripting and control of hotkeys.
- zenity - display GTK+ dialogs may be useful for quick building a quick dialog for script
- xwininfo, xprop to grab info on a window
- wmctrl -l gets list of windows
xwininfo and xprop which give you the window id and the contents of the title.
Q what about the contents of the status bar at the bottom?
q what about capturing keys before the application?
look and read about khotkeys
http://bugs.kde.org/show_bug.cgi?id=165441
seems to be buggy lately
please read this article
http://www.linuxformat.co.uk/wiki/index.php/Desktop_scripting_with_DCOP
what about capture and script mouse movement and position?
seems to be part of khotkeys capability
list of existing hotkeys
http://www.clug.ca/node/225
- http://ubuntuforums.org/showthread.php?t=893506
Re: Script to take screenshot of a specific window
I messed around a bit more and may have addressed some of your concerns... here's the new code:
wmctrl -a $window bring the focus to the window which you've named (and that's another question I had-- you said the title was dynamic, but is part of it static enough to where you could include it in your code. That is, instead of reading standard input, which would actually require you to do something, could you do...
I know you had something like that in your code above, but I wasn't sure if you wanted to name the window at the point at which you take the screenshot, or just plop part of the name in the code. Either way...)
I had to put the focus on the given window because of the issue you raised of different workspaces-- if the window of which you're taking a screenshot is in your current workspace, this code doesn't need to be there. wmctrl can get the window ID just fine and import can use the window ID to take the screenshot of the appropriate window.
However, if you're in workspace A and the window is in workspace B, you'll get this error, as we saw before:
I'm sure there's a way to fix this, so I'll keep searching.
gconftool, with the given parameters, sets foo.jpg as the background.
So the only hiccup I've run across is that wmctrl puts the focus on the screenshot window when it's doing it's work. I don't know if you're working in an environment where that shift of focus matters, but it would certainly be nice to let the script do its work in the background, eh?
If you want to do this at a given time, I bet including the script in your crontab would be the easiest way.
Code:
#!/bin/sh
echo "Enter the name of the window of which you'd like to take a screenshot:"
read window
wmctrl -a $window
window_id=`wmctrl -l | grep -i $window | awk '{print $1}'`
import -window $window_id -crop 1390x960+5+80 foo.jpg
gconftool -t string -s /desktop/gnome/background/picture_filename `pwd`/foo.jpg
Code:
window_id=`wmctrl -l | grep -i| awk '{print $1}'`
I had to put the focus on the given window because of the issue you raised of different workspaces-- if the window of which you're taking a screenshot is in your current workspace, this code doesn't need to be there. wmctrl can get the window ID just fine and import can use the window ID to take the screenshot of the appropriate window.
However, if you're in workspace A and the window is in workspace B, you'll get this error, as we saw before:
Code:
import: unable to read X window image `0x022000d9': Resource temporarily unavailable.
gconftool, with the given parameters, sets foo.jpg as the background.
So the only hiccup I've run across is that wmctrl puts the focus on the screenshot window when it's doing it's work. I don't know if you're working in an environment where that shift of focus matters, but it would certainly be nice to let the script do its work in the background, eh?
If you want to do this at a given time, I bet including the script in your crontab would be the easiest way.
Re: Script to take screenshot of a specific window
I did some searching and came up with something that may work for you:
First, you have to install imagemagick from the repositories, which contains a command called import, which allows you to take a picture of any active window and save it as a file. You may want to read the man page on import for more information. So to start, open a Terminal and type this:
You'll also need to use a program called xwininfo, which gives you a bunch of information about a given window, including what's called a "window ID". This is helpful in determining the window of which we're taking a screenshot. xwininfo should already be installed on your system.
I dashed up this shell script, which doesn't work completely. It's a start, though. Please note that I'm quite new to shell scripting and there are other, more experienced people here who may be of more help.
I mostly pieced this together from stuff I found from Google...
Line 1: #!/bin/sh
Line 2: Prints "Enter the name of the window:"... just prompts the user for the name of the window
Line 3: Reads standard input and stores it in a variable called "window"
Line 4: Defines a variable called window_id -- basically, you can execute xwininfo with the name parameter and follow it by the name of the window (which in our case should be the variable we just created, $window); pass the output of that to an awk command (I've never used awk, but I think this gets the fourth element of an array, which prints a column of data from the output of xwininfo -name $window, and which contains our window ID; pass that output again to grep and look for the string '0x' (our window ID, by default, is a hexadecimal value, and should always begin with a 'Ox').
Line 5: The import command imports the window with the window ID window_id and stores it in a file called $window.jpg (hence, if you take a screenshot of Calculator, the file should be called Calculator.jpg.
Like I said before, this doesn't work completely, but I thought I'd post it anyway. I've gotten it to work for small programs like Calculator, Dictionary, Atomix... nothing like Firefox, gedit, etc. . If you try to do it for larger programs, you'll actually get an error of the following sort:
I think this arises from the fact that these programs actually yield multiple window IDs:
The script should also probably check user input in some way, and apply some sort of conditional for the case when the window name isn't valid:
So yeah, good luck! I'll try to work on the problem, too, but this should get you started. I've included all of the code below step-by-step, in case it helps:
Now open your favorite text editor and insert the following code:
Now, just make sure your permissions are ok and you should be good to go...
First, you have to install imagemagick from the repositories, which contains a command called import, which allows you to take a picture of any active window and save it as a file. You may want to read the man page on import for more information. So to start, open a Terminal and type this:
Code:
sudo apt-get install imagemagick
man import
I dashed up this shell script, which doesn't work completely. It's a start, though. Please note that I'm quite new to shell scripting and there are other, more experienced people here who may be of more help.
Code:
#!/bin/sh
echo "Enter the name of the window:"
read window
window_id=`xwininfo -name $window | awk '{print $4}' | grep -i 0x`
import -window $window_id $window.jpg
Line 1: #!/bin/sh
Line 2: Prints "Enter the name of the window:"... just prompts the user for the name of the window
Line 3: Reads standard input and stores it in a variable called "window"
Line 4: Defines a variable called window_id -- basically, you can execute xwininfo with the name parameter and follow it by the name of the window (which in our case should be the variable we just created, $window); pass the output of that to an awk command (I've never used awk, but I think this gets the fourth element of an array, which prints a column of data from the output of xwininfo -name $window, and which contains our window ID; pass that output again to grep and look for the string '0x' (our window ID, by default, is a hexadecimal value, and should always begin with a 'Ox').
Line 5: The import command imports the window with the window ID window_id and stores it in a file called $window.jpg (hence, if you take a screenshot of Calculator, the file should be called Calculator.jpg.
Like I said before, this doesn't work completely, but I thought I'd post it anyway. I've gotten it to work for small programs like Calculator, Dictionary, Atomix... nothing like Firefox, gedit, etc. . If you try to do it for larger programs, you'll actually get an error of the following sort:
Code:
import: unable to read X window image `0x3200efb': Resource temporarily unavailable.
Code:
dill@LAMP:~$ xwininfo -tree -root | grep gedit | awk '{print $1}'
0x3000071
0x3000003
0x3000001
0x300001e
Code:
dill@LAMP:~$ ./test.sh
Enter the name of the window:
abc
xwininfo: error: No window with name abc exists!
import: missing an image filename `abc.jpg'.
Code:
sudo apt-get install imagemagick
touch window_capture.sh
Code:
#!/bin/sh
echo "Enter the name of the window:"
read window
window_id=`xwininfo -name $window | awk '{print $4}' | grep -i 0x`
import -window $window_id $window.jpg
Code:
chmod 755 window_capture.sh
./window_capture.sh
Thanks for all the help. I was having issues with trying to get the window id based on title because the the window I am interested in has a dynamic title. I could not find a way to use wildcards for the title using xwininfo.
I did find wmctrl which will generate a list of open windows. So, I used the following to get the ID.
I used this with import (thanks Dill) to get the screenshot and crop it accordingly.
Unfortunately, I've hit another wall which I doubt can be avoided.
What I am trying to do is take a screenshot of a window periodically and then make that image my desktop background. Unfortunately, the window must be on the current workspace for this to work which defeats the purpose of what I am trying to accomplish. Perhaps there is an app available that emulates KDE's "Use program for background" function?
I did find wmctrl which will generate a list of open windows. So, I used the following to get the ID.
Code:
sWinId=`wmctrl -l | grep <partial_title> | awk '{print $1}'`
Code:
import -window $sWinId -crop 1390x960+5+80 <filename>
What I am trying to do is take a screenshot of a window periodically and then make that image my desktop background. Unfortunately, the window must be on the current workspace for this to work which defeats the purpose of what I am trying to accomplish. Perhaps there is an app available that emulates KDE's "Use program for background" function?
Subscribe to:
Posts (Atom)