When driving on the road, how should distance be displayed on sign posts ?
If you are driving in a european country with a national speed limit of 60 mph (approx 100 kph), the answer is miles. Unfortunately, the European Union got this one wrong.
The reason ?
Speed (v), distance(d) and time(t) are all related by the following formula:
d = v*t
In most countries, the national speed limit is 60mph (approx 100 kph) and in all countries there are 60 minutes in 1 hour.
This means if you are driving at the national speed limit (60mph) you will do in 1 hour (60 mins) a total distance of 60 miles.
If you see a sign that says distance = 20 miles you can use t = 20/60, which is 1/3 of an hour, which is 20 mins. Or, if you don't like the maths, the easy way to remember this is:
At 60 mph, you do:
1 mile in 1 minute,
10 miles in 10 minutes,
20 miles in 20 minutes
30 miles in 30 minutes etc.
In other words, there is a one to one correlation between distance and time. The reason why the maths is so simple is that there are 60 minutes in 1 hour. Miles are not metric, but neither is time.
Now, say you change from using miles to kilometeres. It's easy to change distance and speed to be metric, but time cannot be changed to metric. This means when you see a sign saying distance = 20 kilometers, you can't immediately see how long it is going to take to get there at 60mph (or 100 kph).
Lets metricise our table above:
At 100 kph, you do:
1 km in 0.6 minutes,
10 km in 6 minutes,
20 km in 12 minutes
30 km in 18 minutes etc.
As you can see, by metricising distance and speed (without metricising time) working out how long it will take to reach your destination gets very difficult without a calculator.
A collection of thoughts and examples on the topics of programming, scripting and Linux. Mostly used so I can record stuff that I might have learnt, before I forget it again !!
Tuesday, December 2, 2008
Saturday, October 18, 2008
Using udev to connect my phone
I want to use udev to recognise my mobile phone and then have a script run which puts all my Podcasts onto the phone.
When I connect the phone, I get the following from dmesg
usb 5-2: new full speed USB device using uhci_hcd and address 2
usb 5-2: configuration #1 chosen from 1 choice
usb 5-2: New USB device found, idVendor=22b8, idProduct=6410
usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 5-2: Product: Motorola Phone (RAZRV3xx)
usb 5-2: Manufacturer: Motorola Inc.
usb 5-2: SerialNumber: 615044B60B0909
Initializing USB Mass Storage driver...
scsi4 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
Which unfortunately does not tell me what /dev/ is being used.
I know the phone was mounted as /mount/disk, so I use the following:
mount | grep disk
/dev/sdb1 on /media/disk type vfat (rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=500)
OK, so I know the phone is mounted on /dev/sdb, partition 1
udevinfo -q path -n /dev/sdb1
/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1
The udevinfo tells me to look at
/sys/block/sdb/sdb1
to get more info about the phone
Or use udevinfo to get a nice formatted output
udevinfo -a -p /block/sdb/sdb1 | more
In /etc/udev/rules.d I created the file
10-udev-default.rules
in this file I added the rule
KERNEL=="sd[a-z]1", BUS=="scsi", SYSFS{vendor}=="Motorola", SYSFS{model}=="RAZRV3xx", NAME="%k", SYMLINK="/razr"
My /etc/fstab is updated with
/dev/sdb1 /media/razr vfat defaults 0 0
Thats the first part over.... to be continued
When I connect the phone, I get the following from dmesg
usb 5-2: new full speed USB device using uhci_hcd and address 2
usb 5-2: configuration #1 chosen from 1 choice
usb 5-2: New USB device found, idVendor=22b8, idProduct=6410
usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 5-2: Product: Motorola Phone (RAZRV3xx)
usb 5-2: Manufacturer: Motorola Inc.
usb 5-2: SerialNumber: 615044B60B0909
Initializing USB Mass Storage driver...
scsi4 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
Which unfortunately does not tell me what /dev/
I know the phone was mounted as /mount/disk, so I use the following:
mount | grep disk
/dev/sdb1 on /media/disk type vfat (rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=500)
OK, so I know the phone is mounted on /dev/sdb, partition 1
udevinfo -q path -n /dev/sdb1
/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1
The udevinfo tells me to look at
/sys/block/sdb/sdb1
to get more info about the phone
Or use udevinfo to get a nice formatted output
udevinfo -a -p /block/sdb/sdb1 | more
In /etc/udev/rules.d I created the file
10-udev-default.rules
in this file I added the rule
KERNEL=="sd[a-z]1", BUS=="scsi", SYSFS{vendor}=="Motorola", SYSFS{model}=="RAZRV3xx", NAME="%k", SYMLINK="/razr"
My /etc/fstab is updated with
/dev/sdb1 /media/razr vfat defaults 0 0
Thats the first part over.... to be continued
Getting the driver for my Nova DVB-S2 card
The best page to describe DVB-S2 support in Linux I found was at:
http://linuxtv.org/wiki/index.php/S2API
The S2 support is via an API called S2API. This replaced multiproto (although I found links out there at present telling you to use multiproto).
Kernal 2.6.28 should have the S2API included, but since I can't wait for that I will try to load it via the development repository at
http://linuxtv.org/hg/~stoth/s2
My card (the Nova S2) is also called Hauppauge_WinTV-HVR-4000Lite DVB-S/S2 PCI (also known as the S2 Lite). This is supported by S2API.
To get the driver software, it is required to install mercurial version control software.
This is described at:
http://www.linuxtv.org/wiki/index.php/How_to_install_DVB_device_drivers
I downloaded software via the command
hg clone http://linuxtv.org/hg/~stoth/s2
cd s2
hg update
I have to contine with this by copying the s2 directory to my Myth box and then compiling it there.
This is the best link I found:
http://linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-4000
http://linuxtv.org/wiki/index.php/S2API
The S2 support is via an API called S2API. This replaced multiproto (although I found links out there at present telling you to use multiproto).
Kernal 2.6.28 should have the S2API included, but since I can't wait for that I will try to load it via the development repository at
http://linuxtv.org/hg/~stoth/s2
My card (the Nova S2) is also called Hauppauge_WinTV-HVR-4000Lite DVB-S/S2 PCI (also known as the S2 Lite). This is supported by S2API.
To get the driver software, it is required to install mercurial version control software.
This is described at:
http://www.linuxtv.org/wiki/index.php/How_to_install_DVB_device_drivers
I downloaded software via the command
hg clone http://linuxtv.org/hg/~stoth/s2
cd s2
hg update
I have to contine with this by copying the s2 directory to my Myth box and then compiling it there.
This is the best link I found:
http://linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-4000
Subscribe to:
Posts (Atom)