Home
  | 0 - 10 |  
Sandeep Chayapathi [userpic]

My Guitar Guru

March 20th, 2009 (08:01 pm)
Tags:

I have recently started to learn playing guitar, classical guitar to be specific. My guitar guru is Jesus Mansilla, a very talented guitarist. I found his ad on New Jersey Criagslist and decided to give it a shot.







For a week I tried learning from the dvd + book and realized that I need a personal tutor. Enter Jesus M. He lives in NJ and in his free time teaches guitar, has two music degrees: an Associates in Music Engineering and Bachelors in Classical Guitar Performance from two New York colleges.

You can read his blog here: http://classicalguitarblogger.com/blog3/2008/10/ or contact him here: http://www.findaguitarteacher.com/Teacher/61/jman81.htm

I recommend watching his videos.

If you are learning guitar and are in NY/NJ area, definitely try learning from him.

Sandeep Chayapathi [userpic]

MT4 plugin..

November 6th, 2008 (10:05 pm)

This is posted from my first MovableType plugin... woo hoo!

Sandeep Chayapathi [userpic]

AppleScript - Toggle Terminal.app's settings

October 7th, 2008 (10:23 pm)

I use Terminal.app and over a period of time end up with lots of open windows. Invariably one or two of them would a ssh session on a remote server.

I had to setup a new mysql server on a brand new remote server. I had 2 windows, both ssh session as root, to a remote server. For some reason, to detail to post here, I ended up running


rpm -e mysql-server

in the wrong ssh session!

To avoid these kinds of fubar, I have realised that, my terminals should have a different background (bright red perhaps) while logged in as root. Here is the result.

This applescript will toggle the settings (background and all) on the front most Terminal.app between a random setting and the default setting. I use this via the most excellent QuickSilver.app.

-- Toggle settings on Terminal.app
-- Copyright (c) Sandeep Chayapathi

tell application "Terminal"
	
	set DefSet to default settings
	set AllSets to {}
	
	repeat with tmp in every settings set
		if name of tmp is not equal to name of DefSet then
			set AllSets to (AllSets & name of tmp)
		end if
	end repeat
	
	random number from 1 to (count of items in AllSets)
	
	set rnd to (random number from 1 to (count of items in AllSets))
	
	activate
	
	set CurSet to current settings of window 1
	
	if CurSet is equal to DefSet then
		set tmpName to item rnd of AllSets
		set tmpSet to settings set named tmpName
		set current settings of window 1 to tmpSet
	else
		set current settings of window 1 to DefSet
	end if
	
end tell

Sandeep Chayapathi [userpic]

dmesg is your friend

July 10th, 2008 (01:39 pm)
current mood: working

From the Many lessons learnt and forgotten section. We needed a backup of our production database (mysql). Ed, my colleague, took an external USB drive to the data center, and had asked me to remotely initiate the copy.

Earlier he had helpfully provided me this link: on how to connect/mount USB drives. Having fooled around linux for a while now, I knew a better way. dmesg.

dmesg is your friend. As the usb device is connected, the kernel logs about the new device. You need the appropriate device name, as given in the log, and you can mount the device. In short, use this command:

$ dmesg | grep -i "SCSI"


I will leave you with this excellent document from Novell for detailed instructions.

Sandeep Chayapathi [userpic]

George Carlin is dead!

June 23rd, 2008 (09:49 am)

I'm in mourning, George Carlin is dead!! I was bugging tippy about buying tickets for his next show and now this. It is unfair, now I'll never get to meet this genius (except on cold, unemotional TV).

I'll leave you with this piece: Save the planet (text version: we're so self important...)...

Sandeep Chayapathi [userpic]

Annoying awesomebar

June 19th, 2008 (02:35 pm)
Tags:

I installed Firefox 3 yesterday. I was instantly annoyed by the new "Awesome bar". I'm used the simple drop-down list box that FF2 had, the new location bar has a richer interface and more data. I couldn't handle the information overload. After tweaking around about:config for a while, I found this addon, oldbar, which restores sanity to the location bar.

Sandeep Chayapathi [userpic]

6 ways to curly brace

June 16th, 2008 (03:19 pm)

This post is inspired by a question in this old article by Chromatic: "Perl 5 overloaded curly braces in six different ways.".

The following are the 6 different ways that the curly braces could be used:



  1. block delimiter, eg:
    if($foo){

    }


  2. regex "match n times" operator, eg:
    /\d{2,4}/


  3. de-reference operator, eg:
    @{$foo}


  4. reference to anonymous hash, eg:
    my $hash = {'foo' => 'bar'};


  5. access hash value, eg:
    print $hash{'foo'};


  6. interpolate punctuation arrays, eg:
    @{*}

Sandeep Chayapathi [userpic]

Firefox 2 CPAN search plugin

May 12th, 2008 (02:43 pm)
current location: http://csandeep.googlepages.com

This is from David Filmer's post here. I have made a change to the xml, so that it works with my firefox (v2.0.0.14 on linux). Also the plugin can be installed from my web page. Without much ado, here is the CPAN search plugin.

Sandeep Chayapathi [userpic]

Cocoa: invoke AppleScript functions in your cocoa app

March 11th, 2008 (08:16 pm)

FlickrImport uses AppleScript to talk to iPhoto. It has a custom AppleScript method, that takes one argument. While I was able to find ready examples on invoking applescript, from cocoa space, as long as the AppleScript code were in NSString, it was a bit difficult to find examples on invoking compiled AppleScript's. Here is my attempt to fill this gap.

Having said that, apple has a detailed technical note regarding this subject. Following that is all you need to invoke compiled AppleScript's in your cocoa app. However, I'll attempt to explain in my own fashion.

You will be using NSAppleScript class to communicate with your AppleScript. This class is available via the Carbon.framework. Add "Carbon.framework" to your project's list of Frameworks and import the following, in your class's header file:

#include <Carbon/Carbon.h>


This will give you access to NSAppleScript and related classes. To be continued...

Sandeep Chayapathi [userpic]

Cocoa: adding EXIF metadata to images

February 29th, 2008 (06:11 pm)

Greetings, this is my serious attempt at blogging. I have started to code Flickr Import as a part of learning Objective-C and Cocoa programming.

Flickr Import allows you to download images from Flickr into iPhoto. One of the nifty thing it does is to retain the TIFF and EXIF meta data. I will show you here, how Flickr Import does this.

First, add ApplicationServices.framework to your project and include the header file, thusly:

#include <ApplicationServices/ApplicationServices.h> 

this gives you access to CGImageDestination and CGImageSource

You will then get a handle to the image source and create an destination handle thusly:
    NSURL *file = [NSURL fileURLWithPath:@"/tmp/foo.jpg"];
    CGImageSourceRef source = CGImageSourceCreateWithURL( (CFURLRef) file, NULL);
    
    if (!source) {
        NSLog(@"***Could not create image source ***  %@", file);
        return;
    }    
   
    CFStringRef UTI = CGImageSourceGetType(source);
    NSMutableData *data = [NSMutableData data];
    CGImageDestinationRef destination = CGImageDestinationCreateWithData((CFMutableDataRef)data,UTI,1,NULL);
    
    if(!destination) {
        NSLog(@"***Could not create image destination ***");
        return;
    }


To update any of the destination properties, first create mutable dictionary, which holds these values, as shown below:

NSMutableDictionary *exifDict = [NSMutableDictionary dictionary];
// aperture - using a float variable named aperture
[exifDict setValue: [NSNumber numberWithFloat: &aperture]
          forKey: (NSString *) kCGImagePropertyExifApertureValue];
// shutter speed - using a float variable named shutterSpeed
[exifDict setValue: [NSNumber numberWithFloat: &shutterSpeed]
          forKey: (NSString *) kCGImagePropertyExifShutterSpeedValue];


The destination properties (of type CFStringRef) are defined here.

A key-value pair of the destination property and desired value is used to update the metadata, via CGImageDestinationAddImageFromSource() call. Apple has documented all the 'key's that can be used, however, what is not mentioned in apple's documentation is the type of the 'value'. This is exhaustively documented in the specs and also here.

Once you have a mutable dictionary of destination property and value, you can update the image file:

    NSMutableDictionary *metaData = [NSMutableDictionary dictionary];
    [metaData setObject: exifDict forKey:(NSString *)kCGImagePropertyExifDictionary];
    
    //add the image contained in the image source to the destination, overidding the old metadata with our modified metadata
    CGImageDestinationAddImageFromSource(destination,source,0, (CFDictionaryRef) metaData);
    
    //tell the destination to write the image data and metadata into our data object.
    //It will return false if something goes wrong
    BOOL success = NO;
    success = CGImageDestinationFinalize(destination);
    
    if(!success) {
        NSLog(@"***Could not create data from image destination ***");
        return;
    }
    
    //now we have the data ready to go, so do whatever you want with it
    //here we just write it to disk at the same path we were passed
    [data writeToFile:[self downloadPath] atomically:YES];
    
    //cleanup
    CFRelease(destination);
    CFRelease(source);


If you wish to read the EXIF data, have a look at this blog entry

Comments and corrections are welcome.

  | 0 - 10 |