Vidnik

Thursday, May 08, 2008 at 5/08/2008 08:26:00 PM



Vidnik is our newest application in the Google Mac playground. It's a simple program for using the built-in camera on your Mac to create movies and upload them to YouTube.


You can use Vidnik to create a video diary, or just to quickly record a video comment to attach to an existing YouTube video. Vidnik works with the built-in video cameras on recent Macs, with Firewire video cameras, and with many USB video cameras.

To use Vidnik, run the app, then click the record button to start recording. Click it again to stop. Trim to just the golden moments you want to keep, as in the screen shot above. Fill in the required title, description, and so on. Click the upload button. That's it.

Or you can drag movies made in other programs onto Vidnik's column of movies, then click the upload button. And to use another program to do a little post-production, use the Gear menu to show Vidnik's movie file in the Finder. Edit the movie in the other program, then upload it.

Visigami

Wednesday, April 30, 2008 at 4/30/2008 02:33:00 PM





I've always enjoyed searching for images on the web, but then it occurred to me that it would be really fun to be able to present the images in a more interesting way than typically seen in a web page. So, I decided to write Visigami, which is both an image search application and screen saver. We're making it open source (Apache license) on code.google.com and I hope you'll have as much fun playing around with it as I did writing it.

Right now Visigami can search from three different image sources: Google Images, Picasa, and Flickr. In the application, there's a search field where you can type a query. Images matching the query will then start animating on the screen. You can animate the images in several ways: fan, carousel, and grid. And there are a few different camera views: fixed, autopan, and mouse pan. There are sliders for adjusting settings such as display speed and zoom. The screen-saver uses exactly the same settings you choose in the application. Although the options panel for the screen-saver works, it's easier to tweak the settings in the application than to run the screen-saver.

Here are some tips on using the application:

* Use your mouse's scroll wheel to zoom in and out.
* While in "mouse-pan" mode, click in the image view and hold the Option key down to move the images with the mouse.

Have fun with Visigami. I'm always open to any feedback you may have.

AppMenuBoy

Tuesday, April 29, 2008 at 4/29/2008 01:47:00 PM



Back in the days of Mac OS X Tiger (10.4), you could drag your Applications folder to the Dock and get a nice menu of your applications there. If you had any folders in the applications folder, you'd get hierarchical submenus in the Dock's Applications menu.

Apple turned this feature off in Leopard (10.5), replacing it with a simpler, less capable version. It came back partially in 10.5.2, when Apple added a list view for the Applications menu and other folders you add to the Dock.

My application AppMenuBoy restores the Tiger behavior plus a little more: it shows only applications, follows aliases, and if a folder contains only an application, it silently "hoists" that application in the menu so you don't have hierarchical menus that contain only a single icon.

The AppMenuBoy application is now featured on the Google Mac Developer Playground.

Manipulating keyboard LEDs through software

Thursday, April 17, 2008 at 4/17/2008 11:50:00 PM

Over the last few years, on my websites and in my book, we have discussed how to access or manipulate several interesting Mac components: the sudden motion sensor, trusted platform module, infrared remote control, system management controller, traditional input devices, the backlit keyboard lights, the ambient light sensor, and so on. (Not every Mac has all of these components.) The most popular of these by far turned out to be the sudden motion sensor, which went on to be a building block for many, many cool programs.

Speaking of lights, there are some lights on your computer that we haven't talked about yet. The caps lock and num lock LEDs on your keyboard (not all keyboards have these) are examples. These LEDs can be manipulated through software: you can both query and alter their state from your own programs.

If you have an irrepressible urge to turn these LEDs on or off through software, here is a program that shows you how. (Note that the program only manipulates the LEDs — it will not actually cause caps lock or num lock to be engaged.) The program also serves as an example of how to do user-space Human Interface Device (HID) programming through the I/O Kit.

The program should work whether you have a wired USB keyboard or a Bluetooth wireless keyboard. Compile and run the program as follows.


$ gcc -Wall -o keyboard_leds keyboard_leds.c \
-framework IOKit -framework CoreFoundation
$ ./keyboard_leds -h
...

Usage: keyboard_leds [OPTIONS...], where OPTIONS is one of the following
-c[1|0], --capslock[=1|=0] get or set (on=1, off=0) caps lock LED
-h, --help print this help message and exit
-n[1|0], --numlock[=1|=0] get or set (on=1, off=0) num lock LED
...
$ ./keyboard_leds -c # query caps lock LED state
off
$ ./keyboard_leds -c1 # turn caps lock LED on
off
on
$ ./keyboard_leds -c0 # turn caps lock LED off
on
off
...

Receiving Apple infrared remote control events

Tuesday, April 08, 2008 at 4/08/2008 03:42:00 PM



Most Mac models today ship with a six-button remote control and matching built-in infrared receiver. The remote control's primary purpose is to drive Apple's Front Row media application.

But maybe you'd like to use the remote for your own experiments. There are several software approaches to obtaining remote-button-press information. One of them is to communicate with Mac OS X's in-kernel infrared driver, which is implemented by the AppleIRController kernel extension. The I/O Kit layer in Mac OS X, which we would use for this kind of communication, is particularly powerful and flexible when it comes to allowing user-space access to hardware. So this approach is quite nice.

iremoted is a command-line program that uses I/O Kit interfaces to talk to the infrared driver and prints information about button presses and releases as they occur. I recently overhauled iremoted for Leopard, and the new version should work on both Tiger and Leopard. Moreover, the source for iremoted is now also available.

Enjoy talking to the remote control!

New frontiers with Google Data APIs and Objective-C

Thursday, March 20, 2008 at 3/20/2008 11:54:00 AM



I work on Mac client software because I enjoy the compile-link-run cycle that is central to crafting great experiences for users. But we live in a client-server world, and Google has world-class servers and web applications. That's why Google Data APIs are so cool if you develop Mac software: you don't need to build your own server farms and write your own web interfaces. Just let your software talk directly to Google's servers.

With the recent release of the Google Contacts Data API and the YouTube API for browsing and uploading, developers now have two more ways to reach users. Today's release of version 1.4 of the GData Objective-C Client Library adds support for these new APIs. Any Mac program that creates video can easily let users upload the video to a YouTube account. Mac software can also now enable users to access or edit their Google account contacts.

It's easy and natural for Cocoa programmers to use the library. This code snippet shows how get the names of all contacts in a user's Gmail account address book:

#import "GData/GDataContacts.h"

- (void)fetchContacts {
GDataServiceGoogleContact *service =
[[GDataServiceGoogleContact alloc] init];
[service setUserCredentialsWithUsername:@"myaccount@gmail.com"
password:@"mypassword"];
NSURL *feedURL =
[NSURL URLWithString:kGDataGoogleContactDefaultBaseFeed];

[service fetchContactFeedWithURL:feedURL
delegate:self
didFinishSelector:@selector(ticket:finishedWithContactFeed:)
didFailSelector:@selector(ticket:failedWithError:)];
}

- (void)ticket:(GDataServiceTicket *)ticket
finishedWithContactFeed:(GDataFeedContact *)feed {

NSArray *names =
[feed valueForKeyPath:@"entries.title.stringValue"];
}

- (void)ticket:(GDataServiceTicket *)ticket
failedWithError:(NSError *)error {
NSLog(@"%@", error);
}

Uploading video takes just a bit more effort, because YouTube's API requires metadata describing the video along with the video data itself. The Objective-C GData Library includes sample code showing how to do these and other common tasks with the APIs.

And one more thing...

The source code for the GData Objective-C Client Library is now compatible with the iPhone SDK as well. Perhaps you want your iPhone software to send photos to a Picasa Web Albums account, or keep a journal of phone calls automatically in Blogger. Maybe your iPhone application accesses a database of information from a Google Spreadsheet or from Google Base. With the Google Data APIs Objective-C Client Library, creating software for these tasks is straightforward.

If you are writing iPhone software, just drag the "GData Sources" group folder from the GData project file into your iPhone project, and use the GData APIs as you would when writing a Mac application. The Objective-C Client Library is an open-source project, so you can find links to the sources and documentation on the project page.

Macworld: Another Look Inside

Thursday, March 13, 2008 at 3/13/2008 09:22:00 AM

By Mark Sabec, Associate Product Marketing Manager

This year at Macworld we asked visitors to our booth to talk about what they do online and the Google products they use. The people who participated were anything but camera-shy, and they were all such good sports that we are happy to give them a little YouTube fame. Enjoy the video, and please stop by to see us at Macworld next year!