810Installing Circos on OS 10.6

Circos, the Perl-package for visualizing data and information in a circular layout is an immensely popular application in the bio-informatics/bio-visualization community. And rightly so, as it able to produce visually stunning and appealing graphics. Because its the native environment is bio-informaticians, the software is written in Perl. For those without Perl experience, it can be slightly frustrating to set it up on OSX (as it was for me). Here are the steps I needed to do to get it running, hope that this might reduce the trouble and let others get to work on their visualization more quickly. The whole installation process is also detailed on the Installation page. 1 Getting Circos Download the software, tutorials, tools and courses 2 Testing the modules Go the the circosX-XX/bin folder and run: ./test.modules This gives you a list of the installed Perl modules, and – more importantly – the ones still missing. 3 Install the missing modules Switch to the super user with ‘su’. For each missing modules say: cpan -i Modulename::Subname
cpan -i Config::General
cpan -i Graphics::ColorObject
cpan -i Math::VecStat
etc, etc
All worked swimmingly, except GD was making a bit of trouble. 4 Installing GD The graphics library GD has to be present on your system. If it’s not, install it. (I am with homebrew, therefore installing GD is done like that: brew install gd) Still after installing GD, installing the Perl module would not work. But after applying a little force, it went fine:
cpan -i -f GD
5 Adding circos to your path Adding the circos ‘bin’ directory to your path lets you call the circos program directly without specifying the whole path. That’s a good thing.
export PATH
After that, everything should work and your Circos adventure can begin…

800Enabling root in OS X 10.7 (or 10.6)

sudo passwd root
After which you are prompted with a
Changing password for root.
New password:
Why the need for root? Surely, it’s a dangerous weapon and things can go awry easily, so only use it as a last resort. (I used it for hiding the couchdb account folder from the GUI.)

703Blocking hosts in /etc/hosts

How to block access to websites on your personal computer. The /etc/hosts file maintains a records of redirects, it you want to block access to a particular site, redirect to your local machine, or whichever site you find appropriate. Not that most website forward host-to-block.net to www.host-to-block.net, so make sure to block the www site as well. Open the file in your favourite text editor, make sure you have the permissions to open it.
sudo nano /etc/hosts
Add the following line to the file.       host-to-block.net       www.host-to-block.net
Flush the cache to make the changes immediate.
sudo dscacheutil -flushcache
Again. The crucial bit is to also block the www-site. That seems to be missing from a lot of descriptions/tutorials out there in the wild.

688Ruby Version Manager for OSX

Nice, simple and clean way to install the latest version of Ruby and Gems on OSX. The Tutorial: http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac And here’s also the direct link: http://rvm.beginrescueend.com/

609Hide/Show Files in the Mac OSX GUI

Hiding files and folders from the Finder:
chflags hidden filename
And show them again:
chflags nohidden filename

566Writing and Reading Preferences

CFStringRef textColorKey = CFSTR("defaultTextColor");
CFStringRef colorBLUE = CFSTR("BLUE");
CFPreferencesSetAppValue(textColorKey, colorBLUE, kCFPreferencesCurrentApplication);
CFStringRef textColorKey2 = CFSTR("defaultTextColor");
CFStringRef textColor;
textColor = (CFStringRef)CFPreferencesCopyAppValue(textColorKey2,kCFPreferencesCurrentApplication);
textColor must still be releasesed with CFRelease(textColor); Side note As we should know by now, CFStringRef is a toll-free bridge to NSString, meaning it’s possible to use a CFStringRef like a NSString.
NSLog(@"my CFStringRef %@", textColor);
More at Preferences Programming Topics for Core Foundation

553CAAnimation and the Snapback Problem

Having previously done Core Animation only on the iPhone, I am still a beginner when it comes dealing with in on OSX. The first thing that surprised me, is that layers have implicit animations; meaning whenever you change a value, the layer will animate to it using certain defaults. (duration = 0.25, etc.) While it is nice, I am still looking for a way to control it. When you want to know, when an animation is finished, you need to make a CAAnimation, set the delegate and let it call animationDidStop:
CAAnimationGroup *group = [CAAnimationGroup animation];
group.delegate = self;
group.duration = 0.25;
group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
CABasicAnimation *position = [CABasicAnimation animationWithKeyPath:@"position"];
position.fromValue = fromPointValue;
position.toValue = toPointValue;
CABasicAnimation *opacity = [CABasicAnimation animationWithKeyPath:@"opacity"];
opacity.fromValue = [NSNumber numberWithFloat:1.0];
opacity.toValue = [NSNumber numberWithFloat:0.0];
group.animations = [NSArray arrayWithObjects:position, opacity, nil];

[removeTarget addAnimation:group forKey:@"group"];
While this animates nicely, it still is not quite right. Because the layer basically does not know, that it values are changed in the animation, and therefore, after the animation stopped, the values are reset to the ones BEFORE the animation. That’s the annoying snapback. To get rid of it, tell the layer the new values, right after you add the animation.
removeTarget.opacity = 0.0;
removeTarget.position = toPointValue;
%nbsp; Interesting to see, that others seem to go throught the same learning experience.

391Creating a RAM Disk in OSX

OSX 10.6.2 diskutil erasevolume HFS+ “ramdisk” `hdiutil attach -nomount ram://1000000` Would create a 500MB RAM Disk. The size is calculated in 512K Block, 512K * 1000000 = 500MB Works nicely. From here. – – – However, if you want to mount the RAM Disk at a specific point in your filesystem, the method above does not seem to work. Instead try: hdiutil attach -nomount ram://10000 Create, attach but do not mount our RAM Disk (returned /dev/disk2) newfs_hfs -v Ramdisk /dev/disk2 Name and format the disk mount -t hfs /dev/disk2 /your/path/ Mount the disk at a specific point. The address has to be absolute, and should point to an empty folder. Once mounted, the folder gets replaced by the RAM Disk. umount /dev/disk2 Unmounting by ejecting the disk does not seem to work… Sources:

327Launchd – Reacting to System Events

launchd can be used to montor files and folder and execute certain actions when these files or folders change. Especially useful when an App crashes and writes a log to the CrashReporter. Tutorial, Lingon Helper App

442Transparent Background in Safari 4.0 Enable Debug Menu in Safari 4.0: defaults write com.apple.Safari IncludeInternalDebugMenu 1 via http://trac.webkit.org/wiki/WebDevelopers Also, an interesing option is to modify the .nib file of Safari and insert a new menu: http://pointum.com/safari-tweaks.html