Uncategorized

When developing plugin for Quartz composer it is not possible to use a modal window for NSOpenPanel. You must also subclass the QCPluginViewController class

For OS X 10.5 and below

-(IBAction)importFile:(id)sender

{

fileTypesArray = [[NSArray alloc]initWithObjects:@”aac”,@”aiff”,@”wav”,@”wma”,@”mp3″, nil];

NSOpenPanel *panel  = [[NSOpenPanel openPanel]retain];

//Run the open panel

[panel beginForDirectory:nil file:nil types:fileTypesArray modelessDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo :) contextInfo:NULL];

}

 

-(void)openPanelDidEnd:(NSOpenPanel*)sheet

returnCode:(int)returnCode

contextInfo:(void*)contextInfo

{


//Did they choose open?

if (returnCode == NSOKButton)

{

NSString *path = [sheet filename];

NSFileManager *fileManager = [NSFileManager defaultManager];

self.fileUrl = [fileManager displayNameAtPath:path];

[sheet release];

}

}

 

The panel must be retained when called and released when user is finished.  If the window is not retained it will appear and disappear quickly.

If developing for OS X 10.6 use the following code as the above code is deprecated. Again make sure to retain (or at least a strong reference when using Garbage colection) the window and release when finished.

Your ads will be inserted here by

Easy AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot OR
Suppress Placement Boxes.

-(IBAction)chooseFile:(id)sender

{

NSOpenPanel *panel = [[NSOpenPanel openPanel] retain];

[panel setAllowedFileTypes:[NSSound soundUnfilteredTypes]];

NSLog(@”This is the list of supported Files %@”, [NSSound soundUnfilteredTypes]);

[panel setCanChooseFiles:YES];

[panel setCanChooseDirectories:YES];

[panel setCanCreateDirectories:NO];

[panel setAllowsMultipleSelection:NO];

//Run the open panel  Notice the panel no longer uses a delegate but the new C blocks.

[panel beginWithCompletionHandler:^void (NSInteger result) {

if (result == NSFileHandlingPanelCancelButton) {

return;

}

NSLog(@”This is the openpanel handle %@”,[[[panel URLs]objectAtIndex:0]path]);

 

//more code here……..


[panel release];

}];

 

 

}

-[QCPlugInPatch _addOutputPortWithClass:forKey:attributes:]: Inconsistent state

I came across this error recently when trying to write a custom patch for QC.  If you get this error more than likely you are trying to use a consumer patch with outputs.  You can not have outputs with a consumer patch.  Change kQCPlugInExecutionModeConsumer to kQCPlugInExecutionModeProcessor.

Split NSString into an array of objects each containing one line.

For example, say we have the following tab delimited string

AH162h 0 1926 2516 1 192.168.1.255

AH162h 1 1926 0×0012 3412

3456 7402 0×342 0×548

and we want to have each line be an NSString object in an NSArray

In OS X 10.4 and below

NSArray *lines = [stringOfLines componentsSeparatedByString:@\n]

Each NSString object in lines could further be broken down into Tab delimited NSString objects

NSArray *tabStrings = [lineString componentsSeparatedByString:@\t]

In OS X 10.5 and above

NSArray *lines = [string componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];

About a year or ago I purchased a D-Link DGS-1024D 24-Port Gigabit Switch to replace a malfunctioning Netgear 16 port gigabit switch. I really did not intend to purchase a 24 port switch as it is probably overkill for a home network. However, almost all my ports are connected to something. Nowadays, it is not just desktop computers needing a connection. It is everything from TV’s, wireless bridges, home stereo, set top boxes, and dvd players to gaming devices. I had not used D-Link products lately due to some less than desirable results from some of their products in the past but was surprised at the quality of this switch. It runs cool and powers down ports which do not have an active link. Best of all it has the ability to diagnose a faulty ethernet cable and let you know through the LED lights. This fast and responsive switch has made a hugh difference in the reliability of my network and clarity of my VoIP connection. This is probably one of the best switches I have owned.

 

I sat down this weekend to begin writing a metadata application for itunes .m4v movies only to discover my orginal plan had to be modified .  I had been wanting to do this for some time now since I got the new AppleTV 2010.  The AppleTV really looks nice when the metadata for each file is complete.  Having cover art show up on coverflow really gives the experience a nice comfortable feel.  This sort of application exist already I know, but I had a different feature set in mind.

So with my idea in hand and some research I had done in the days preceding, I started to get to work.  I thought that I would use the amazon database for the metadata and the Quicktime API to do the writing to file.  Should not really be a problem since Quicktime does have an API for this sort of stuff.  I started as I usually do, just getting a one piece of metadata written to file then making progress from there.  After several hours of trying, and some google research I learned that the Quicktime API only supports the .mov container format not the newer iTunes formats.  Why Apple why????  Since itunes does support editing of metadata for all of it’s formats the API must exist somewhere -privately I suppose. I will try again, this time using Atomic parsley.

Additonal notes:

Mp4v2 instead of Atomic Parsley.

Mp4chaps to set chapter names

 

Tom

A file in Finder can be hidden by one of three ways

1. File’s hidden bit is set.

2. File is in hidden file list in folder (.hidden file).

3. File has a “.” at beginning of name.

Beginning in 10.6 use NSURL for referencing files and accessing their metadata. Parsing these values with getResourceValue:forKey:error: using the NSURLIsHiddenKey. However this will not detect the hidden file if it is in the .hidden file. NSURL has a long list of key to get values out of the file’s metadata.

Prior to 10.6
Use LSCopyItemInfoForURL

Example

BOOL isInvisibleCFURL(CFURLRef inURL)
{
LSItemInfoRecord itemInfo;
LSCopyItemInfoForURL(inURL, kLSRequestAllFlags, &itemInfo);

BOOL isInvisible = itemInfo.flags & kLSItemInfoIsInvisible;
return isInvisible;
}

LSItemInfoRecord is a structure which contains the following

  • flags
  • filetype
  • creator
  • extension
  • iconFileName
  • kindID

flags is structure containing

  • kLSItemInfoIsPlainFile Item is a data file (and not, for example, a directory, volume, or UNIX symbolic link).

  • kLSItemInfoIsPackage  Item is a packaged directory.

  • kLSItemInfoIsApplication Item is a single-file or packaged application.

  • kLSItemInfoIsContainer Item is a directory (includes packages) or volume.

  • kLSItemInfoIsAliasFile Item is an alias file (includes symbolic links).

  • kLSItemInfoIsSymlink Item is a UNIX symbolic link.

  • kLSItemInfoIsInvisible Item is invisible, because either its name begins with a period or its isInvisible Finder flag is set.

  • kLSItemInfoIsNativeApp Item is an application that can run natively in Mac OS X.

  • kLSItemInfoIsClassicApp Item is an application that cannot run natively and must be launched in the Classic emulation environment.

  • kLSItemInfoAppPrefersNativeItem is an application that can run either natively or in the Classic emulation environment, but prefers to be launched natively. This flag is valid only when kLSItemInfoIsNativeApp is set.

  • kLSItemInfoAppPrefersClassic Item is an application that can run either natively or in the Classic emulation environment, but prefers to be launched in the Classic environment. This flag is valid only when kLSItemInfoIsNativeApp is set.

  • kLSItemInfoAppIsScriptable Item is an application that can be scripted.

  • kLSItemInfoIsVolume Item is the root directory of a volume or mount point.

  • kLSItemInfoExtensionIsHidden Item has a hidden filename extension.



I was a little out of the loop on this lately but apparently Apple removed the airprint support on the Snow Leopard update just prior to iOS4.2 release. However, you can enable it by using AirPrintHactivator.  In case you did not know, it allows you to print from iOS 4.2 devices to any printer connected on your network.


 

1) Open the front door – the message ‘Cover is Open’ will appear.
2) Press and hold the cancel button.
3) Press the Reprint button – the message ‘Reset Parts Life’ should appear.
4) Then do the following:
B.TNR-H – Select ok, accepted should display. Press ^
B.TNR-S – Select ok, accepted should display. Press ^
Y.TNR-H – Select ok, accepted should display. Press ^
Y.TNR-S – Select ok, accepted should display. Press ^
M.TNR-H – Select ok, accepted should display. Press ^
M.TNR-S – Select ok, accepted should display. Press ^
C.TNR-H – Select ok, accepted should display. Press ^
C.TNR-S – Select ok, accepted should display. Press ^
5) Cancel
6) Close the front door.

I currently own a Brother HL-4040cn color printer. It is a great printer, bulky but great. Recently I received a Toner End of Life message and could not print. This is how I reset the toner cartridges.

 

1)Open the front door – the message ‘Cover is Open’ will appear.

2) Press and hold the cancel button.

3) Press the Reprint button – the message ‘Reset Parts Life’ should appear.

4) Then do the following:

B.TNR-H – Select ok, accepted should display. Press ^

B.TNR-S – Select ok, accepted should display. Press ^

Y.TNR-H – Select ok, accepted should display. Press ^

Y.TNR-S – Select ok, accepted should display. Press ^

M.TNR-H – Select ok, accepted should display. Press ^

M.TNR-S – Select ok, accepted should display. Press ^

C.TNR-H – Select ok, accepted should display. Press ^

C.TNR-S – Select ok, accepted should display. Press ^

5) Cancel

6) Close the front door.

If you are getting a “Drum Life End Soon” message see here

OCInkjet.com 728x90 banner, image is updated by season.

I recently created a quartz composer patch which will play a sound file in a Quartz Composer composition. It is very useful for playing a short sound file for a sound cue to an event or a basically any sound you want to include in a composition.

I created this patch for a toddler’s game in which the screen contains a bunch of objects which the toddler removes by moving the mouse over the objects.  As each object is removed a very short sound file is played to give a audio cue that the object has been saved. It is also used in another animation to play a bubbles sound when fish are swimming by. I do offer it for sale along with support for a very reasonable $4.99.  I made a short YouTube video to give some idea of what is does.  It can be found here available here. It can be purchased here