|
fankey posted:That's probably it - all three web servers I was trying to use would probably be classified as esoteric - homemade c#, busybox and whatever is build into our NAS. On the plus side, HTML ranges are pretty easy to implement for a basic case--I did it once in VBScript (don't ask) in order to support resuming downloads.
|
# ¿ Apr 12, 2011 21:45 |
|
|
# ¿ Apr 29, 2024 01:33 |
|
Using Xcode 4, is there a keyboard shortcut to switch between the main editor and the assistant editor? The "Move Focus To Editor..." command would work and be only slightly annoying for requiring two keystrokes to switch, but I have to hit a different keystroke to switch to each editor, and I have to think about it every drat time and it's starting to drive me insane.
|
# ¿ Apr 17, 2011 01:20 |
|
Is there a way to make things more ... complaney? I'm creating an instance of a subclass of UIViewController I made inside my application:didFinishLaunchingWithOptions:, and initializing it with initWithNibName:, but as far as I can tell, it's just not loading the NIB. I made a UITabBarController in the XIB, and hooked it up to an outlet in my subclass, but I'm getting something like this: code:
crash when it tries to load a XIB/NIB it can't find?
|
# ¿ Apr 25, 2011 02:24 |
|
samiamwork posted:Judging by your "==" tests it looks like you might want to use "assert()"?. Sorry if I've misunderstood. Not really, I probably should have put in NSAssert() to make it more clear, this wasn't actual code, just an illustration of the question. samiamwork posted:Nibs aren't loaded on init. You have to call "view" on the controller to trigger nib loading. Your outlets and actions should be hooked up after that. I think that might be your problem. Yep, this was exactly it, thanks! samiamwork posted:I'm sure there's probably a way you could cause this to fail, but it would probably wreak all kinds of havoc as I'll bet all the Apple frameworks lean on this (including synthesized accessors). I guess I already ran into it when I had to turn off a bunch of the warnings because they were getting hit hundreds of times in the framework headers and couldn't figure out a way to get GCC or LLVM to treat them as system headers. Oh well, thanks again!
|
# ¿ Apr 25, 2011 14:16 |
|
Tux Racer posted:Also, the difference between NSArray and NSSet when finding an object is that with NSSet, you just ask the set using member: if that object exists within the set. That's an O(1) operation.
|
# ¿ Apr 26, 2011 22:08 |
|
Sewer Adventure posted:http://stackoverflow.com/questions/2703936/nsdictionary-nsarray-nsset-and-efficiency/2705313#2705313 Oh, average case, sure I'll buy that. But, correct me if I'm wrong, that fills a set and dictionary with "1" "2" "3" ... "99997" "99998" "99999" which is more of a test of how good of a string hash function you have (and not a very good test at that) than how well your hash table does lookups--and that's fair for the stack overflow question, but not great for the question of how fast you can do lookups on any arbitrary hash--do they do so well for objects whose hash value is their memory address? Is using memory addresses as the hash value even common in Objective-C? Anyway, I'll believe first part, for the average case anyway, but if member: is faster than objectAtIndex: for anything other than the most pathological of cases, naming it NSArray is downright deceptive.
|
# ¿ Apr 26, 2011 23:11 |
|
Well, never claiming to have any idea how this poo poo works again. Anyway, I have a question: What's the right way to load a view from a NIB through code, and add it to a tabBarController? I've been just doing initWithNibName:, constructing an NSArray with that, and setting that array as the tabBarController.viewControllers, and all I get is a blank tab bar, and if I touch the center where the icon would be, it disappears. If I touch the tab bar anywhere else, it just does nothing. I'm as sure as I know how to be that the view that I'm stuffing into the tabBar is loading--all the outlets do actually point to stuff, .tabBarItem included, verified by [[[NSAlert alloc] yaddayadda] show]; right after setting the array, but I've been looking for any little mistake for the last two days and I'm out of ideas. Anyone else ever run into the disappearing tabBarController?
|
# ¿ Apr 27, 2011 03:43 |
|
Sweet gently caress, finally have it working. I have a window-based application. The main window XIB is just the default that's created with the project. I made another XIB that consists of only a UITabBarController. That XIB's outlets are as follows: tbc = the UITabBarController view = tbc.tabBar In my application:didFinishLaunchingWithOptions: I do this: code:
Also, as I'm picturing it, if the code posted was exactly what was in my application:blahblah: function, I'd have three memory leaks, one for each view, since tbcvc is a local variable and the array calls retain on everything that's added to it. Is that right? And if it is (or even if it isn't) why does it keep working when I release tbcvc in the function--is it just that the program isn't complex enough yet? Would the MyViewCtrlSpec functions like didReceiveMemoryWarning: still work? And if so, how, since as far as I'm aware, it's retain count would be 0? gently caress I miss being able to run .NET Reflector on the system libraries so much.
|
# ¿ Apr 29, 2011 04:22 |
|
pokeyman posted:^^^^^ Sure. link Right now I'm trying to figure out how to put the tabBarItem that's associated with a view in that view's XIB. The reason I'm going to all this trouble is partially that I don't understand the stuff, and partially because I want to be able to pull a particular module out or put a new one in and only have to edit the code in a single place. I don't know how the in-app purchases thing works yet, and very likely won't end up using it, but I'd like to build the app in a way that it'd be easy to start using that as well if I do decide to go that way. wellwhoopdedooo fucked around with this message at 01:30 on May 1, 2011 |
# ¿ Apr 30, 2011 22:55 |
|
samiamwork posted:The reason it doesn't work without the addSubview: is because you're inadvertently loading the nib when you pass self.moduleSelectorViewController.view as a parameter. Replace that line with [_moduleSelectorViewController view] and it works. Ah, thanks. I'd assumed that .view ended up being called somewhere when I set it as a .rootViewController, I did think to verify that but I guess in my random flailing I did something else that appeared to confirm the assumption. So, on to the next issues, I have a couple general Objective-C questions: 1: Is there a way to hide a method that a superclass implements in a subclass? I'm guessing there's not, but if that's the case, how do you handle subclasses requiring additional information before they're in a valid state? e.g. as in other languages where you have to manually implement every constructor in subclasses. Or is even requiring additional information not a good idea in Obj-C? Do subclasses not mean quite the same thing as in C++/C#/similar? How deep does this rabbit-hole go? 2: I see that I can sort of get pure virtual functions with protocols, but is there a way to make a superclass force its subclasses to implement a protocol? Or is there a better way to go about this? Am I thinking too C++ish again?
|
# ¿ May 1, 2011 06:03 |
|
pokeyman posted:I'm not entirely sure what "hiding a superclass's method" has to do with "subclasses requiring additional information". I'm kind of curious: can you give an example of a scenario that would motivate you to subclass but not support all of the superclass's methods? I probably phrased that badly, so please don't be offended if I'm explaining something you're already familiar with. The only real instance of it that doesn't involve breaking promises is in constructors. As an example: Pseudocode (C++ish): code:
Granted it's a lot more complex in the real world and sometimes impossible, and this example in particular would have a host of other errors to handle which minimizes the benefit, but the best error handling is preventing them in the first place, and it's something I strive for anyway. I imagine the answer will be that in Obj-C, the usual way to do things is that if somebody instantiated LoggingFileWriter with the single argument constructor you'd delay the error until they called [instance write:@"something"] without setting .logger, but I really like trying to make things as close to impossible to use wrong as I can, so I'm asking even though I'm fairly sure I already know the answer. And thanks for your other answers, I really appreciate all your help.
|
# ¿ May 1, 2011 07:19 |
|
If anyone has tips about how to improve Xcode 4, I know I'd appreciate the hell out of them, and I bet others would too. I'm not looking to make Xcode into Visual Studio--their handling of the UI is infinitely better than Visual Studio, other than the game of loving Twister you have to play to hit any useful keyboard shortcut, and yet "Close the gently caress out of the application" is a single easy-to-hit keystroke. I looove the way it handles windows, and indenting wrapped lines, I don't get why I can't even find something like that for Visual Studio. That said, there's a lot of thing I miss. Like Ctrl-Tab swapping between two source code windows. Or the life-changing AllMargins extension. Or multiple column guides. Or even being able to see what the gently caress column you're on at all. Seriously. What code editor, other than Xcode, offers NO goddamn way to see what column you're in? It's loving baffling. So, is there like an Xcode extensions/tweaks site I don't know about? Some documentation of options that don't have a UI? Because honestly, it's like programming in a future full of graceful, swooping, impossibly tall buildings made of glass and pearl, but you have to dangle your rear end out the window to poo poo because ... "what the gently caress is a 'bathroom'?"
|
# ¿ May 11, 2011 18:28 |
|
Ender.uNF posted:Are you kidding? With the left and right bars open and the assistant view on there is absolutely no space. Using the assistant while editing an iPad XIB is almost useless and I have a 1920x1280 MBP. You can make a separate tab to edit XIBs in, with the assistant editor much narrower, or on the bottom, or just off. It's kind of a pain, but a lot better than turning the assistant editor on and off. The left and right bars on the other hand, are Cmd-0 and Cmd-Alt-0, so they're pretty easy to open and close at need. If you have a second monitor, you can even open a new window, with its own tab setup. I gotta say, that's pretty sweet. I wish I wish I wish I could do that in Visual studio, instead of their loving awful tearoff editor implementation.
|
# ¿ May 13, 2011 20:02 |
|
Is there any difference between declaring overridden methods in the overriding class's @interface and just defining the new @implementation?
|
# ¿ May 15, 2011 02:30 |
|
rjmccall posted:Not if you're not refining the parameter or return types and want callers to use your more accurate signature. Oh SNAP you can do that in Obj-C? So, all of these are valid? code:
code:
|
# ¿ May 15, 2011 03:16 |
|
Is there a way to reference derived files in a project? I'm generating my images from SVG, and the logical place for the images to go seems to be $(DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).png, but that just tosses them all in the same folder, which means name collisions. Is there a way to specify a part of a path in the Output Files for a custom build rule? e.g. my project is at /home/me/project, my image source file is in there at Subdir/image.svg, and I want to end up with /home/me/Library/.../DerivedSources/Subdir/image.png. Is there a way to do that? Or is there a better way to do what I'm trying to do? Obviously I could just rename the images, but that's the easy way and I'm trying to learn.
|
# ¿ May 17, 2011 01:14 |
|
OK, so after loving around with custom build rules and aggregates running custom scripts and building straight into the source tree and I don't know what else, I took a look in the app bundle it builds, and everything is just stuffed into one folder there even once I've got things building into separate folders. Are subfolders other than the system-created stuff like *.lproj just a no-go? If you're not supposed to do it, whatever, I'll make blah-tabBarIcon.png instead of blah/tabBarIcon.png but I fuckin love me some subfolders.
|
# ¿ May 18, 2011 03:34 |
|
[tell] me about Core Data. As someone who's very comfortable in both SQL and C, and who started to miss things you can do in SQL in the first 15 minutes of modeling my data, why should I use it anyway? The advice to use it seems very emphatic.
|
# ¿ May 23, 2011 18:47 |
|
Argh, somebody please explain countByEnumeratingObjectsWithState: to me. From reading the docs, and googling around, I can't see that we have any way to call cleanup code. There's a stackbuf, and a state, but nothing I've been able to find says that if I put objects in stackbuf or state->state or state->extra that there's any way to make sure dealloc gets called. Am I missing something, or is that just a constraint I need to deal with?
|
# ¿ May 28, 2011 03:28 |
|
rjmccall posted:It's just a constraint you need to deal with. You will not get any callbacks when the loop is complete, or if it's aborted part-way either normally or abnormally. Crap. So, the implementation at line 354 is going to leak the NSEnumerator (and self, since enumerators retain the objects they enumerate) that's stored in state->state? e: derp, forgot to link what I was talking about : Here it is
|
# ¿ May 28, 2011 04:09 |
|
rjmccall posted:No, because the default convention for methods is to return at +0, i.e. autoreleased or otherwise held. poo poo, it looks like there's a core part of memory management I'm not aware of. I understand that newXXX and init are retain count +1, and that other methods are usually +0, but I thought that an object with a retain count of 0, in non-gc mode, is immediately deallocated, so unless you were returning a reference to an elsewhere-retained object, you always need to take ownership for the caller like new and init do. I also thought (or still think) that objectEnumerator returns a new NSEnumerator*, which would have a retain count of 1 so it doesn't immediately dalloc, that you would have to clean up when you're done. Is retain 0 something where it deallocs when it leaves scope? Because that would rule in about a thousand ways.
|
# ¿ May 28, 2011 05:13 |
|
Read it, got it, thanks.
|
# ¿ May 28, 2011 20:52 |
|
pokeyman posted:tons of things can and are helpfully represented by strings when they really don't need to be oh man, not to get all coding horrors up in here, but jesus christ I could not possibly disagree more. If I had a nickel for every bug caused by someone deciding that the type system was like underpants and just got in the way, I'd have about the same amount of money as I do right now, because I essentially get a nickel every time somebody decides the type system is like underpants and just gets in the way.
|
# ¿ Sep 22, 2011 02:40 |
|
pokeyman posted:Alright, so maybe I'm just not getting it, but why does calling [aString isEqualToString:someArray] not throw an exception? By your logic it should be a programmer error, right? Or it should blow up on some internal call to a string comparison function, or somehow not work. When in reality it simply returns NO. You didn't counter his claim of "better expression of intent". If you think isEqual means the same thing as isEqualToString, even if they do the same thing, you're doing a pretty good job of arguing for the viewpoint that the Objective-C "type system" is a travesty.
|
# ¿ Sep 24, 2011 00:19 |
|
PT6A posted:Oh Jesus, I just got a call (at half past midnight in this timezone, to be clear) from a woman who could barely speak English and was having trouble installing an app or using her credit card or some combination of the above. Maybe putting my phone number on my website was not a great idea (either that or I should just ignore my business phone after a certain time...) You published a support number on the internet. If I was that lady, I'd think it was bizarre that the helpdesk rep sounded like I just woke him up.
|
# ¿ Jan 11, 2012 00:44 |
|
Can anyone explain how IB actually works? In VS, I can just go look at FormName.Designer.cs, and there's all my property setting and parenting turned into code. Is there an equivalent place I can look for IB? I don't mind things doing things for me, but right now it's a bunch of magic to me, and that drives me up the wall when I'm trying to figure out why something isn't working like I expect it to.
|
# ¿ Jan 23, 2012 18:08 |
|
|
# ¿ Apr 29, 2024 01:33 |
|
Ah, the serialization (mostly) answers the question. I assume that there's some code that gets run in order to set the IBOutlet-type stuff in the ViewController classes (unless the ViewController instance is serialized too?) but, don't answer that parenthetical unless you know off the top of your head, I plan to research the details as soon as I get the chance. Thanks everyone!
|
# ¿ Jan 23, 2012 21:51 |