Ali Ozer | 1 Nov 2005 01:19
Picon
Favicon

Re: NSData - Swap bytes?

CFString has encoding constants to explicitly specify the bytes as  
little endian or big endian. These constants didn't make their way  
into NSString yet, but you can specify  
CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingUTF16LE)  
as the NSStringEncoding argument to initWithData:encoding:.  This way  
you wouldn't be swapping the NSData contents, but telling NSString to  
do the swapping.
Ali

Begin forwarded message:

> From: Paul <paul@...>
> Date: October 31, 2005 15:53:07 PST
> To: omni-osx-dev <macosx-dev@...>
> Subject: NSData - Swap bytes?
>
> Hi everyone,
> Please oh please can someone tell me how to swap bytes contained in  
> an NSData obj.
>
> I have read in bytes from a little endian file ... the string is  
> encoded as 48006f00 6d006500.... which is a UTF16 string . .single  
> ascii chars separated by 0's
>
> So I have read the data into an NSData object and now am wanting to  
> copy my bytes into an NSString object with initWithData: mystring  
> encoding:NSUnicodeStringEncoding but I need to swap the bytes in  
> the data obj before I can do so.
>
> Any suggestions/tips would be greatly appreciated.
(Continue reading)

Bob Ippolito | 1 Nov 2005 01:29
Gravatar

Re: CFSwap* vs. OSSwap*


On Oct 31, 2005, at 3:21 PM, Jonathan Grynspan wrote:

> Is there an advantage to using the CFSwap* functions/macros over  
> the OSSwap* functions/macros? Is one faster than the other? Or are  
> they just two different bits for the same kind of screw?
>
> Apple's docs list both, but don't seem to recommend the use of one  
> over the other (unless I'm missing something.)

Looks like the universal notes say that you generally should be using  
OSSwap functions.

http://developer.apple.com/documentation/MacOSX/Conceptual/ 
universal_binary/universal_binary_byte_swap/chapter_4_section_5.html

-bob
David Dunham | 1 Nov 2005 04:20
Picon

Re: changeFont: on multiple text items

On 31 Oct 2005, at 10:56, Douglas Davidson wrote:

> changeFont: and changeColor: are responder methods, implemented by  
> NSTextView.

I was confused by the fact that they show up as NSObject methods in  
Xcode's Documentation window. Probably because they're an NSObject  
category, not an NSResponder category?

> it is easy to change colors or fonts in a text storage.   
> NSTextStorage is a subclass of NSMutableAttributedString, and  
> responds to methods like addAttribute:value:range:.

Thanks, got it working. (This would be good sample code to add to  
Sketch, BTW.)

David Dunham     A Sharp, LLC
Voice/Fax: 206 783 7404     http://a-sharp.com
Efficiency is intelligent laziness.
Michael Dupuis | 1 Nov 2005 04:29
Picon
Favicon

Re: Building SQLite 3 on Tiger, deploying on Panther?

> I suspect it's likely to matter a lot. If you're
building for
> Panther, you need to be sure you're building for
Panther. And using
> gcc 3.3.

Hm, ok, I just tried setting the minimum target to
10.3/gcc 3.3, instead of the default, and I still get
an error that the application is looking for a
non-existent dynamically linked SQLite library on
Panther. Shouldn't it be using the framework I've
explicitly added, instead of setting the application
up to use a dynamic library, like it's running on
Tiger? The executable in each case is clearly not
including the library, based on the size. Note also
that if I make a new project and build it on Panther,
that it will run on both, but this isn't really an
option as the development and build machines are
running Tiger, not Panther, and I really just want to
ensure backwards compatibility to 10.3, which would
work fine (I'm not using any frameworks from Tiger,
other than SQLite, which I'm trying to use my own
version of anyway) if I could just get a build that
statically linked my library. I'm clearing doing
something wrong, or forgetting something else.

Thanks again.

	
		
(Continue reading)

David Dunham | 1 Nov 2005 05:46
Picon

Easier copyWithZone:

Is there some Objective-C equivalent to the default copy-constructor,  
which copies all the bits of one object to another? Or the direct  
copying you can do in C++

Object::Object(const Object& anObject) {
     fVar1 = anObject.var1;
     fVar2 = anObject.var2;
}

without a ton of message sending?

David Dunham     A Sharp, LLC
Voice/Fax: 206 783 7404     http://a-sharp.com
"People seem to misinterpret complexity as sophistication" -- Niklaus  
Wirth
Michael Dupuis | 1 Nov 2005 12:26
Picon
Favicon

Re: Building SQLite 3 on Tiger, deploying on Panther?

> I just tried setting the minimum target to
> 10.3/gcc 3.3, instead of the default, and I still
get
> an error that the application is looking for a
> non-existent dynamically linked SQLite library on
> Panther.

Never mind. I missed a setting. Thanks for pointing me
in the right direction David. This hasn't been an
issue for me until now, as for the most part I had no
dependancies on any particular OS framework.

	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com
Philippe Mougin | 1 Nov 2005 13:18
Picon
Favicon

Re: Easier copyWithZone:

David Dunham wrote:

 > Is there some Objective-C equivalent to the default
 > copy-constructor, which copies all the bits of one object
 > to another? Or the direct copying you can do in C++
 >
 > Object::Object(const Object& anObject) {
 >    fVar1 = anObject.var1;
 >    fVar2 = anObject.var2;
 > }
 >
 > without a ton of message sending?

Look for the NSCopyObject function in the documentation. This might  
be what you want.

Best,

-- Philippe Mougin
F-Script: open source scripting language for Cocoa
http://www.fscript.org
Matt Neuburg | 1 Nov 2005 18:29
Favicon
Gravatar

Re: Background use of OSX apps (e.g., via AppleScript)?

On Tue, 25 Oct 2005 08:10:40 -0700, Rich Morin <rdm@...> said:
>joar sez:
>>It sounds like a job for AppleScript.
>>Graffle needs to be scriptable for this to work though.
>
>As mu subject line indicated, I already had a suspicion of this.
>
>larkost sez:
>>And luckily enough... it is.
>
>That's really nice to have confirmed, as well.
>
>Now, could someone give me a few specifics?  Like what AS command(s)
>to look up to get an app to launch itself "in the background"?

Tell the app to launch. (That answer comes from my book; if you don't know
AppleScript, my book teaches it to you.) m.

--

-- 
matt neuburg, phd = matt@..., <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
j o a r | 1 Nov 2005 18:34

Re: Background use of OSX apps (e.g., via AppleScript)?


On 1 nov 2005, at 18.29, Matt Neuburg wrote:

> Tell the app to launch. (That answer comes from my book; if you  
> don't know
> AppleScript, my book teaches it to you.) m.

<LOL>

Subtle!   :-D

j o a r
Rich Morin | 1 Nov 2005 18:51
Favicon
Gravatar

Re: Background use of OSX apps (e.g., via AppleScript)?

At 9:29 AM -0800 11/1/05, Matt Neuburg wrote:
>Tell the app to launch. (That answer comes from my book; if you don't know
>AppleScript, my book teaches it to you.) m.

Actually, I already knew that the "launch" command can be used to
start up an app.  The question, however, is more specific than this.
I want the application to run "in the background" (aka "faceless"),
so that it doesn't try to interact with the mouse, screen, etc.

I already have three AppleScript books, but none of them addresses
this question.  I would gladly get yours if it gave a detailed,
specific description of how to do this.

-r
--

-- 
email: rdm@...; phone: +1 650-873-7841
http://www.cfcl.com        - Canta Forda Computer Laboratory
http://www.cfcl.com/Meta   - The FreeBSD Browser, Meta Project, etc.

Gmane