|
12-12-02
Calendar Trivia by
Erick Tejkowski
Did you know that your Mac OS X installation has some informative calendar trivia built-in?
In the /usr/share/calendar/ folder, you'll find a handful of files that hold useful tidbits of information
about holidays, computers, history, and more. This week, we'll look at how to search through the data in those
files.
This demo is a shameless ripoff of a cool tip at Dr. Mac's site.
Visit his site to see the original tip and come back here when you're done.
Build the Interface
To create the interface for this project, open Window1 and add a PushButton,
a Listbox, a single-lined Editfield named searchField,
and a multi-lined Editfield named EditField1. Arrange the interface to your liking. Mine looks like this:
Add the Code
The code for this week's example is really simple. In fact, it's merely an altered sample from the
built-in documentation in REALbasic.
Dim s As Shell
s=New Shell
If TargetCarbon then
s.execute "cat /usr/share/calendar/* | grep "+searchField.text+" "
If s.errorCode=0 then
EditField1.text=s.result
else
EditField1.text="Error Code: "+Str(s.errorCode)
end if
end if
searchField.setfocus
When you do a search with this little utility, make sure to only enter one word at a time.
If you want to search for multiple words, you need to modify your execute
string to include additional grep statements. Again, check out Dr. Mac's site to see how
he searches for "Apple" and "founded" at the same time. Here's the results after searching for Apple.
05/11 Johnny Appleseed born, 1768
09/26 Johnny Appleseed born, 1774
01/03 Apple Computer incorporated, 1977
01/22 Apple airs "1984" commercial during Superbowl XVIII, 1984
04/01 Apple Computer founded, 1976
04/20 Apple announces the Apple ][ at the 1st West Coast Computer Faire, 1977
06/10 First Apple II shipped, 1977
03/11 Johnny Appleseed Day; anniversary of the death of John Chapman
Conclusion
That's it for this week. As usual, you can
download the completed project
instead of typing it in.
See you next week!
12-10-02
REALbasic News
by
Erick Tejkowski
SelectColorBevel
Mike Benonis offers SelectColorBevel, a BevelButton Subclass that emulates Apple's ColorWell
control that is available to Cocoa developers.
Features:
- Simple to use; just drag into a window
- A string version of the color value is available for easy saving, etc.
- All code is commented heavily, explaining what's going on.
- Visually looks identical to Apple's ColorWell control.
- A sample project has been included to demonstrate usage.
Round Navigation Button
Will Cosgrove has updated his round navigation button
to 1.1.
This plug-in allows REALbasic users to
draw a round navigation button under OS X, frequently used as a help or
forward and backward buttons. It supports Mac OS 8.5 or higher with both
Classic and Carbon applications.
This version fixes an icon drawing problem on Jaguar, adds the lock
and unlock icon, and allows for dynamic changing of icons during runtime.
You can download the free plug-in at:
http://www.everydaysoftware.net/code/
App Bundler
There's a new version of App Bundler
available.
App Bundler is an application designed to create OS X bundles (and
optionally OS 9 packages) from an unbundled Carbon and/or Classic
application. App Bundler is freeware.
mp3voodoo
Joerg Pressel has announced version 3.0fc of mp3voodoo, an MP3
catalog system.
mp3voodoo lets you catalog MP3 files in albums and titles and has the
special ability to attach cover pictures to albums. As in real life you
are
able to visually browse your collection.
Scrolling Canvas
Greg Ewing mentioned that he has a
scrolling canvas
class available on his site.
Hurry while it's hot!
Rendezvous
The MBS REALbasic plugin
in Version 2.8a14 features a new class for
using Apple's Rendevouz network service for registering, browsing and
resolving local network services.
The Rendevouz plugin is sold as part of the big MBS Plugin
Collection.
|