Ok. It works. Instead of subclassing NSXMLParser I created my own Class with
implementation of the NSXMLParserDelegate Protocol. I create a NSXMLParser
object and set the delegate to an created object of my subclassed
NSXMLParserDelegate.
> Whenever I hear this from a programmer, I cringe. It'
On Apr 16, 2010, at 4:05 PM, Ben Haller wrote:
> So I'm keeping an "unused pool" of these objects, and when I'm done with an
> object I throw it into the pool, and when I need a new one I grab one from
> the pool. I do these operations with inline functions, so I can get a new
> object instan
I have been trying to move a UIView by following a users touch. I
have almost got it to work except for one thing, the UIView keeps
flicking between two places.
The Code I Have Been Using and What's been Happening.
___
Cocoa-dev mailing list (Cocoa-d
So, thoughts? Am I insane? Is the above scheme safe? Is there a
better way? Thanks for any feedback!
(I think this question is appropriate for cocoa-dev rather than the
objc-language list, but my apologies if I have posted to the wrong
forum...)
My question to you would be: have you p
This probably takes more time than allocating a new object :-)
My company uses it to scramble memory for invalidated objects that hang
around for a while, to force crashes if accessed (id object addresses
will be bogus).
David
---
void clearIvars(id obj)
{
unsigned int outCount = 0;
3. bzero(individual + individualIvarsOffset, individualIvarsSize);
This should cast "individual" to void* before doing the pointer
arithmetic, of course.
And of course by "void*" you meant "uint8_t*". Pointer arithmetic
is undefined on voids... it happens to be supported by gcc & clang
On 16-Apr-10, at 6:34 PM, Paul Sanders wrote:
Another way might be to provide a method in each class or subclass
called, say, zeroIVars and code it as (typed in mail):
- (void) zeroIVars
{
static ThisClass *clean_instance_of_this_class;
assert ([self isMemberOfClass: [ThisClass class
Hi,
I was working with NSTask and came across some issues. I searched on the
internet and found that there has been a similar query but that didn't have
any solution. The link for that is
http://lists.apple.com/archives/cocoa-dev//2003/May/msg01468.html. Could you
suggest any possible solution for
> Yep, it's a big win. Even if the default allocator does something
> similar (and I think you're right that a linked list of free blocks of
> a given size is maintained by the malloc code, or something of that
> sort), this scheme avoids a fair handful of method calls and function
> calls
On 17-Apr-10, at 7:01 AM, Ken Thomases wrote:
On Apr 16, 2010, at 4:05 PM, Ben Haller wrote:
So I'm keeping an "unused pool" of these objects, and when I'm done
with an object I throw it into the pool, and when I need a new one
I grab one from the pool. I do these operations with inline
On 17-Apr-10, at 9:14 AM, Paul Sanders wrote:
> Yep, it's a big win. Even if the default allocator does something
> similar (and I think you're right that a linked list of free
blocks of
> a given size is maintained by the malloc code, or something of that
> sort), this scheme avoids a fair
On Apr 17, 2010, at 8:14 AM, Gaurav Srivastava wrote:
> I was working with NSTask and came across some issues. I searched on the
> internet and found that there has been a similar query but that didn't have
> any solution. The link for that is
> http://lists.apple.com/archives/cocoa-dev//2003/May/
On Apr 16, 2010, at 5:34 PM, Paul Sanders wrote:
> Another way might be to provide a method in each class or subclass called,
> say, zeroIVars and code it as (typed in mail):
>
> - (void) zeroIVars
> {
>static ThisClass *clean_instance_of_this_class;
>
>assert ([self isMemberOfClass: [T
> As I mentioned in my post to Graham just now, doesn't your
> implementation assume that NSObject's only ivar is the isa
> pointer,
> though?
Actually, no. Because it makes a bitwise copy of a clean,
properly init'ed object it should work whatever trickery
NSObject (or any other parent class)
> To be clear (for the archives), the above byte-wise copy of the object is
> only safe if the class has no pointers with ownership
> semantics among its instance variables. See the discussion of object copying
> in the Memory Management Guide.
Yes, of course. I took that as a given, based on t
On Apr 17, 2010, at 8:53 AM, Paul Sanders wrote:
> Something I've never been clear about though is
> where an object's retain count is stored. This obviously
> requires an iVar somewhere (in addition to isA), so there might
> be a trap for the unwary there [...]
My understanding, which is vag
Le 17 avr. 2010 à 16:16, Ken Thomases a écrit :
> On Apr 17, 2010, at 8:53 AM, Paul Sanders wrote:
>
>> Something I've never been clear about though is
>> where an object's retain count is stored. This obviously
>> requires an iVar somewhere (in addition to isA), so there might
>> be a trap
> My understanding, which is vague and for which I have no references, is that
> it's handled in a manner similar to
> what was recently exposed via the associated references API (i.e.
> objc_setAssociatedObject and friends).
>
> That is, retain counts are stored outside of the instance.
In that
On Apr 17, 2010, at 9:37 AM, Paul Sanders wrote:
> > That is, retain counts are stored outside of the instance.
> In that case there is a danger that a pointer to whatever is referenced would
> be transferred to the copy of the object, which is not what you want.
No, you misunderstand. There is
On Apr 17, 2010, at 9:35 AM, Jean-Daniel Dupas wrote:
> That said, this is an implementation details.
>
> IIRC, GnuStep used to store the retain count in 4 additional bytes allocated
> before each object.
>
> uint32_t *rc = (uint8_t *)self - 4;
Well, it's an implementation detail of which you
On 17.04.10 16:47, Ken Thomases wrote:
On Apr 17, 2010, at 9:37 AM, Paul Sanders wrote:
That is, retain counts are stored outside of the instance.
In that case there is a danger that a pointer to whatever is referenced would
be transferred to the copy of the object, which is not what you want.
> AFAIK, CF objects store the retain count in an "ivar" (or a struct field to
> be exact) and
> standard Obj-C objects ref count is stored in an external hash collection
> (CFBasicHash on 10.6).
One might get away with it then, as presumably the hash key is the address of
the object and that i
> No, you misunderstand. There is (in the scheme I'm vaguely recalling)
> _nothing_ inside the instances
> which holds or points to something which holds the retain count.
>
> There is another data structure entirely which maps from object addresses to
> a retain count.
Yes I see, that's also w
Ben Haller (bhcocoa...@sticksoftware.com) on 2010-04-17 09:06 said:
>>> This should cast "individual" to void* before doing the pointer
>>> arithmetic, of course.
>>
>> And of course by "void*" you meant "uint8_t*". Pointer arithmetic
>> is undefined on voids... it happens to be supported by gcc
On Apr 17, 2010, at 9:53 AM, Uli Kusterer wrote:
> On 17.04.10 16:47, Ken Thomases wrote:
>> On Apr 17, 2010, at 9:37 AM, Paul Sanders wrote:
That is, retain counts are stored outside of the instance.
>>> In that case there is a danger that a pointer to whatever is referenced
>>> would be tr
> The question is: Is it documented as a fact you can rely on that this is
> the case? If not, I at least wouldn't rely on it for shipping code. Even
> if it was for an "at home" project I'd think about it long and hard.
> Tracking down subtle memory bugs caused by Apple deciding to move the
>
I acutally think i May have found this one.. We had some racing conditions that
seems to have been reeking havoc in our heavily threaded code and the KVO we
are using..
Scott
On Apr 15, 2010, at 6:12 PM, Ken Thomases wrote:
> On Apr 15, 2010, at 11:03 AM,
> wrote:
>
>> Unfortunately i have
> I know of three frameworks that provide controls for use in HUD windows (in
> order of recommendation):
>
> BWToolkit - http://www.brandonwalkin.com/bwtoolkit/
> BGHUDAppKit - http://www.binarymethod.com/bghudappkit/
> HMBlkAppKit - http://shiira.jp/hmblkappkit/en.html
Thanks a lot to both. BW
Gathering up a few loose ends...
On 17-Apr-10, at 11:11 AM, Paul Sanders wrote:
I reckon my scheme might actually be faster Ben, if you benchmark
it. Without the assert it's just a method call and a memcpy, which
the compiler knows the size of and can therefore optimise. Only you
can
On 16 Apr 2010, at 11:34 AM, Alexander Spohr wrote:
> Yes. The docs state:
> -parse
> Starts the event-driven parsing operation.
>
> That means that -parse does not block. It runs in the event loop.
> So the parser starts running and wants to talk to its delegate. But too bad -
> you released it
Hi all
I've been testing the CoreServices with WebServices lately and had some issues
with methods returning arrays.
We've setup a very simple Web Service with a method that returns an array of
strings. My problem here is that when I get the results out of the NSDictionary
returned by WSMethod
On 17 Apr 2010, at 11:44 AM, Fritz Anderson wrote:
> I have not found this to be the case. In the context of the documents, and of
> the customary terms for XML parsing, "event-driven" parsing, provided by
> NSXMLParser, means that the parser yields elements one-by-one as it steps
> through the
> I think my approach, with the excellent modifications suggested by
> Ken Thomases, makes me less nervous than the others proposed, since it
> touches only my own ivars and makes no assumptions about the nature of
> the rest of the bits in the object.
OK, best of luck. I think that 64-bit
I have been hacking at the code from the iphone cookbook trying to get
a UIScrollView to fetch Core Data sql.
I checked the archives first and did not find anything. I know that
tableviews work hand in hand with Core Data.
Every tutorial I can find verifies this.
-coder boy
___
Hi Ken,
Thanks for the prompt reply. I got a better insight into the APIs. But
somehow I am not able to fix my problem.
I am using following:
NSTask* task = [NSTask launchedTaskWithLaunchPath:@"path" arguments:args];
int pid = [task processIdentifier];
ProcessSerialNumber psn;
GetProcessForPID(
I have a couple of node-based classes, one to build a Lempel-Ziv tree
(Incremental Parsing) and one to build a Trie. Both of these classes have an
-initWithParent: method. Should be fine, I would think, but I'm getting a
compiler error that a Trie node's initWithParent is expecting the Lempel-Zi
On 17 Apr 2010, at 12:35 PM, colo wrote:
> I have been hacking at the code from the iphone cookbook trying to get
> a UIScrollView to fetch Core Data sql.
> I checked the archives first and did not find anything. I know that
> tableviews work hand in hand with Core Data.
> Every tutorial I can fin
Try this Core Data tutorial:
http://developer.apple.com/iphone/library/documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html
You likely need to better understand the relationship between a
UITableViewController and an NSFetchedResultsController ...
-Luther
On
Thank you Fritz. That actually brought a lot of clarity to the
subject. I was not looking for anything concrete just a proper way to
view the necessary actions to take.
And thank you Luther I'll look over that link again.
On Sat, Apr 17, 2010 at 2:02 PM, Fritz Anderson wrote:
> On 17 Apr 2010
On 17 Apr 2010, at 1:02 PM, James Maxwell wrote:
> I have a couple of node-based classes, one to build a Lempel-Ziv tree
> (Incremental Parsing) and one to build a Trie. Both of these classes have an
> -initWithParent: method. Should be fine, I would think, but I'm getting a
> compiler error th
Not sure what I'm missing here but obviously, I'm missing something. If I
create a project based on a navigation controller and override
'shouldAutorotateToInterfaceOrientation:' to return YES all the time, when the
device is rotated, the tableview correctly rotates and resizes itself.
However,
Each respective's tab's viewController must return YES from
shouldAutorotateToInterfaceOrientation for the tabBarController to autorotate,
not just the currently visible one.
Luke
On Apr 17, 2010, at 11:48 AM, Laurent Daudelin wrote:
> Not sure what I'm missing here but obviously, I'm missing
Hi, All,
Am trying to debug an app, which crashes in 10.4 when I build it with
10.5 SDK and 10.4 deployment target, but works OK when is built with
10.4 SDK and 10.4 deployment target. All builds are performed in 10.5
I'm getting these lines in crash log:
Thread 0 Crashed:
0 libSystem.B.
On Apr 16, 2010, at 10:47 AM, Kyle Sluder wrote:
> On Fri, Apr 16, 2010 at 10:37 AM, Corbin Dunn wrote:
>> You can't control it in IB (short of removing the view and adding it back
>> in). But in code, you can just call -addSubview:positioned:relativeTo: to
>> move views around in the Z order.
On Apr 17, 2010, at 12:18 PM, Alexander Bokovikov wrote:
> *** _NSAutoreleaseNoPool(): Object 0x209fa0 of class NSCFString autoreleased
> with no pool in place - just leaking
Set a breakpoint at _NSAutoreleaseNoPool and start the app. That should show
you where it’s happening. Most likely you
On Apr 17, 2010, at 10:43 AM, Gaurav Srivastava wrote:
> NSTask* task = [NSTask launchedTaskWithLaunchPath:@"path" arguments:args];
OK, but that’s the code you already know doesn’t work, thanks to the previous
reply, right? Use LaunchServices or NSWorkspace.
> Even on switching to NSWorkSpace
On Apr 16, 2010, at 9:48 AM, Kyle Sluder wrote:
>> It works OK with non layer-backed views in my experience, but you do get a
>> build warning if sibling views overlap in a nib. Sibling views are drawn in
>> the order they appear in the parent's list of subviews (or possibly the
>> inverse or
On Apr 17, 2010, at 12:43 PM, Gaurav Srivastava wrote:
> I am using following:
>
> NSTask* task = [NSTask launchedTaskWithLaunchPath:@"path" arguments:args];
> int pid = [task processIdentifier];
> ProcessSerialNumber psn;
> GetProcessForPID(pid, &psn);
> SetFrontProcess(&psn);
> [task waitUntil
On 18.04.2010, at 1:30, Jens Alfke wrote:
On Apr 17, 2010, at 12:18 PM, Alexander Bokovikov wrote:
*** _NSAutoreleaseNoPool(): Object 0x209fa0 of class NSCFString
autoreleased with no pool in place - just leaking
Set a breakpoint at _NSAutoreleaseNoPool and start the app. That
should sh
Hi,
I have an xml document of structure say
.
.
.
Element B can occur in another document
.
.
.
I have been going through NSXMLParser (on the iPhone) and can parse
document A by setting the d
> It's not particularly tricky. +alloc returns an id, and Objective-C doesn't
> have operand-overloaded methods.
> There is nothing in your alloc/init expression that tells the _compiler_
> which of the differently-defined initWithParent:
> methods you intend to use, so it picks one in some undef
On 18.04.2010, at 1:29, Jonathan Hess wrote:
On Apr 16, 2010, at 10:47 AM, Kyle Sluder wrote:
On Fri, Apr 16, 2010 at 10:37 AM, Corbin Dunn
wrote:
You can't control it in IB (short of removing the view and adding
it back in). But in code, you can just call -
addSubview:positioned:relati
On Apr 17, 2010, at 2:39 PM, Alexander Bokovikov wrote:
> On 18.04.2010, at 1:30, Jens Alfke wrote:
>
>>
>> On Apr 17, 2010, at 12:18 PM, Alexander Bokovikov wrote:
>>
>>> *** _NSAutoreleaseNoPool(): Object 0x209fa0 of class NSCFString
>>> autoreleased with no pool in place - just leaking
>>
On Apr 17, 2010, at 3:39 PM, Alexander Bokovikov wrote:
>
> On 18.04.2010, at 1:30, Jens Alfke wrote:
>
>>
>> On Apr 17, 2010, at 12:18 PM, Alexander Bokovikov wrote:
>>
>>> *** _NSAutoreleaseNoPool(): Object 0x209fa0 of class NSCFString
>>> autoreleased with no pool in place - just leaking
On Apr 17, 2010, at 12:50 PM, Alexander Bokovikov wrote:
>
> On 18.04.2010, at 1:29, Jonathan Hess wrote:
>
>>
>> On Apr 16, 2010, at 10:47 AM, Kyle Sluder wrote:
>>
>>> On Fri, Apr 16, 2010 at 10:37 AM, Corbin Dunn wrote:
You can't control it in IB (short of removing the view and addin
Thanks folks,
I actually did wind up type casting the alloc, as recommended. Sorry I didn't
post when I found the solution.
I guess I've just never come across this before, which seems kind of strange...
but true.
cheers,
J.
On 2010-04-17, at 12:42 PM, Paul Sanders wrote:
> > It's not part
On 17.04.10 22:24, James Maxwell wrote:
I actually did wind up type casting the alloc, as recommended. Sorry I didn't
post when I found the solution.
I guess I've just never come across this before, which seems kind of strange...
but true.
By the way: An even better idea is to just change the
yes, good point. That would certainly make things simpler.
J.
On 2010-04-17, at 1:31 PM, Uli Kusterer wrote:
> On 17.04.10 22:24, James Maxwell wrote:
>> I actually did wind up type casting the alloc, as recommended. Sorry I
>> didn't post when I found the solution.
>> I guess I've just never
On Apr 17, 2010, at 8:34 AM, Ben Haller wrote:
>> Lastly, if your objects are so simple (direct subclasses or NSObject, no
>> pointer ivars, etc.), have you considered using plain C structs instead of
>> objects? Or C++ objects and collections? I'm not saying you necessarily
>> should use tho
I have two buttons in a view, side by side. Their autoresizingMask
are both NSViewMaxXMargin + NSViewMaxYMargin
When their containing view is resized only the left button behaves
properly. The right button stays fixed.
Why?
Before resize:http://highrolls.net/Before Resize.png
After res
Well, I thought about this and checked my xib. I then realized that the default
TabBarController was a UITabBarController. The documentation says that, by
default, controllers will only return YES from
shouldAutorotateToInterfaceOrientation when the orientation is portrait. So, I
did subclass t
On Sat, Apr 17, 2010 at 2:01 PM, Charles Srstka
wrote:
> How about just giving your object only one instance variable, which is a
> pointer to a C struct, with all the object’s accessor methods pointing to
> elements in the struct? Then, all you’d have to do would be to swap out the
> struct fo
How do I get the mount point path of a freshly mounted volume in
Snow Leopard?
In Leopard (10.5), the NSWorkspaceDidMountNotification included
an NSDevicePath value. It contained the path to the mount point
of the freshly mounted volume.
In Snow Leopard (10.6), this property has been depreca
On Sat, Apr 17, 2010 at 4:46 PM, James Bucanek wrote:
> The path "/Dinah" is (obviously) invalid.
Actually, it's annoyingly not invalid. Finder > Go To URL > "/Dinah"
will actually work. It really stinks if you mount a volume named
something like "Users"... >:(
Please add to the pile of bugs on
On Apr 17, 2010, at 6:46 PM, James Bucanek wrote:
> How do I get the mount point path of a freshly mounted volume in Snow Leopard?
>
> In Leopard (10.5), the NSWorkspaceDidMountNotification included an
> NSDevicePath value. It contained the path to the mount point of the freshly
> mounted volum
On Apr 17, 2010, at 12:39 PM, Alexander Bokovikov wrote:
>> Most likely you started an NSThread without putting an autorelease pool in
>> the thread’s main function, or you got a callback on some thread and are
>> making Cocoa calls on it without wrapping your callback in an autorelease
>> poo
On Apr 17, 2010, at 12:42 PM, Malayil George wrote:
> But, I figure it would be easier if I could set
> up a parser that would parse B into it's object and return it. So, while
> parsing A, when I encounter element B, I would like to hand-off the entire B
> element to my B parser and have it retu
Hi list!
I'm implementing an application service. The desired result of the action is to
copy a string to the pasteboard.
But as the communication between caller and called service goes via the
pasteboard the caller will delete
the content of the pasteboard at the end of the call.
What would be
People,
This my first post on this list, and I am very disappointed that I am chiming
into this kind of conversation. This will be my only post on this subject and I
think I can make myself very clear.
On 16/04/2010, at 14:22, Jayson Adams wrote:
> On Apr 16, 2010, at 9:46 AM, Kyle Sluder wro
Besides Quark being down the street, I don't come across many Cocoa developers
around here and was just curious how "out in the boonies" I am. :)
Hey maybe the 3 of us could get some coffee sometime, drop me a line! ;) ;)
--Roby___
Cocoa-dev mailing
You should post some sample code of the tabBarController not autorotating. The
behavior of the tabBarcontroller should definitely be to rotate if all of it's
child viewViewControllers support rotation to the given orientation.
Luke
Sent from my iPad
On Apr 17, 2010, at 3:56 PM, Laurent Daude
On 17-Apr-10, at 7:04 PM, Kyle Sluder wrote:
On Sat, Apr 17, 2010 at 2:01 PM, Charles Srstka
wrote:
How about just giving your object only one instance variable, which
is a pointer to a C struct, with all the object’s accessor methods
pointing to elements in the struct? Then, all you’d have
On Sat, Apr 17, 2010 at 8:29 PM, Ben Haller
wrote:
> I don't think I'm crazy about this. There are many different subclasses,
> so each subclass would have its own corresponding struct, and every ivar
> access would go through an indirection; it sounds very confusing and messy.
> Not to say the
On Sat, Apr 17, 2010 at 5:49 AM, Roby Sherman wrote:
> Besides Quark being down the street, I don't come across many Cocoa
> developers around here and was just curious how "out in the boonies" I am. :)
>
> Hey maybe the 3 of us could get some coffee sometime, drop me a line! ;) ;)
There are ma
Looking sheepishly down: I found my mistake. There was still one view
controller subclass that wasn't overriding the method. It's working now, but
thanks for reminding me!
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin
http://nemesys.dyndns.org
Lo
75 matches
Mail list logo