IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New PyObjC
There is a python bridge to ObjectiveC so you can have your cake and still get fat.

[link|http://www.macdevcenter.com/pub/a/mac/2003/01/31/pyobjc_one.html|http://www.macdevcen...1/pyobjc_one.html]

But if you can use ObjectiveC then I'd recommend FScript for your scripting environment.

[link|http://www.fscript.org|http://www.fscript.org]

I have a lovely fscript/clips/Objective C bridge for doing expert systems using Objective C objects as facts and fscripts as rule actions.

If you are going to do a serialization format then I recommend PLists (ObjectiveC style property lists). The parser is *very* easy to write (compared to dealing with xml parsers). I have one you can have in Java - porting it should be easy. A PList element is a dictionary, list, or string.

{ key1 = value1; key2 = value2; } // this is a dictionary
( one, two, three ) // this is a list
a string is either a token (letters, underbars, and numbers with no spaces or punctuation) or it is quoted and follows C-style escaping conventions (ie \\n is newline, \\t is tab).

You can combine these in any combination. Example

{
CDCollection = (
{ artist = Prince; title = 1999; tracks = (); },
{ artist = "Thomas Dolby"; title = "Aliens Ate My Buick"; tracks = ( "Key to her Ferrari", Airhead, "Hot Sauce", "Budapest by Blimp"); },
{ artist = Eurithmics; title = 1984; tracks = (); });
Owner = "Todd Blanchard";
}

With a little extension (found in ObjectiveC and in my java lib) you can use keyvalue coding to do extractions. For instance:

[dict valueForKeyPath: @"CDCollection.artist"]

Will return a list of artists. This is amazingly handy for binding complex data locations to GUI elements.

So there's a lot to like about PLists as a serialization format. They are readable and you can read/write them in one statement.

I steer clear of XML whenever possible.



"Packed like lemmings into shiny metal boxes.
Contestants in a suicidal race."
    - Synchronicity II - The Police
Expand Edited by tuberculosis Aug. 21, 2007, 06:23:40 AM EDT
New plist parsers...
I didn't think you needed to write a parser for that... just use the NSData dataWithContentsOfFile: method.

PyObjC looks very cool... one less thing that I need to write now. ;-) I can't tell from the website whether it's OS-X only or not.

I'd have the same question about f-script. The advantage of using Python is that the knowledge has wide application.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Re: plist parsers...
Right, you don't need to write a parser if you're using ObjectiveC - its baked in. But if you're using Java, or Python sans ObjC, you will need to write one (well, for Java you can use mine). I don't have one in Python though.

FScript is basically smalltalk scripting using ObjectiveC objects. It does math with NSNumbers and supports Blocks (something we miss very much in ObjectiveC).

So you can do something like:

myNSArray do: [:ea | ea doSomethingCool].

Its just smalltalk scripting though - it has no support for making new classes. OTOH, you can pass around FScript Blocks - which are arbitrary code. If you're doing ObjectiveC and you need to provide user scripting, FScript is the bomb.

There's been a nifty hack called FScriptAnywhere that will fiddle an application's framework list to pull in FScript and put an FScript menu item on the menubar. There's also a GUI object inspector/navigator that you can use to dig around in a program. So you can monkey with objects in other people's applications and add new menu commands. Its pretty cool.




"Packed like lemmings into shiny metal boxes.
Contestants in a suicidal race."
    - Synchronicity II - The Police
Expand Edited by tuberculosis Aug. 21, 2007, 06:23:49 AM EDT
     External data philosophy - (inthane-chan) - (15)
         Some points to consider: - (admin) - (14)
             The data needs to be human readable/writeable. - (inthane-chan) - (13)
                 Use XML then. - (admin) - (6)
                     Damn, it's a reeses commercial! - (inthane-chan) - (2)
                         Anywhere you can run gcc - with a caveat: - (admin) - (1)
                             Re: Anywhere you can run gcc - with a caveat: - (deSitter)
                     PyObjC - (tuberculosis) - (2)
                         plist parsers... - (admin) - (1)
                             Re: plist parsers... - (tuberculosis)
                 First co-op project? - (tseliot) - (5)
                     (Which will be great when I grok WTF that means... ;-) ) -NT - (inthane-chan) - (4)
                         It basically means - (tseliot) - (3)
                             On the other hand... - (admin) - (2)
                                 On the gripping hand: - (admin)
                                 True - (tseliot)

Who left that on the floor?
87 ms