On Jul 15, 2014, at 10:20 AM, Jens Alfke wrote:
>
>
>> On Jul 15, 2014, at 9:50 AM, Carl Hoefs
>> wrote:
>>
>> Awesome! I had been wondering if this concept existed in Cocoa, didn't see
>> it in the NSData docs. It's sort of like using iovec structs with
>> readv/writev for sockets. I would
On Jul 15, 2014, at 9:50 AM, Carl Hoefs wrote:
> Awesome! I had been wondering if this concept existed in Cocoa, didn't see it
> in the NSData docs. It's sort of like using iovec structs with readv/writev
> for sockets. I would primarily use the dispatch_data_create_map() function,
> right? L
On Jul 15, 2014, at 1:45 AM, Mike Abdullah wrote:
>
> Another possibility is to use dispatch_data. Rather than copy bytes around to
> assemble them into a contiguous buffer, your use case might be just as well
> suited to dispatch_data’s approach of tying together various non-contiguous
> buff
On 15 Jul 2014, at 00:32, Jens Alfke wrote:
>
> On Jul 14, 2014, at 1:07 PM, Carl Hoefs
> wrote:
>
>>modifiableData = [ NSMutableData dataWithData: [ external call that gives
>> me an NSData ] ];
>
> It’s shorter and more idiomatic to just say
> modifiableData = [external mutable
On 15 Jul 2014, at 4:54 am, Jens Alfke wrote:
> The equivalent function in the ‘classic’ Mac OS had the very appropriate name
> of Munger( ) since it would munge bytes around in a heap block. Knowing how
> to use Munger was a sign of geek cred in the old (80s-90s) Mac dev community.
My god,
On Jul 14, 2014, at 1:07 PM, Carl Hoefs wrote:
> modifiableData = [ NSMutableData dataWithData: [ external call that gives
> me an NSData ] ];
It’s shorter and more idiomatic to just say
modifiableData = [external mutableCopy];
(plus an autorelease if you’re not using ARC)
> Will
On Jul 14, 2014, at 12:57 PM, "Gary L. Wade"
wrote:
> where you're creating the object
On Jul 14, 2014, at 12:53 PM, Jens Alfke wrote:
> If you’re the one creating the NSData object in the first place, can you
> create it as an NSMutableData?
Certainly that makes sense enough, just hoping
The reason you can't do exactly what you're asking is because there may be
other owners of the immutable object. Since NSMutableData is a subclass of
NSData, you should ask yourself where you're creating the object and try
creating it from the start as mutable, and also if there are owners of th
On Jul 14, 2014, at 12:15 PM, Carl Hoefs wrote:
> Okay, 1 last question on this. Is there a way to promote-in-place an NSData
> object into an NSMutableData object? -becomeMutable or some such? I'm trying
> to avoid copying megabytes of data/sec if it's avoidable.
Nope. Part of the contract
in my mind that
>> the one couldn't do the other. But that's the whole purpose of the NSRange.
>> Very cool.
>
> The equivalent function in the ‘classic’ Mac OS had the very appropriate name
> of Munger( ) since it would munge bytes around in a heap block. Knowing how
On Jul 14, 2014, at 11:48 AM, Carl Hoefs wrote:
> Yes, I guess it's the semantics that threw me. I was attempting to
> "insertBytesInRange" not "replaceBytesInRange", so I had it in my mind that
> the one couldn't do the other. But that's the whol
ot; not "replaceBytesInRange", so I had it in my mind that the
one couldn't do the other. But that's the whole purpose of the NSRange. Very
cool.
-Carl
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin
On 14 Jul 2014, at 11:30 am, Carl Hoefs wrote:
>> [bigMData replaceBytesInRange:NSMakeRange(0,0) withBytes:newBytesPtr
>> length:1024];
>
> Wow, that's damn clever! My thinking is so clunky. It never would have
> occurred to me that NSMutableData could expand (0,0) into (0,1024) out of
> thin
On Jul 14, 2014, at 11:22 AM, Mike Abdullah wrote:
> [bigMData replaceBytesInRange:NSMakeRange(0,0)
>withBytes:newBytesPtr
> length:1024];
On Jul 14, 2014, at 11:23 AM, Ben Kennedy wrote:
> [bigMData replaceBytesInRan
On 14 Jul 2014, at 11:12 am, Carl Hoefs wrote:
> Okay, now if I want to insert 1024 bytes of new data at the beginning of a
> populated NSMutableArray, is there a better way than this:
Sure; why not just do [bigMData replaceBytesInRange:NSMakeRange(0,0)
withBytes:newBytesPtr length:1024]; ...
On 14 Jul 2014, at 19:12, Carl Hoefs wrote:
> Okay, now if I want to insert 1024 bytes of new data at the beginning of a
> populated NSMutableArray, is there a better way than this:
Yes.
[bigMData replaceBytesInRange:NSMakeRange(0,0)
withBytes:newBytesPtr
is well optimized for shunting its contents around
> internally.
>
> Matt
>
>
> On 12 Jul 2014, at 20:36, Carl Hoefs wrote:
>
>> Basically what I would like is an NSMutableData method like this:
>>
>> - (void)resetDataRangeTo:(NSRange)range
>>
>>
On Saturday, July 12, 2014, Carl Hoefs
wrote:
> On Jul 12, 2014, at 1:51 PM, Matt Gough > wrote:
>
> > [bigData replaceBytesInRange:NSMakeRange(0, 1024) withBytes:NULL
> length:0];
>
> Wow, I would never have thought to do that! Works perfectly!
You could also declare a category on NSMutableDa
On Jul 12, 2014, at 1:51 PM, Matt Gough wrote:
> [bigData replaceBytesInRange:NSMakeRange(0, 1024) withBytes:NULL length:0];
Wow, I would never have thought to do that! Works perfectly!
Thx,
-Carl
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com
ata method like this:
>
> - (void)resetDataRangeTo:(NSRange)range
>
> Parameters
> range
> The range within the contents of the receiver to be considered the new
> contents.
>
>
> But, since that doesn't exist yet, is it safe to "shift" the contents in
Basically what I would like is an NSMutableData method like this:
- (void)resetDataRangeTo:(NSRange)range
Parameters
range
The range within the contents of the receiver to be considered the new contents.
But, since that doesn't exist yet, is it safe to "shift" the contents
On Dec 14, 2010, at 9:58 AM, Matt Neuburg wrote:
> I recognize that the conversion is not simple, but that is exactly why I am
> surprised that the frameworks do not supply a utility conversion method. If I
> were to write my own I would surely get it wrong.
The size & layout of the members is
On Sun, 12 Dec 2010 08:04:55 -0800, "John C. Randolph" said:
>
>On Dec 12, 2010, at 7:34 AM, Matt Neuburg wrote:
>
>> I feel like I'm missing something. I can't seem to typecast as
>> CFRange to an NSRange. I know I can pull a CFRange apart and
>
On Dec 13, 2010, at 04:02, John Engelhart wrote:
> So, to the original poster- it's sort of like "Why is the sky blue?"
> There's actually a good answer, but it's unbelievably complex and
> convoluted.
"So you know where to stop mowing."
___
Cocoa-dev
On Sun, Dec 12, 2010 at 11:51 AM, Andreas Grosam wrote:
>
> On Dec 12, 2010, at 4:34 PM, Matt Neuburg wrote:
>
> > I feel like I'm missing something. I can't seem to typecast as CFRange to
> an NSRange.
>
> Both are distinct C structs. In C, *explicitly* type
On Dec 12, 2010, at 4:34 PM, Matt Neuburg wrote:
> I feel like I'm missing something. I can't seem to typecast as CFRange to an
> NSRange.
Both are distinct C structs. In C, *explicitly* typecasting one pointer to the
other would be allowed but semantically incorrect. In C++ c
On Dec 12, 2010, at 7:34 AM, Matt Neuburg wrote:
I feel like I'm missing something. I can't seem to typecast as
CFRange to an NSRange. I know I can pull a CFRange apart and
reassemble it as an NSRange, but shouldn't there be a simpler way? m.
CFRange is defined as a pair of
I feel like I'm missing something. I can't seem to typecast as CFRange to an
NSRange. I know I can pull a CFRange apart and reassemble it as an NSRange, but
shouldn't there be a simpler way? m.
--
matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/>
Re: Saving a PDF Selection or converting it to an NSRange and back
> To save a selection sapnning multiple pages you could
> convert a single selection into an array of single-line
> selections (-[PDFSelection selectionsByLine]). Each
> selection returned by this method is going to be on a
On Feb 11, 2009, at 12:44 PM, Keith Blount wrote:
The subject line says it all, really, I need to save a PDFSelection
between sessions in my program, but there seems no way of doing
this. A similar question came up on these last year but there was no
solution:
To save a selection sapnning
Hi,
The subject line says it all, really, I need to save a PDFSelection between
sessions in my program, but there seems no way of doing this. A similar
question came up on these last year but there was no solution:
http://www.cocoabuilder.com/archive/message/cocoa/2008/5/16/206893
(Or at least
o do that, when NSXML will do the parsing for you.
Learn XPath and you can extract things like your example in one line
of code.
I have heard of NSRange but I can't find documentation to it in xcode.
Just open the documentation window and type "NSRange" into the search
fiel
On May 14, 2008, at 7:25 PM, Mr. Gecko wrote:
Hello I am trying to find out how to get characters in the middle of
two characters I have heard of NSRange but I can't find
documentation to it in xcode.
Enter "NSRange" in the search field of the Xcode documentation window
I figured it out
NSString *s = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.example.com/file.html
"]];
NSRange f, l;
f = [s rangeOfString:@" title=\"Title\">"];
if (f.location == NSNotFound) NSLog(@"failed");
s = [s substri
On May 14, 2008, at 5:25 PM, Mr. Gecko wrote:
Hello I am trying to find out how to get characters in the middle of
two characters I have heard of NSRange but I can't find
documentation to it in xcode.
>
So here is what I am trying to do in this html page on line there
are t
Hello I am trying to find out how to get characters in the middle of
two characters I have heard of NSRange but I can't find documentation
to it in xcode.
So here is what I am trying to do in this html page on line there are
to points which stays the same and in the middle of the poin
36 matches
Mail list logo