Archive for January 2008
cue timings
This is for roadmovie #116 – there she goes again.
00:00 02:28 06:39 10:02 13:21 15:35 19:08 21:24 25:22 28:33 32:38 36:56 40:27 44:10 47:51 51:39 57:00 59:47
cue files
Cue file for the mix roadmovie #118 – i wish i’d stayed asleep today starts like this:
TITLE "118"
PERFORMER "roadmovie"
FILE "roadmovie118_080127.mp3" MP3
TRACK 01 AUDIO
TITLE "silver-stallion--the-highwaymen-cover"
PERFORMER "cat-power"
INDEX 01 00:00:00
TRACK 02 AUDIO
TITLE "anything"
PERFORMER "david-n-the-citizens"
INDEX 01 02:45:00
So this is the format. Later I’ll publish only the timings.
00:00 02:45 06:20 10:07 14:05 17:44 22:17 26:02 29:35 33:20 36:45 39:47 44:11 47:50 54:02 56:59
The same for 117:
00:00 01:30 06:20 09:10 12:27 16:08 20:44 23:27 25:22 29:01 32:58 35:02 37:41 42:53 49:59 53:39 56:14
two’s complement, a faster method
There’s a faster method to compute two’s complement.
Theorem.
The end result is the same
Proof.
Let’s use induction again and denote f as the transformation’s function. For the first time use f to numbers ending with 1. This is the k=1 case when k is for the index of the first one.
In the original, invert all the bits, add one. The last digit after invertion will be zero, adding one turns it back to 1. So all the digits are inverted but the last. This conforms the faster method’s output. So the theorem is true for k=1.
Suppose it is true until a k>0. What about k itself?
k.
... 1 0 0 ... =: x
k - 1
... 1 1 0 ... = x + 2
and
... 1 0 0 ... = f(x)
k - 1
... 0 1 0 ... = f(x + 2 )
Finally it is enough to see
/ \ / \
| k - 1 | k - 1 | n |
f | x + 2 | = -x - 2 | mod 2 |
\ / \ /
/ \ / \
| k - 1 | / \ k k - 1 | n |
f | x + 2 | = f | x | - 2 + 2 | mod 2 |
\ / \ / \ /
/ \
k - 1 / \ k k - 1 | n |
-x - 2 = f | x | - 2 + 2 | mod 2 |
\ / \ /
/ \
/ \ k k - 1 k - 1 | n |
-x = f | x | - 2 + 2 + 2 | mod 2 |
\ / \ /
/ \
/ \ | n |
-x = f | x | | mod 2 |
\ / \ /
QuED…
two’s complement
Theorem.
Two’s complement (negate all the bits and add 1) gives you a positive number y for a given x which is congruent with -x.
Proof.
/ \
| n |
1 + ~ x = -x | mod 2 |
\ /
n - 1 / \
----- i | n |
1 + ~ ) a 2 = -x | mod 2 |
----- i \ /
i = 0
n - 1
----- / \
\ / \ i | n |
1 + ) | 1 - a | 2 = -x | mod 2 |
/ | i | \ /
----- \ /
i = 0
n - 1 n - 1 / \
----- i ----- i | n |
1 + ) 2 - ) a 2 = -x | mod 2 |
----- ----- i \ /
i = 0 i = 0
/ \ n - 1 / \
| n | ----- i | n |
1 + | 2 - 1 | - ) a 2 = -x | mod 2 |
\ / ----- i \ /
i = 0
n - 1 / \
n ----- i | n |
2 - ) a 2 = -x | mod 2 |
----- i \ /
i = 0
n - 1 / \
----- i | n |
- ) a 2 = -x | mod 2 |
----- i \ /
i = 0
/ \
| n |
-x = -x | mod 2 |
\ /
QuED…
easy geometric series
Theorem.
n - 1 ----- i n ) 2 = 2 - 1 ----- i = 0
Proof.
Clearly, this is a geometric series, but one can also use the power of induction. For n=1, the statement is trivially states
0 1 2 = 2 - 1
Let’s suppose our theorem holds for every number below n>1. What about n itself?
n n - 1 / \ ----- i n ----- i n | n | n + 1 ) 2 = 2 + ) 2 = 2 + | 2 - 1 | = 2 - 1 ----- ----- \ / i = 0 i = 0
QuED…
two monitor wallpaper setup
At my workplace we use a two display environment. Wallpapers with geometric forms looks bad due to the gap between the two desktop. I wrote a little script which removes the middle of the wallpaper and after those kind of desktop backgrounds behaves as expected. It uses the ImageMagick package.
#!/bin/zsh
# $1 is the file itself
x=$2
y=$3
gap=$4
(( tempx = 2 * x + gap ))
(( dispx = x + gap ))
cp $1 temp.$1:e
mogrify -scale ${tempx}x${y}! -quality 100 temp.$1:e
cp temp.$1:e temp1.$1:e
cp temp.$1:e temp2.$1:e
mogrify -crop ${x}x${y}+${dispx}+0 -quality 100 temp2.$1:e
mogrify -crop ${x}x${y}+0+0 -quality 100 temp1.$1:e
mv $1 $1:r.orig.$1:e
convert -quality 100 temp1.$1:e temp2.$1:e +append $1
rm -rf temp.$1:e temp1.$1:e temp2.$1:e
split mp3 to wav slices
Update: if you’re looking for splitting mp3 files without reencoding and by using only mplayer and mencoder command line tools, read this post instead.
I have a Sony mznh600 which uses the brilliant SonicStage bloatware to upload music to the equipment. This shit put little glitches into the tracks I upload in case those are mp3 files. With wavs this isn’t an issue. Therefore I always have to convert my files to wav first and upload then. I tend to listen kinda electronic music (I prefer files published as mixes) instead of popular crap, so I feel the need to split them into smaller pieces. SonicStage runs only on windowns, so I set up an environment to perform previous steps.
First of all I installed Vim as a useful tool long ago. As a preparation step change your _vimrc as follows.
C:\Program Files\Vim>diff _vimrc _vimrc-orig 3c3 < " source $VIMRUNTIME/mswin.vim --- > source $VIMRUNTIME/mswin.vim C:\Program Files\Vim>
This change allows to use Ctrl-A as incremental operator. Download and unzip mplayer e.g. from here then create an initial command file like this:
D:\z\split>type split.cmd d:\z\mplayer\mplayer.exe -ss 0 -endpos 300 Beatman_and_Ludmilla-Breakout_Breeze- _-The_Breakbeat_Show_at_Radio_Tilos-LINE-22_12_2007.mp3 -ao pcm:file=tr01.wav D:\z\split>
Change file names as convenient for you. Open it in Vim and start with a “:set nrformats=” command. This last one enables the behavior when you press Ctrl-A on a number like 07 it becomes 08 (and on 09 it will be 10). Then do the followings:
qayyp/-ss<enter>4l300<Ctrl-a>/=tr<enter>3l<Ctrl-a>0q12@a
This will create command line statements for the track sequence (300 sec (5 min) for every track). You should change the 12 before @ to cover the full length. A bigger number is good as well because then the wavs out of scope won’t contain data and you can delete those afterwards. Finally just run the command file and enjoy the results.
Of course some changes should be made to suit your needs, but these are the basics.
being an employee
Being an employee is kinda easygoing. You don’t have to care about the thins to do for your money. Your company takes this adventure. The only thing you have to do is to do what’s told and cry for more money. You don’t have to take the risk of market/financial decisions. Managing this peril is the 1st step to get out from the rat race as Kiyosaki sais in his book. I agree with the Criticism section of the page though. I think one has to learn to filter out useful thoughts from a given lecture anyway.
use cases in calendar programs
1. Normal todo type entry. E.g. mail a contract to someone. Not recurrent in any sense. It’s good to know how much time spent between the registration and the check.
2. Calendar type entry. E.g. there’s a recurrent event you plan to participate on. You don’t have impact on scheduling that event. Good to track whether you were there or not. This should contain exact time.
3. My special type 1. E.g. you want to wash your car every two weeks. Therefore, in case of success a new entry should be inserted with the same content but date. That should be two weeks after completion. Good to know the distance between planned & real execution.
4. My special type 2. The same as before, except the next entry should be two weeks after planned date.
5. My special type 3 aka Moving type. E.g. you want to read a book with 12 chapters. 1 chapter every week. Kinda special type 4, but with changing labels.
statistics in calendar programs
One of my most wanted features in calendar programs looks like as follows. Ability to design recurrent events with the possibility to show whether it was successful or not. Later show statistics on the ratio of successful planned events. For example Outlook’s calendar program allows to design recurrent events but without a check sign. Outlook’s tasks facility provides a check box when recurrent task is designed but without the ability to skip elements. One have to check the previous to gain access to following items. Events have only date field, there’s no time definition.