Tim's blag

To content | To menu | To search

Thursday 23 June 2011

Machiner precision: float vs double

I found a small code snippet on machine precision for float and double datatypes in C. Might be interesting for some people. I adapted the code slightly and put it online in a gist. I reproduced the code here for clarity.

Other interesting posts on this topic include this Stackoverflow topic which in turn refers this appendix on floating-point arithmetic..

Continue reading...

Tuesday 21 June 2011

Old version Skype for Mac

Because Skype for Mac version 5.x sucks monkey balls, here's how to downgrade to version 2.8:
There is also a tutorial available if you need step-wise instructions. If you don't know why you're reading this check here and here.

Multiple mouse preferences

If you're using multiple mouses with your Apple as I am (work and home), it might annoy you that the mouse speeds are different for each mouse. To mitigate these problems to some extent, you can use Steermouse to configure your mouse and then use the Applescript snippet on their website to make shortcuts for your specific mouse settings in an Applescript file.

Currently I'm using the following settings:

tell application "SteerMouse"
  set text "cursor tracking speed" to 0.025
  set text "cursor sensitivity" to 800
end tell

Related info:

Monday 20 June 2011

Quick look plugins for mkv/gif/source code

Apparently there are plugins for Apple's Quick look such that you can view different file types. Here are some plugins that I found useful:

Video encode one-liners

Here are some one-liners for encoding videos in various formats. I use them to convert the videos from my digital camera to a more suitable format. I'm still not sure which one is best, but I'm currently using the combination of x264/aac/mp4.

  • mencoder h264/mp3/avi
mencoder $1 \
  -ovc lavc -lavcopts threads=4:vcodec=mpeg4:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=1250\
  -oac mp3lame -lameopts vbr=3 -af resample=48000:0:0,channels=2 -o $1-xvid_mp3.avi
  • mencoder h264/mp3/mkv
mencoder $1 \
  -ovc x264 -x264encopts turbo:bitrate=2000:subq=4:bframes=2:b_pyramid=normal:weight_b:threads=auto \
  -oac mp3lame -lameopts vbr=3 -af resample=48000:0:0,channels=2 -o $1-x264_mp3.mkv
  • ffmpeg h264/aac/mp4
ffmpeg -i $1 \
  -acodec aac -strict experimental -ab 128k -ar 48000 -ac 2 \
  -vcodec libx264 -vpre faster -crf 22 -threads 0 $1-x264_aac.mp4

There are several container formats, video- and audio-codecs to choose from. Containers do exactly that, they 'contain' the audio and video information, sometimes supplemented with things as subtitles. One well known container is Audio Video Interleave (avi), another is MPEG-4 Part 14 (mp4) and a newer and more advanced one is Matroska (mkv).

The ubiquitous and most well known audio codec is no doubt MPEG-2 Audio Layer III — or mp3 — and needs no introduction. Advanced Audio Coding (aac) is one successor of mp3 and has better performance but less compatibility.

Video codec Xvid is a successor to the DivX ;-) (including the smiley) codec which was a hacked version of Microsoft's MPEG-4 Version 3 video codec and is widely used for encoding videos. The newerh264 performs better and is slowly taking over.

More info: 

Blag

omg look at me, i gotz my own blag!

page 2 of 2 -