image ResEx Logo
ResExcellence www : Powered by Google
Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Articles
   3D
   Audio
   Custom Controls
   General RB
   Graphics
   Hacks
   Mac OS X
   Menus
   Novelty
   Printing
   REALbasic 2005
   REALbasic 2006
   Registration
   Resources
   Reviews
   Serial
   Speech
   Sockets
   XML
   Video
Resource Links
News
   Current News
   February 2006
   January 2006
   December 2005
   November 2005
   October 2005
   September 2005
   August 2005
   July 2005
   June 2005
   May 2005
   April 2005
   March 2005









REALbasic for Dummies
by Erick Tejkowski


Learning REALbasic through Applications
by Clayton E., Crooks II


REALbasic for Macintosh
by Michael Swaine


REALbasic Cross-Platform Application Development
by Mark S. Choate





Older files are in Stuffit 5 or greater format. Newer files are ".Zip". Download StuffIt Expander
Tell us about a bad link. Thank You!

Calendar Trivia by Erick Tejkowsi
12-12-02

Printer Version




12-12-02_img2.jpg (17k) 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:

12-12-02_img1.jpg (13k)

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!




Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement. [an error occurred while processing this directive]