{Notes to self, programming, technology, linux, windows, git} U {Papers, reviews, games, coffee, tabletennis, ramblings} = {things worth saving}

Monday, October 13, 2008

Python trick - a and b or c

and / or do not return boolean values as in java, etc. Instead they return one of the values under comparison. With this we can do tricks like a? b: c (java, c, etc)

a and b - returns b, the last true element, if both are true, otherwise a.
a or b - returns a, the first true element. if none are true, returns b.

if using a and b or c, a must always be true if we wish to make a choice between b or c.

Python trick - getattr

getattr is teh awesome. Using string concatenation, we can obtain a real method reference (which is an object in python), and call it!

import printhelper #defines various print methods named "print_"

def print(to_print, format=):
to_call = getattr(printhelper, "print_%s" % type, printhelper.print_text)
return to_call(to_print)

Thursday, October 09, 2008

ipod on arch linux

1) get rhythmbox or dont

2) Setup HAL/DBUS

sudo gpasswd -a username hal
sudo gpasswd -a username dbus

Make sure 'hal' is in your daemons array down at the bottom of rc.conf.

something fails?
# dmesg | tail

3) mount the ipod:

sudo mkdir /mnt/ipod
sudo mount /dev/sdb2 /mnt/ipod

4) vim /etc/fstab
add line at end: /dev/sdb2 /mnt/ipod vfat user,noauto,unhide 0 0 //vfat?

- reboot!

NOW:

mount /dev/sdb2
umount /dev/sdb2

Make some symlinks, etc .

5) Use rhythmbox to play music (if open, and hal is setup, it should autodetect the ipod)-

otherwise? browse /mnt/ipod/iPod_Control/music folders. garbled folder names and filenames. maybe someone will make a cmd line too to play stuff there.

Notes on that: generate m3u playlist that references ipod folders. use mp3info lib

Tuesday, October 07, 2008

chroot - Linux kernel panic!

# arch
# mount /dev/sda7 /mnt
# mount /dev/sda6 /mnt/boot
# mount -t proc none /mnt/proc
# mount -t sysfs none /mnt/sys
# mount --bind /dev /mnt/dev

# chroot /mnt

# dhcpcd ethx -- Get some internets (0 = wire, 1 = wireless)

# pacman -U /var/cache/paman/pkg/kernel26-2.6.23.xx-x.pkg.tar.gz -- if local, else get new one.

Drive stuff:
# fdisk -l
# df -h

Linux drive notes

/dev/sda1 (boot win)
/dev/sda2 (extended)
/dev/sda5 (windows)
/dev/sda6 (/boot - contains kernel.img)
/dev/sda7 ( / )
/dev/sda8 ( /swap)
/dev/sda9 (/home)

mkdir /mnt/windows
mount -t ntfs-3g /dev/sda5 /mnt/windows/data
mount -t ntfs-3g /dev/sda1 /mnt/windows/system

Put in /etc/fstab:

/dev/sda5 /mnt/windows/data ntfs
/dev/sda1 /mnt/windows/data ntfs-3g

Exact Audio Copy settings

EAC
1) fill offset with silence, no use of null samples, sync tracks. extraction normal, error high.
3) on ex, start external compressors queued in bg.


Drive options:
1) secure, accurate stream
2) auto
3) allow speed reduction, use accuraterip
4) method b, secure

Compression:
use external program, custom.

Cmd line:
C:\path\to\flac.exe
--best -T "ARTIST=%a" -T "TITLE=%t" -T "ALBUM=%g" -T "DATE=%y" -T "TRACKNUMBER=%n" -T "GENRE=%m" -T "COMMENT=%e" %s -o %d

Sunday, October 05, 2008

Evolution

We have ("Humons") always been infatuated with solutions to problems, rather than sideeffects or repercussions.

But this is what evolution is. A solution to a problem that noone else in the world has thought up...furthering progress in the name of human kind which is exciting to most scientists. We rarely stop and think, "This could revolutionize the way we think and behave, but... i shouldn't". The only problem is that we often don't understand what the solution might do, other than apply to the intended problem. We don't understand the world yet. In that sense, we're all guineapigs, or need to decide whether or not we wish to parttake.

Who knows if that TV of yours is sending out deadly alien rays that are killing you slowly? It probably is.

Followers