Monthly Archive for March, 2006

XTrace: Flash Debugging Without The Flash IDE

XTrace 1.0, a replacement for the horrible trace window in the Flash IDE, was released a few days ago. Take a look at the product page for more information on how it works and how to integrate it into your flash application. This is one of the pieces to the puzzle, I’ll release the BASH script I’ve written that allows better MTASC Xcode integration as soon as possible.

I need more beta testers for the new application I’m going to be releasing, email me if your interested!

TextMate: Most Advanced Editor. Ever.

If you haven’t tried out TextMate I command you to download it right now. Its the most powerful and flexible editor I have ever used, I’m having trouble understanding how everything works its complicated. The syntax coloring is amazing, its so incredibly customizable. This is the only Cocoa text-editor I’m aware of that has code-folding, which is a very cool feature. The documentation is awesome and the wiki and mailing list are awesome resources too. It has amazing integration with the command line, allowing almost endless customization!

Color Blender 1.1

I came across a couple bugs in my Color Blender application while using it to create a web-site. The hex values of the colors were always off a little bit from what they should be, and when I selected colors using the “eye dropper” tool (or “eyeglass” tool in Apple’s case) the RGB & hex values always seemed to be shifted a little too. While fixing the problem I figured I’d add a few new features. Heres a list of what’s changed in this version:

  • Fixed color space handling, Color Blender now accurately displays colors RGB & hex values no-matter what color space the color is in
  • Fixed some RGB rounding issues that would cause RGB values to be off by a 1 sometimes
  • The color blender window can be opened from the Window menu if it was closed
  • The color blender window is automatically brought to the front when the application is activated
  • Built as a Universal Binary, though its totally untested on intel macs (if you have a intel mac please email me!)

Enjoy!

Beta Testers Needed

You might have noticed the lack of updates on this site recently; its not just laziness (although that might be part of it :P ), I’m working on releasing a new (shareware) application. I’m almost done with the application, the web-site is nearing completion also so its time to beta test it. I’m looking for a bunch of beta testers, here are the requirements:

  • You must have OS X 10.4.x
  • You must have an iPod 3rd generation or higher

If you meet those requirements, or have an intel mac, please let me know.

Cocoa Text System

I came across an awesome article on the Cocoa Text System. If you do alot of text editing I recommend you check it out, along with the default key bindings.

Random Tid Bits

Heres some programming tid bits that really didn’t deserve their own post, so I grouped them all together into one post! :P

else-switch

We all know about the common

else-if

language construct that is available in almost all programming languages, but here one you might of not been aware of: the else-switch statement.

if(false) {
   
} else switch(number) {
    case 0:
        //do something
        break;
    case 1:
        //do something else
        break;
    default:
        //do default action
}

Actually, you can follow if with any control statement. For instance, you can have an else-return or an else-break statement. This might be old news to some programmers, but I never knew you could do that!

Declare Variables Inside a switch Statement

I never had to do this before, but recently I needed to declare some variables inside a switch statement. A little googling revealed that variable declaration inside a switch statement is possible:

switch(something) {
    case 1: {
        int a; //a variable is declared!
    }
}

All you have to do is enclose your

case

statement with brackets and you can define all the local variables you want.

Reset mySQL’s

auto_increment

I love mySQL’s auto increment feature, but while developing applications using mySQL I sometimes need to reset the auto_increment counter. The follow code snippet will reset your

auto_increment

so the next database record id will be 0:

ALTER TABLE your_table AUTO_INCREMENT = 0

Text Conversion Utility

MacDevCenter has a nice article on a ‘hidden’ text conversion utility,

textutil

thats bundled with the os x dev tools.

Javascript

Something that I’ve always hated about javascript is the lack of reusable libraries and classes. Finally their has been some movement to standardize alot of common javascript tasks, not just to post ad-hoc solutions on the various script sites out there. You can get a comprehensive list of the various libraries available here.

F-Script Anywhere

This is one of the coolest things that I’ve come across for OS X. F-Script anywhere lets you look inside a program while its running. You can call methods of objects, inspect the properties of UI elements. It’s pretty incredible. You’ll need to get the F-Script Framework before you can use the F-Script Anywhere SIMBL plug-in.

Objective-C Instance Variable Initialization

In objective-C their is no need to initialize your instance variables to nil/NULL (you normally should initialize all variables to nil/NULL, or some other initial value for reasons described in this article). This is already done for you in the

alloc

method of an object.

Carbon Data Types

Its hard to me to understand Carbon code well because of all the ‘opaque’ data types used by Carbon. At first glance what is

ItemCount

? Is it a

int

? An

unsigned int

? A

long

? Theirs no documentation of these data types in the Apple docs anywhere, so I went looking around to see if i could find the header files that contained the definitions for the various data types. Luckily my search was not in vain:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/

The above directory contains the definitions for most common Carbon data types, the majority of common Carbon data type definitions are located in the following header file:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacTypes.h

Initializing All Elements of a C-Array to 0

You can easily initialize all elements of a C array to zero by initializing the first element of the array to 0 using the “bracket initialization” method:

int intArray[1000] = {0};

The above code will initialize all 1000 elements of

intArray

to 0. All elements that aren’t given a initial value using “bracket initialization” are given an initial value of 0.