Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
kitten smoothie
Dec 29, 2001

Kallikrates posted:

I got a spot but I still kinda hope to find out if I get a google i/o ticket.

Better just take the WWDC ticket. This morning Google announced they moved I/O's sweepstakes registration to next week, ending Friday.

Now if you wait for an answer from Google on I/O, you'll miss out on your chance to close the deal on your WWDC ticket.

Adbot
ADBOT LOVES YOU

Kallikrates
Jul 7, 2002
Pro Lurker
Yeah, I just saw that weird timing. Problem is no one else I know is going. Never been to a conference by myself :(

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Kallikrates posted:

Yeah, I just saw that weird timing. Problem is no one else I know is going. Never been to a conference by myself :(

Last year's WWDC had zero reported cases of cannibalism, so you'll probably be fine.

lord funk
Feb 16, 2004

Subjunctive posted:

Last year's WWDC had zero reported cases of cannibalism, so you'll probably be fine.

"reported"

ultramiraculous posted:

I got it and none of my coworkers did. Maybe submitting all the radars they didn't feel like dealing with is working in my favor?

I think lotteries tend to bring out the superstitious side in everyone. If submitting ignored radars gets you in I'd be giving the keynote.

haveblue
Aug 15, 2005



Toilet Rascal

lord funk posted:

"reported"

Next year's lottery will be done Shirley Jackson style :unsmigghh:

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

haveblue posted:

Next year's lottery will be done Shirley Jackson style :unsmigghh:

They oversell and in the holding room before the keynote they have a staffer start distributing bespoke lottery cards from a bucket made from a single piece of aluminum. The losers are drawn and stoned to death with iPod Classics until the attendee count hits 5000.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Is there an official pluralization mentioned anywhere? I've always hoped it's meant to be "iPods Touch".

(I say as I knowingly break the branding guideline that says it's "iPod touch".)

Mikey-San
Nov 3, 2005

I'm Edith Head!

pokeyman posted:

Is there an official pluralization mentioned anywhere? I've always hoped it's meant to be "iPods Touch".

(I say as I knowingly break the branding guideline that says it's "iPod touch".)

The Apple Style Guide might cover this:

https://help.apple.com/asg/mac/2013/ASG_2013.pdf

Page 121:

quote:

Trademarked product names: Form the plural of trademarked product names by adding the plural generic noun to the singular product name.
Correct: Mac computers, MacBook Pro computers, iMac computers
Incorrect: Macs, MacBook Pros, iMacs

"iPod touch devices" sounds acceptable, but I am not an authority.

Edit: I think the best answer is to avoid sentence construction that forces you to use plurality.

Mikey-San fucked around with this message at 01:36 on Apr 9, 2014

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Doc Block posted:

The guy who makes Tweetbot didn't get in, so either he's not on the "favored" list (which seems unlikely), or it really is random.

Given the high interest level, it seems odd that doctor would have three coworkers get tickets but who knows. True randomness has clusters.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Mikey-San posted:

The Apple Style Guide might cover this:

https://help.apple.com/asg/mac/2013/ASG_2013.pdf

Page 121:


"iPod touch devices" sounds acceptable, but I am not an authority.

Edit: I think the best answer is to avoid sentence construction that forces you to use plurality.

How disappointing. Thanks for the link though!

"MacBooks Pro and Air lined the tables..." it just writes itself. Big missed opportunity here.

Doc Block
Apr 15, 2003
Fun Shoe

Ender.uNF posted:

Given the high interest level, it seems odd that doctor would have three coworkers get tickets but who knows. True randomness has clusters.

Dave Mark didn't get in either.

LP0 ON FIRE
Jan 25, 2006

beep boop
I'm updating code in Cocos2D to make a sprite mask. I'm not a pro with OpenGL ES so I can't say this is 100% correct other than the 3 errors I'm getting, but the compiler is telling me Use of undeclared identifier ‘quad’; did you mean ‘_quad’? on the 3 lines that use kQuadSize on step 3, but putting the red underline under kQuadSize, which is strange to me.

code:
-(void)draw{

    // 1
    CC_NODE_DRAW_SETUP();
    ccGLBlendFunc( _blendFunc.src, _blendFunc.dst );

    // 2
    ccGLBindTexture2DN(0, _texture.name);
    glUniform1i(_textureLocation, 0);

    ccGLBindTexture2DN(1, _maskTexture.name);
    glUniform1i(_maskLocation, 1);

    // 3
   #define kQuadSize sizeof(quad.bl)
    long offset = (long)&_quad;

    // vertex
    NSInteger diff = offsetof( ccV3F_C4B_T2F, vertices);
    glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));

    // texCoods
    diff = offsetof( ccV3F_C4B_T2F, texCoords);
    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));

    // color
    diff = offsetof( ccV3F_C4B_T2F, colors);
    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (void*)(offset + diff));

    // 4
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

}

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

LP0 ON FIRE posted:

I'm updating code in Cocos2D to make a sprite mask. I'm not a pro with OpenGL ES so I can't say this is 100% correct other than the 3 errors I'm getting, but the compiler is telling me Use of undeclared identifier ‘quad’; did you mean ‘_quad’? on the 3 lines that use kQuadSize on step 3, but putting the red underline under kQuadSize, which is strange to me.

code:
    // 3
   #define kQuadSize sizeof(quad.bl)
    long offset = (long)&_quad;

kQuadSize refers to quad, but the variable looks to be called _quad instead?

LP0 ON FIRE
Jan 25, 2006

beep boop

Subjunctive posted:

kQuadSize refers to quad, but the variable looks to be called _quad instead?

Woah! I just put an underscore before quad.bl and the errors went away. I had entered just quad.bl because when I searched for quad.bl, there were no underscores. Before 2.1, it used to be quad_.bl. Now I need to test this out and see how things go.

Thanks!

LP0 ON FIRE fucked around with this message at 18:44 on Apr 9, 2014

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

I'm thinking _quad is a struct with member bl, which is why you have to use the underscore. Is that not true? Never used Cocos.

LP0 ON FIRE
Jan 25, 2006

beep boop
See my edit. Yeah I guess that was the case and they switched a bunch around because it wasn't the proper syntax.

Diametunim
Oct 26, 2010
Here's a quick question, aimed towards people with experience with BlackBerry's level 1 paging system. I know nothing iOS development but, I was just wondering if it would be at all possible to write something similar to BB's level 1 paging system for iOS?

My dad works for Delta Airlines as a chief pilot and often has to sleep next to his phone if poo poo hits the fan. Delta recently made the transition from blackberry's to iOS devices and lost the ability to set up personalized notification systems. One of which was the ability to suppress ALL notification noises outside a user specified list of phone numbers and emails that came through matching a specific email title / sender address. Apparently this is what Blackberry called their "level 1 messaging system"? I don't personally know, I've never used a BB.

My dad complains constantly that the Iphone has nothing comparable to this feature, and seeing as how I'm going to have some free time this summer I figured I would delve into possibly solving this problem for him. Can it feasibly be done though? I figure if it could someone would have already attempted to put something similar out on the app store.

haveblue
Aug 15, 2005



Toilet Rascal
You might be able to do that with the Do Not Disturb feature, which lets you whitelist contacts and allow them to pierce the muting. In general asynchronous notifications are under Apple's control, not third party, so it's not possible to write an app that sits around in the background waiting for a rare network event.

You would have significantly more freedom to do this if you jailbroke his device, but this thread is mostly for stock dev.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

haveblue posted:

You would have significantly more freedom to do this if you jailbroke his device, but this thread is mostly for stock dev.

There's no rule against talking about jailbroken whatever here, as far as I know, so long as it's on topic. "How do I hook in to the Bluetooth stack on a jailbroken device" would be cool, "help me jailbreak my phone" would be off topic, "why can't I steal this app" would probably get you run out of town.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
code:
(lldb) p sender.frame
error: unsupported expression with unknown type
error: instance method 'undoManager' has incompatible result types in 
   different translation units ('id' vs. 'NSUndoManager *')
error: unsupported expression with unknown type
note: instance method 'undoManager' also declared here
error: 3 errors parsing expression

(lldb) p (CGRect)[sender.frame]
error: expected identifier
error: instance method 'undoManager' has incompatible result types in 
   different translation units ('id' vs. 'NSUndoManager *')
note: instance method 'undoManager' also declared here
error: 2 errors parsing expression

(lldb) print (CGRect)[sender frame]
error: instance method 'undoManager' has incompatible result types in 
   different translation units ('id' vs. 'NSUndoManager *')
note: instance method 'undoManager' also declared here
error: 1 errors parsing expression

(lldb) po [(UIView*)sender frame]
 nil

(lldb) po (UIView*)sender
<UISegmentedControl: 0x125d27be0; frame = (814 8; 194 29); 
   opaque = NO; layer = <CALayer: 0x178228e20>>

(lldb) print [(UIView*)sender frame]
error: no known method '-frame'; cast the message send to the method's return type
error: 1 errors parsing expression

(lldb) print (CGRect)[(UIView*)sender frame]
(CGRect) $10 = origin=(x=814, y=8) size=(width=194, height=29)
(lldb) 

I just don't have the words anymore.

Simulated fucked around with this message at 02:52 on Apr 10, 2014

Toady
Jan 12, 2009

For anyone working with the Objective-C API in JavaScriptCore, that "instanceof" issue I posted about several months ago appears to have been fixed: https://bugs.webkit.org/show_bug.cgi?id=126670

Doh004
Apr 22, 2007

Mmmmm Donuts...

Ender.uNF posted:

I just don't have the words anymore.

I personally feel the debugger has gotten worse as of late. Things sometimes work and other times they don't behave properly. Definitely a step back it seems :\

lord funk
Feb 16, 2004

I have an object that fires out a number of values separated by a short delay. I do this using -performSelector:withObject:afterDelay to recursively call its 'fire' method until it's done.

The catch is that it is running on the main thread, which means UI interaction blocks it from continuing. I would like this to run on another thread, but -performSelector:withObject:afterDelay has to be in a running NSRunLoop, which means GCD is out. Is there a simple way to do this that I'm just not seeing (after too much digging around GCD / NSRunLoop / NSThread docs)?

lord funk
Feb 16, 2004

BTW I would love to use dispatch_after but you cannot cancel the block you schedule. :(

edit: Maybe I should just switch to a timer.

lord funk fucked around with this message at 00:56 on Apr 11, 2014

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
NSTimer attached to the runloop in common modes is probably what you want. CommonModes will allow the timer to fire even during user interaction, like if you want a timer doing a thing while the user is scrolling.

On my phone, but it's roughly:

NSTimer *timer = [NSTimer timerWith...];

[[NSRunLoop mainRunLoop] addTimer:timer inModes:NSCommonModes]:

Doctor w-rw-rw-
Jun 24, 2008

lord funk posted:

I have an object that fires out a number of values separated by a short delay. I do this using -performSelector:withObject:afterDelay to recursively call its 'fire' method until it's done.

The catch is that it is running on the main thread, which means UI interaction blocks it from continuing. I would like this to run on another thread, but -performSelector:withObject:afterDelay has to be in a running NSRunLoop, which means GCD is out. Is there a simple way to do this that I'm just not seeing (after too much digging around GCD / NSRunLoop / NSThread docs)?

What's stopping you from creating an NSThread with an NSRunLoop? Not that that's the best solution.

Running an NSTimer on the main thread will still block the main thread, so I personally wouldn't do it.

Make a custom timer class that wraps GCD and mimics some of NSTimer's API. Have a cancel flag that prevents whatever was going to be executed from being executed. Done.

Kallikrates
Jul 7, 2002
Pro Lurker

lord funk posted:

BTW I would love to use dispatch_after but you cannot cancel the block you schedule. :(

edit: Maybe I should just switch to a timer.

sure you can, https://gist.github.com/zwaldowski/955123

NSTimers may or may not be accurate for your needs.

Edit: basically what doctor is saying to do.

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Kallikrates posted:

sure you can, https://gist.github.com/zwaldowski/955123

NSTimers may or may not be accurate for your needs.

Edit: basically what doctor is saying to do.

:wtc:

Why is this a category on NSObject? Why are there identical instance and static versions of it? Why is the code clearly just copy pasted four times with minor tweaks to the "with an object" versions? He didn't even make the instance versions pass in the object it's being called on.

And why is there a comment calling this a "nice clean implementation"???

God forbid you just define your own object. Oh wait he did but it isn't actually declared anywhere, instead he's abusing a closure as an object (see: closures are a poor man's objects, I guess)

I bet he's so proud of how clever this implementation is.

Dessert Rose fucked around with this message at 02:57 on Apr 11, 2014

Kallikrates
Jul 7, 2002
Pro Lurker
didnt say it was good, just that it was possible, and it was the first google result for "dispatch_after cancel"

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

ultramiraculous posted:

I mean for pthreads there's nothing that "holds" a lock. It's just a counter. Log statements on mutex lock/unlocks can be pretty helpful here.

You can store the owner (as a pthread_t or some pointer to an internal thread object) in the lock object to aid debugging. Some implementations do it. Hell, some implementations have deadlock detection outright

ultramiraculous posted:

Also: Whyyyyyyyy :cripes:

Huge, irreplaceable C framework our application is based on. Some day (for example, once it's included in the Xcode project instead of being built with a shell script) I'll try to migrate its internals from UNIX API to Core/Foundation

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

lord funk posted:

I have an object that fires out a number of values separated by a short delay. I do this using -performSelector:withObject:afterDelay to recursively call its 'fire' method until it's done.

The catch is that it is running on the main thread, which means UI interaction blocks it from continuing. I would like this to run on another thread, but -performSelector:withObject:afterDelay has to be in a running NSRunLoop, which means GCD is out. Is there a simple way to do this that I'm just not seeing (after too much digging around GCD / NSRunLoop / NSThread docs)?

Why can't you just create a "CancellationToken" object that you pass in with the block to dispatch_after() that uses one of the OSAtomic* instructions inside to ensure the cancel is set safely? Then the UI thread can trigger the cancel and the block can check the cancellation.

Unless you are issuing a bazillion of these, it won't matter that you have walking dead tasks still in the queue because they'll exit almost immediately.



I haven't tested this but:

code:
#import <Foundation/Foundation.h>

@interface CancellationToken : NSObject {
    @private
    int32_t _cancelFlag;
}
@property (readonly, nonatomic) bool isCancelled;
-(void)cancel;
@end
code:
#import "CancellationToken.h"
#import <libkern/OSAtomic.h>

@implementation CancellationToken

- (bool)isCancelled
{
    return _cancelFlag != 0;
}

- (void)cancel
{
    OSAtomicCompareAndSwap32(0, 1, &_cancelFlag);
}

@end

lord funk
Feb 16, 2004

Doctor w-rw-rw- posted:

Make a custom timer class that wraps GCD and mimics some of NSTimer's API. Have a cancel flag that prevents whatever was going to be executed from being executed. Done.

Yep, this. Works great.

Ender.uNF posted:

Why can't you just create a "CancellationToken" object that you pass in with the block to dispatch_after() that uses one of the OSAtomic* instructions inside to ensure the cancel is set safely?

Didn't know about the OSAtomic stuff, thanks.

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
I have a class that has a property that I want to be readonly publicly, but writable inside my class.

So the .h looks like this:

code:

@interface MyClass
@property (nonatomic, readonly) NSString *myProp;
@end

My coworkers write this in the .m:

code:

@interface MyClass()
@property (nonatomic, readwrite) NSString *myProp;
@end

But somewhere along the line, I got the impression that you can just do this, and cut out the "readwrite" keyword altogether:

code:

@interface MyClass()
@property (nonatomic) NSString *myProp;
@end

In my own personal code, this is what I do, and it works, making the property writeable privately, but readonly publicly. My coworkers were amazed when I showed them this.

When did this show up? Is it a bug with clang or LLVM? What's going on here?

haveblue
Aug 15, 2005



Toilet Rascal
The readwrite attribute is redundant, it's the default for a property that doesn't specify one. So I guess it's always been like that.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Axiem posted:

I have a class that has a property that I want to be readonly publicly, but writable inside my class.

So the .h looks like this:

code:

@interface MyClass
@property (nonatomic, readonly) NSString *myProp;
@end

My coworkers write this in the .m:

code:

@interface MyClass()
@property (nonatomic, readwrite) NSString *myProp;
@end

But somewhere along the line, I got the impression that you can just do this, and cut out the "readwrite" keyword altogether:

code:

@interface MyClass()
@property (nonatomic) NSString *myProp;
@end

In my own personal code, this is what I do, and it works, making the property writeable privately, but readonly publicly. My coworkers were amazed when I showed them this.

When did this show up? Is it a bug with clang or LLVM? What's going on here?

Not a bug, I think that showed up pretty soon after class extensions became a thing. Might even have been contemporaneous.

Left unspecified, properties default to readwrite, atomic (grr), and strong for object types or assign for value types.

Also that string property should be copy, and it's usually worth specifying setter behavior even for readonly properties so that subclasses can redeclare the property if needed. (Unless you're certain you'll never be subclassed.)

Toady
Jan 12, 2009

Here's a random tip. If you want an immutable public property backed by a mutable private property, declare the public immutable property in a category in the header and the private mutable property of the same name in a class extension in the implementation.

Doctor w-rw-rw-
Jun 24, 2008

Toady posted:

Here's a random tip. If you want an immutable public property backed by a mutable private property, declare the public immutable property in a category in the header and the private mutable property of the same name in a class extension in the implementation.

Less of a tip and more basic Objective-C language technique, though. Also, no need to have the public property in a category, it can just be inline with the class declaration.

Toady
Jan 12, 2009

For some reason, I thought I had in the past tried including the immutable property in the interface declaration and been given a compiler warning. Don't I feel embarrassed!

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do

pokeyman posted:

Also that string property should be copy

Point taken, though it's kind of immaterial to my question.

It just seemed odd to me that it used to be that you had to declare explicitly that a variable was readwrite privately, but now you don't have to, and no one seems to have been notified of the change, and I can't find any reference to it online (though it's hard to google for).

Why do keywords like readwrite, atomic, and strong exist if they're the default and therefore never should be used?

Adbot
ADBOT LOVES YOU

Doc Block
Apr 15, 2003
Fun Shoe
Explicitness, probably.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply