triangulating webcams
I'm proto-typing a tri-screen GUI. I have 3 mac minis in a local network and would like to triangulate their three web-cams. It's purely exploratory self-funded research on my part at this point. Any positive, constructive replies would be appreciated. -em One laptop per child--one neighborhood per village ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Problem: Glyps get drawn outside Line Fragment Rect.
In my custom NSTextView i override NSTextContainer's lineFragmentRectForProposedRect: sweepDirection: movementDirection: remainingRect: method to lay text only in certain parts of the text view, so in this method, i return the line fragment rectangles in which i allow text to be laid. The problem is that, in certain cases like very large fonts, glyphs are drawn outside the returned line fragment rect. even though the width of the returned line fragment is too small to accommodate the glyph. How can i prevent this? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: how to get the status of network when the network is set disable.
Thank you the quickly advices of Michael and Mike very much. I test Michael's sample, it works well. But I think the SCNetworkReachability API is also used to try to connect to the server, right? What I want is to get the status of the network without any connection to the server. Maybe What I said is not so clearly. Finally, I found the SCDynamicstore API and the following sample http://www.cocoabuilder.com/archive/message/cocoa/2006/7/21/168076 it seems to give me what i need. I think exactly I need to get the status of the system configuration. thank you again 2008/7/10 Mike [EMAIL PROTECTED]: The SCF documentation specifically says SC routines cannot be used to test *remote* reachability and should only be used to test whether a packet can *leave* the host. If this is all you need, then Michael's example will work. If you need to test remote reachability, you will need to devise some other method. Mike Michael Kaye wrote: Try the SCNetworkReachability API... I borrowed the following from one of Apple's examples: - (BOOL)isDataSourceAvailable { static BOOL checkNetwork = YES; if (checkNetwork) { // Since checking the reachability of a host can be expensive, cache the result and perform the reachability check once. checkNetwork = NO; Boolean success; const char *host_name = http://localhost:8080;; SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, host_name); SCNetworkReachabilityFlags flags; success = SCNetworkReachabilityGetFlags(reachability, flags); _isDataSourceAvailable = success (flags kSCNetworkFlagsReachable) !(flags kSCNetworkFlagsConnectionRequired); } return _isDataSourceAvailable; } HTHs. Michael. On 9 Jul 2008, at 13:22, xiaobin wrote: Hello, I am writing a program to detect the status of network. In my program, I need get the status of network when the connection is set disable. here it is not by connecting the network to get the status. which API or method can work for it? for example, if my lan cable is unpluged or the network is set disable, it is certainly to know the status of the network is off. so it is not necessary to connect the network to get the status. so I want to know When it is clearly to know the status of the network is on or off, which API or method can get the status. I have read the example of apple's document for using CFDiagnostics to check whether the network is connected or not, but I think it is not for my need. It is by connecting the network to get the status. Would anyone can give me a help ? Thanks a lot ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/michaelkaye%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/junklists%40michael-amorose.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/leptonw%40gmail.com This email sent to [EMAIL PROTECTED] -- xiaobin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trashing files and undo
On Jul 12, 2008, at 2:25 AM, Ruotger Skupin wrote: Hi, if I get you right, you are suggesting I put an alias to the file into (say) ~/Library/Application Support/MyApp/UndoAliases/ remember the original path/filename then trash the file. To get it back I resolve the alias and move/rename it. What's the advantage over the FSRef solution Charles proposed? He's not referring to making an alias *file*, just an alias in memory. To do that, you make an FSRef first as I described, then you use FSNewAlias() with NULL as the first argument, a pointer to your FSRef as the second argument, and a pointer to an AliasHandle as the third argument. Later, you can use FSResolveAlias() to get the FSRef back, and then you resolve the FSRef into a file path. The advantage is, as Gregory mentioned, that you can store the alias in your preferences (after encoding it to an NSData or something) and load it back again the next time your program launches. I also think FSRefs don't stay valid if the disk that the file is on gets ejected, although I may be wrong about that one. My guess is that Undo support doesn't really need to persist across program launches, so in my opinion you'd be fine with an FSRef, although doing a little extra work and getting an AliasHandle wouldn't really hurt anything. It's up to you, I guess. Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: garbage collection and NSConnection
On Jul 12, 2008, at 8:25 AM, Michael Ash wrote: On Sat, Jul 12, 2008 at 2:25 AM, Marcel Weiher [EMAIL PROTECTED] wrote: So as I said: (a) object allocation slowest (b) out-of-band retain count slow (c) inline retain count much faster than either. Well that all makes sense, thanks. You're very welcome :-) One further question for you, if you will. I got curious and went off hunting for the inline refcount in NSCFString but couldn't find it. Yeah, NSCFString doesn't actually declare any of its instance variables, which are actually those of the private CFString structure it uses. The closest I got was the '_rc' field in CFRuntimeBase, but it's inside an #if __LP64__ clause, so we don't get it in normal code these days. The __CFString struct doesn't seem to have any place to store a refcount. Am I missing something here, or does it only have an inline refcount in 64-bit? No, the inline reference count is available for all CF objects, and not limited to 64 bit. What version of the structure are you looking at? For example http://www.cocoadev.com/index.pl?HowToCreateTollFreeBridgedClass shows this version, which matches what I got from opensource.apple.com /* All CF instances start with this structure. Never refer to * these fields directly -- they are for CF's use and may be added * to or removed or change format without warning. Binary * compatibility for uses of this struct is not guaranteed from * release to release. */ typedef struct __CFRuntimeBase { void *_isa; #if defined(__ppc__) uint16_t _rc; uint16_t _info; #elif defined(__i386__) uint16_t _info; uint16_t _rc; #else #error unknown architecture #endif } CFRuntimeBase; Cheers, Marcel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Servicing Core Animations?
Hi, I have a core animation layer backed view that doesn't animate. It only happens to not animate during mousedown events. Is there something I have to do to make it work, or is it likely I'm short circuiting something, somewhere? It doesn't animate, or move at all. But when I release the mouse, the animated object just 'shows up' at the target location. If I don't create any mousedown event during the transition, it fires and animates properly. Thank you for any suggestions! -Chilton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Servicing Core Animations?
I have a core animation layer backed view that doesn't animate. It only happens to not animate during mousedown events. Is there something I have to do to make it work, or is it likely I'm short circuiting something, somewhere? Hard to say with what you've provided. Do you have custom - mouse...: methods in your view? If so, post your code. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
mysterious core data crash
Hi All, I'm trying to create a simple Core Data app. I've done this before with success. I'm using an NSArrayController set to Entity mode. The entity is a chemical with three string attributes: chemid, name, and description. In MyDocument.xib, I've created a table view and done all the bindings, etc. I have an Add button that will send the add: message to the array controller. Whenever I try to add a new item, the app crashes. I don't get the normal gdb window: instead I get a window that says 'loading stack frames' and the assembly code. The line that the program seems to be stuck on is this: 0x92efbfe2 +0018 call 0x92efbfe7 CFBagAddValue+23 But here's the really strange part: if I have only one column bound to the array controller (any one: chemid, name, OR description), the whole thing works fine. I'm completely stumped. The project is online at http://danielrichman.com/tmp/ChemTrak.zip. Thanks for your help. This isn't at all urgent. Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: garbage collection and NSConnection
Marcel Weiher wrote: uint16_t _rc; Oh, the horror of it all! Only 65,535 objects can retain a string!!! What am I to do when I model all the citizens of the US voting for just one presidential candidate in November, and the retain count overflows?!?! Okay, that's not a real concern for me, but that's the kind of thing where you find hanging chads are the least of your worries. Didn't someone famous once say, Who needs more than 64 KB in a computer? ;-) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Updating print panel preview
I have a document based application in which i need to print about 50-70 pages of NSTextView, the printing is working fine, but in the small print preview shown in the print panel, it doesn't show all the pages. Like if there are say 50 pages to be printed, it'll show only abt 20 pages in the print panel preview, but when i print, it prints all the 50 pages. I think what happens is that my textView is still not completed with laying the text by the time the print panel pops down, so is there any way i can update the view in the print panel when i'm done with laying the text in the text view? I tried using NSPrintPanelAccessorizing and calling a method which is registered with keyPathsForValuesAffectingPreview when i'm done with text layout. But if i have attachments in the text, it crashes and raises an exception saying: 2008-07-12 15:38:42.115 testApp[5322:10b] Unlocking Focus on wrong view (NSPrintThumbnailView: 0x152f3140), expected NSImageCacheView: 0x17140770 I'd appreciate any help. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ArrayController
On Jul 12, 2008, at 3:29 PM, Ashley Perrien wrote: Click the add button to add a line, click through the table and fill in the fields to get the data in. Instead what I want is to have several textfields in the view, fill those out, click add, it performs all the necessary operations with it, adds it to the array and it shows up in the table. Instead of connecting your add button to the array controller's - add: action, how about creating an -addFromFields: action in some other controller. This will create a new instance of your model object, set its attributes to the contents of the text fields (to which you have outlets connected so you can communicate with them), then call the array controller's -addObject: method, passing in the newly-created model object. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: triangulating webcams
Sounds intriguing; at first thought, you may want to consider Xgrid to provide such collaboration, although it may not be what you're needing; there's other means to provide collaborative networking between Macs. If you want feedback on an experimental GUI, try the mac-gui-dev list on Yahoo with any mock-ups you've come up with. em wrote: I'm proto-typing a tri-screen GUI. I have 3 mac minis in a local network and would like to triangulate their three web-cams. It's purely exploratory self-funded research on my part at this point. Any positive, constructive replies would be appreciated. -em One laptop per child--one neighborhood per village ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ArrayController
On Jul 12, 2008, at 12:29 PM, Ashley Perrien wrote: when I click the add button which calls a method in MyDocument it ultimately does a [array addObject: newobject] and the arraycontroller is not being notified that the array is being updated so it's not redrawing the table. Any tips on how to get this working? http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/Troubleshooting.html#//apple_ref/doc/uid/TP40002148-182809 mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: mysterious core data crash
On Jul 12, 2008, at 11:00 AM, Daniel Richman wrote: The entity is a chemical with three string attributes: chemid, name, and description. http://developer.apple.com/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSPropertyDescription_Class/Reference/NSPropertyDescription.html Note that a property name cannot be the same as any no-parameter method name of NSObject or NSManagedObject. For example, you cannot give a property the name description. There are hundreds of methods on NSObject which may conflict with property names—and this list can grow without warning from frameworks or other libraries. You should avoid very general words (like font”, and “color”) and words or phrases which overlap with Cocoa paradigms (such as “isEditing” and “objectSpecifier”). mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: garbage collection and NSConnection
On Sat, Jul 12, 2008 at 1:24 PM, Marcel Weiher [EMAIL PROTECTED] wrote: No, the inline reference count is available for all CF objects, and not limited to 64 bit. What version of the structure are you looking at? For example http://www.cocoadev.com/index.pl?HowToCreateTollFreeBridgedClass shows this version, which matches what I got from opensource.apple.com I was looking at: http://www.opensource.apple.com/darwinsource/projects/apsl/CF-476.10/CFRuntime.h It defines: typedef struct __CFRuntimeBase { uintptr_t _cfisa; uint8_t _cfinfo[4]; #if __LP64__ uint32_t _rc; #endif } CFRuntimeBase; I guess this isn't the right one, then. To Gary, about 16-bit refcounts, I'd imagine that there's some logic in there where if you hit 0x, it considers that to be a flag to use an external refcount instead, at the cost of some speed. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
re: mysterious core data crash
Whenever I try to add a new item, the app crashes. I don't get the normal gdb window: instead I get a window that says 'loading stack frames' and the assembly code. The line that the program seems to be stuck on is this: 0x92efbfe2 +0018 call 0x92efbfe7 CFBagAddValue+23 But here's the really strange part: if I have only one column bound to the array controller (any one: chemid, name, OR description), the whole thing works fine. I'm completely stumped. When I build your project, I get: /tmp/ChemTrak/MyDocument.xcdatamodel: Chemical.description: warning Chemical.description -- property name conflicts with a method already on NSObject or NSManagedObject That's bad. You should always review the warnings and eliminate as many as possible. Once you start writing 64 bit code, warnings become synonymous with errors. What were once harmless casting or missing function declarations will just start crashing. There are approximately 75 reserved property names. Basically anything you see in NSObject.h or NSManagedObject.h. Unfortunately, neither Objective-C nor Key Value Coding have any namespace features to isolate different naming scopes. Categories people put on NSObject (in frameworks and such) can create more, but imho putting a category on a class whose implementation does not belong to you, in anything besides your own 100% self contained code base, is an error. Regardless, it's rude to pollute our limited global namespace. - Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: mysterious core data crash
Of course. I actually realized this with chemid (it had been id) but I had completely forgotten about description. Thanks to all. Daniel mmalc Crawford wrote: On Jul 12, 2008, at 11:00 AM, Daniel Richman wrote: The entity is a chemical with three string attributes: chemid, name, and description. http://developer.apple.com/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSPropertyDescription_Class/Reference/NSPropertyDescription.html Note that a property name cannot be the same as any no-parameter method name of NSObject or NSManagedObject. For example, you cannot give a property the name description. There are hundreds of methods on NSObject which may conflict with property names—and this list can grow without warning from frameworks or other libraries. You should avoid very general words (like font”, and “color”) and words or phrases which overlap with Cocoa paradigms (such as “isEditing” and “objectSpecifier”). mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: garbage collection and NSConnection
It looks like it was expanded in 10.5, then, but 10.4 and prior use the 16-bit variables. Regardless of whether it handles overflows or not, my little joke was meant to illustrate that too many developers (generally speaking) think that resources (generally speaking) are unlimited and put no thought into what to do if an error occurs or how to handle requirements that are potentially huge. I'm not saying those on this list think this way, but when people say that there's no cost to this or that approach, I just want to say, Get thee a computer science degree! Michael Ash wrote: On Sat, Jul 12, 2008 at 1:24 PM, Marcel Weiher [EMAIL PROTECTED] wrote: No, the inline reference count is available for all CF objects, and not limited to 64 bit. What version of the structure are you looking at? For example http://www.cocoadev.com/index.pl?HowToCreateTollFreeBridgedClass shows this version, which matches what I got from opensource.apple.com I was looking at: http://www.opensource.apple.com/darwinsource/projects/apsl/CF-476.10/CFRuntime.h It defines: typedef struct __CFRuntimeBase { uintptr_t _cfisa; uint8_t _cfinfo[4]; #if __LP64__ uint32_t _rc; #endif } CFRuntimeBase; I guess this isn't the right one, then. To Gary, about 16-bit refcounts, I'd imagine that there's some logic in there where if you hit 0x, it considers that to be a flag to use an external refcount instead, at the cost of some speed. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Janky Tab View Behavior
I'm really hoping this is some stupid thing I'm doing wrong. When I first open the window pictured, I get the behavior shown in the screenshot. I can click where the tabs should be and get the other tab, after which it behaves as it should. Anyone have an idea wth is going on with this? Here's a link to the screenshot: http://skitch.com/jrphelps/pcrw/window Thanks! Jamie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Servicing Core Animations?
Hi Professor Savant, Confirmation that it should work was what I was after, so after reading your email, I decided to write up a test app, and it happens there, too. This is the problem distilled to its simplest form. I welcome any feedback, mockery, etc. If I use the option in (1) below, it works fine. If I use the option in (2), which is what I WANT to use, no animation occurs until after the mouseup happens. -Chilton - (void) mouseDown: (NSEvent *) theEvent { while (1) { theEvent = [[self window] nextEventMatchingMask:(NSAnyEventMask)]; if (([theEvent type]==NSLeftMouseDragged) || ([theEvent type]==NSLeftMouseUp) || ([theEvent type]==NSLeftMouseDown)) { // (1) If I use this, it works fine. No zooom zooom though. //[button setFrameOrigin:[theEvent locationInWindow]]; // (2) If I use this, it doesn't work. //[[button animator] setFrameOrigin:[theEvent locationInWindow]]; if ([theEvent type]==NSLeftMouseUp) { break; } } } } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: triangulating webcams
On 12 Jul 08, at 12:57, Gary L. Wade wrote: Sounds intriguing; at first thought, you may want to consider Xgrid to provide such collaboration, although it may not be what you're needing; there's other means to provide collaborative networking between Macs. If you want feedback on an experimental GUI, try the mac-gui-dev list on Yahoo with any mock-ups you've come up with. Er... I'm really not sure what good XGrid will do here. XGrid is intended for distributing bulk computation over a local network, not for use as a general networking framework. As to the OP's question... I'm not really sure what's meant by triangulating, but if it's anything like what it sounds like, the OpenCV library may be helpful: http://sourceforge.net/projects/opencvlibrary/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: how to get the status of network when the network is set disable.
On 12 Jul '08, at 9:46 AM, xiaobin wrote: I test Michael's sample, it works well. But I think the SCNetworkReachability API is also used to try to connect to the server, right? What I want is to get the status of the network without any connection to the server. The SC reachability API does not send any packets or rely on any connections. All it does is examine the current routing tables to determine whether the kernel knows of a possible route to the destination. —Jens smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
importing sqlite data into a core data database
This seems to be revisiting an old question, but I haven't been able to find an answer. I have an existing set of data in sqlite. To be honest, it isn't set up in the schema I'd most like, yet, but in sqlite I know how to transform it, and put it into the desired schema. I like the features core data/ XCode gives, and don't like the Cocoa wrappers for sqlite (that I've found) for one reason or another -- old, not apparently supported, third party, require too much tinkering, So, being new to Cocoa, XCode, objective-c, How do I get my data into my new Cocoa / core data database? I can think of two approaches off hand: 1) a) generate my application in XCode, use the sqlite storage option, put in some dummy data, then use sqlite3 to explore the resulting schema, b) transform my data into the new schema using sqlite3 and sql. Replace the sqlite file created by my application with the new one containing my real data. 2) writing an import routine for my application, using NSTask (?) and sqlite3. This would likely only be used once. Thanks for any guidance! Best, John V. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Setting Up Socket Streams
Hi all, I have a basic(for most of you) question. I´m trying to make a very simple app that will have 1 button (for example) and when its pushed the app will create a socket connection with a host and will send it a message(command). So , i used this: - (IBAction)reset:(id)sender { [textField setStringValue:@Testing Socket]; NSString *urlStr = [sender stringValue]; if (![urlStr isEqualToString:@]) { NSURL *website = [NSURL URLWithString: @http://192.168.1.2;]; if (!website) { NSLog(@%@ is not a valid URL); return; } NSHost *host = [NSHost hostWithName:@http://192.168.1.2;]; NSInputStream *iStream = [NSString stringWithFormat:@ping]; NSOutputStream *oStream = [NSString stringWithFormat:@ping]; [NSStream getStreamsToHost:host port:8000 inputStream:iStream outputStream:oStream]; [iStream retain]; [oStream retain]; [iStream setDelegate:self]; [oStream setDelegate:self]; [iStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [oStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [iStream open]; [oStream open]; } } @end but my 192.168.1.1 still not recieve nothing... where i'm wrong? Any help will be appreciated. Thank you! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: importing sqlite data into a core data database
On Jul 12, 2008, at 4:54 PM, John Velman wrote: So, being new to Cocoa, XCode, objective-c, How do I get my data into my new Cocoa / core data database? I can think of two approaches off hand: 2) writing an import routine for my application, using NSTask (?) and sqlite3. This would likely only be used once. 3) Write an import routine for your application using the SQLite 3 API in sqlite3.h. Just prepare and step through queries of your old data using the raw SQLite 3 API, and insert new instances of your Core Data entities and set the appropriate properties on them as you go. -- Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Setting Up Socket Streams
On Jul 12, 2008, at 5:22 PM, StaS Bandol wrote: I have a basic(for most of you) question. I´m trying to make a very simple app that will have 1 button (for example) and when its pushed the app will create a socket connection with a host and will send it a message(command). To head this off at the pass, if you want to use HTTP there are easier ways than writing your own raw HTTP support. You can use the NSURL... classes to do all such communication, provided your server speaks standard HTTP. - (IBAction)reset:(id)sender { [textField setStringValue:@Testing Socket]; NSString *urlStr = [sender stringValue]; if (![urlStr isEqualToString:@]) { NSURL *website = [NSURL URLWithString: @http://192.168.1.2;]; if (!website) { NSLog(@%@ is not a valid URL); return; } NSHost *host = [NSHost hostWithName:@http://192.168.1.2;]; Note that @http://192.168.1.2; is a URL, not a host name. Just use the host name portion of the URL. NSInputStream *iStream = [NSString stringWithFormat:@ping]; NSOutputStream *oStream = [NSString stringWithFormat:@ping]; These lines are bogus as you're assigning an NSString instance to variables that are claimed to point to NSInputStream and NSOutputStream objects. If you want to set them to some initial value, set them to nil. [NSStream getStreamsToHost:host port:8000 inputStream:iStream outputStream:oStream]; [iStream retain]; [oStream retain]; [iStream setDelegate:self]; [oStream setDelegate:self]; [iStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [oStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [iStream open]; [oStream open]; } } @end but my 192.168.1.1 still not recieve nothing... where i'm wrong? You register your instance as a delegate for the input and output streams, do you actually send any data to your host once the output stream is opened? If you don't, then the host won't receive anything. Your delegate object should be sent appropriate messages when events occur on the streams, such as the streams opening or closing or having data available. Of course, all of this will be different if you just use the NSURL... classes to handle the HTTP communication on your behalf, as I recommend above. It will probably be a lot easier to get right, and handle lots of the little details for you. -- Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
RE: Triangulating webcams
Thanks much for your thoughtful responses. I found both of them helpful. A few years ago I ran across the MPI framework, but I don't think this required Xgrid, altho you'd certainly need someway to identify network nodes. I don't think MPI requires Xgrid, but I certainly could be wrong on this. There was a nice article describing the running of Xgrid without any kind of 'server'--I didn't think this was possible. I don't have a server implemented and have no intention of installing Xserve (nor a freebie)at present--out of my budgeted time and money. I don't think Xgrid is limited to 'local' as Andrew stated. I can easily transport 'strings' over a network using UDP multi-casting/broadcasting via Quartz Composer, but some of these strings may get a little lengthy. What's a good language statement(s) (obj c API) for transporting small (10MB) data structures over a network? Is this what 'sockets' are used for? In other words, I'm trying to fill the performance gap between extremely small data structures (strings) sent between network nodes and shared NAS time capsule storage. Thanks Andrew for the ref. to opencv, but they won't let me visit any sites outside of Apple:-). I would enjoy developing these by myself, but I keep hearing people say, 'don't do it, it's already been done--reuse and recycle'. Again, thanks for your comments regarding 'triangulating webcams'. -em Is that a Rubik's cube on your desktop? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
importing sqlite data into a core data database
Hi John, On 12/7/08, [EMAIL PROTECTED] wrote: 1) a) generate my application in XCode, use the sqlite storage option, put in some dummy data, then use sqlite3 to explore the resulting schema, b) transform my data into the new schema using sqlite3 and sql. Replace the sqlite file created by my application with the new one containing my real data. Having played around with Core Data for a while my instinct is that option 1 would present difficulties - Core data is particular about the database. Whenever, I've had to make a minor tweak to a core data database outside of core data, I've had a sense of dread. I'd go straight for option 2 without spending a second on option 1. That said, go ahead and dabble briefly with option 1, maybe you'll get lucky. Remember to consider metadata. 2) writing an import routine for my application, using NSTask (?) and sqlite3. This would likely only be used once. I did something like that to bootstrap my point-of-sale application. I didn't use NSTask, I just wrote methods on the relevant window controllers to import tab-delimited customer and product data which I'd exported from a filemaker database. I wrote nested loops to un-flatten the data into a more sophisticated schema. Core data makes all that pretty easy once you parse the tab-delimited data into objects, which cocoa makes easy. I thought, like you, that my code would only be used once but I ended up using it a dozen times while we were developing the app and changing our minds about the schema. And, if and when I have other customers for the app, I'll use it again. Let me know if you'd like some relevant snippets. Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSURLConnection substitutes characters?
Hi I wrote a class (PHPInvocation) that handles all the nitty gritty details of preparing NSURLRequests, NSURLConnections etc for calls to PHP scripts, but have run across this nasty bug. What's happening is that somewhere between the creation of an NSURLConnection and the target PHP script, + characters in base64 data get converted to spaces. I NSLog the data immediately before calling [NSURLConnection sendSynchronousRequest:...] and all the + signs are intact, but when the PHP script extracts the data from the $_POST, all the + signs have been converted to spaces. I don't know if this is a Cocoa problem or a PHP problem but does anyone know if or why Cocoa would do this conversion? If it is a Cocoa feature how would I make it preserve the data exactly as it's given? Thanks for any help. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSURLConnection substitutes characters?
On Jul 12, 2008, at 7:17 PM, [EMAIL PROTECTED] wrote: I don't know if this is a Cocoa problem or a PHP problem but does anyone know if or why Cocoa would do this conversion? If it is a Cocoa feature how would I make it preserve the data exactly as it's given? The first thing I'd do is usage a packet sniffer to grab the data on the wire just to verify whether or not the conversion is happening on the client or server side. By the time PHP sees it, there is a bunch of intervening machinery that could be mucking with it server side. tcpflow + httpflow works well. This, at least, will confirm the problem is on one side or the other. b.bum smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Click to edit
I would like to use text labels that turn into editable text fields when you click them. Like Address Book has when you edit an address card. Does anyone know how those work? Is it a matter of flipping the editable property or are those custom controls? S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSURLConnection substitutes characters?
On Jul 12, 2008, at 10:17 PM, [EMAIL PROTECTED] wrote: Hi I wrote a class (PHPInvocation) that handles all the nitty gritty details of preparing NSURLRequests, NSURLConnections etc for calls to PHP scripts, but have run across this nasty bug. What's happening is that somewhere between the creation of an NSURLConnection and the target PHP script, + characters in base64 data get converted to spaces. A '+' character is a shortcut for a space that you can use in the URI and Query parts of a URL. PHP will convert those for you. Which will happen on the server/php side. If you want to send Base64 encoded data in a query parameter (or post data) then you will need to 'percentage-escape' it properly. In which case a '+' needs to be translated to a '%2b'. S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: importing sqlite data into a core data database
Thanks, Chris, Using the SQLite 3 api as you suggest sounds good, but there are a couple of things that must be obvious to the initiated, but not to me (yet). As I understand, the SQLite 3 api is a C api. Can I do C function calls directly from Objective C? Seems plausible, since Obj C is an extension of C, and if I understand, Objective C is translated into C during the compile. If that's OK so far, how about linking? Is Linking to the SQLite library transparent from XCode? I'd be happy to be pointed to the right documentation! I've read a few hundred pages in the past week, but haven't come across anything directly related to this. Thanks, John Velman On Sat, Jul 12, 2008 at 05:27:56PM -0700, Chris Hanson wrote: On Jul 12, 2008, at 4:54 PM, John Velman wrote: So, being new to Cocoa, XCode, objective-c, How do I get my data into my new Cocoa / core data database? I can think of two approaches off hand: 2) writing an import routine for my application, using NSTask (?) and sqlite3. This would likely only be used once. 3) Write an import routine for your application using the SQLite 3 API in sqlite3.h. Just prepare and step through queries of your old data using the raw SQLite 3 API, and insert new instances of your Core Data entities and set the appropriate properties on them as you go. -- Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: how to get the status of network when the network is set disable.
On Jul 9, 2008, at 8:22 AM, xiaobin wrote: Hello, I am writing a program to detect the status of network. In my program, I need get the status of network when the connection is set disable. here it is not by connecting the network to get the status. which API or method can work for it? I've used two methods in previous projects. This is all CoreFoundation code that I used in daemons but should work just fine in a Cocoa environment. 1) If you just want to know whether the system is connected to a network then you can lookup the default router. If the default router is present then you could assume that the network is up. CFStringRef CFXGetDefaultIPv4RouterCopy() { CFStringRef result = NULL; SCDynamicStoreRef dynamicStore = SCDynamicStoreCreate(NULL, CFSTR(StefansCoreFoundationExtensions), NULL, NULL); if (dynamicStore != NULL) { CFDictionaryRef properties = (CFDictionaryRef) SCDynamicStoreCopyValue(dynamicStore, CFSTR(State:/Network/Global/ IPv4)); if (properties != NULL) { result = (CFStringRef) CFDictionaryGetValue(properties, CFSTR(Router)); if (result != NULL) { CFRetain(result); } CFRelease(properties); } CFRelease(dynamicStore); } return result; } 2) If you want to continuously monitor the network status then you can ask the System Configuration framework to let you know then the default route changed. void DefaultRouteHasChanged(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info) { ... } void Foo() { ... // Start a watcher to keep track of State:/Network/Global/IPv4 SCDynamicStoreContext context = {0, NULL, NULL, NULL, NULL}; gDynamicStore = SCDynamicStoreCreate(NULL, CFSTR(SampleApp), DefaultRouteHasChanged, context); CFStringRef key = SCDynamicStoreKeyCreate(NULL, CFSTR(%@/%@/%@/ %@), kSCDynamicStoreDomainState, kSCCompNetwork, kSCCompGlobal, kSCEntNetIPv4); CFArrayRef keyArray = CFArrayCreate(NULL, (const void **)(key), 1, kCFTypeArrayCallBacks); SCDynamicStoreSetNotificationKeys(gDynamicStore, keyArray, NULL); CFRelease(keyArray); CFRelease(key); CFRunLoopSourceRef runLoopSource = SCDynamicStoreCreateRunLoopSource(NULL, gDynamicStore, 0); CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes); CFRelease(runLoopSource); ... // Run the RunLoop CFRunLoopRun(); } S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: importing sqlite data into a core data database
See below: On Sun, Jul 13, 2008 at 12:09:13PM +1000, Steve Steinitz wrote: Hi John, On 12/7/08, [EMAIL PROTECTED] wrote: 1) a) generate my application in XCode, use the sqlite storage option, put in some dummy data, then use sqlite3 to explore the resulting schema, b) transform my data into the new schema using sqlite3 and sql. Replace the sqlite file created by my application with the new one containing my real data. Having played around with Core Data for a while my instinct is that option 1 would present difficulties - Core data is particular about the database. Whenever, I've had to make a minor tweak to a core data database outside of core data, I've had a sense of dread. I'd go straight for option 2 without spending a second on option 1. That said, go ahead and dabble briefly with option 1, maybe you'll get lucky. Remember to consider metadata. 2) writing an import routine for my application, using NSTask (?) and sqlite3. This would likely only be used once. I did something like that to bootstrap my point-of-sale application. I didn't use NSTask, I just wrote methods on the relevant window controllers to import tab-delimited customer and product data which I'd exported from a filemaker database. I wrote nested loops to un-flatten the data into a more sophisticated schema. Core data makes all that pretty easy once you parse the tab-delimited data into objects, which cocoa makes easy. I thought, like you, that my code would only be used once but I ended up using it a dozen times while we were developing the app and changing our minds about the schema. And, if and when I have other customers for the app, I'll use it again. Let me know if you'd like some relevant snippets. Steve Thanks Steve. This sounds good, and pretty straightforward. Being a novice, I'd certainly appreciate some relevant snippets, if it's not too much trouble. John V. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: importing sqlite data into a core data database
On Jul 12, 2008, at 11:25 PM, John Velman wrote: Thanks, Chris, Using the SQLite 3 api as you suggest sounds good, but there are a couple of things that must be obvious to the initiated, but not to me (yet). As I understand, the SQLite 3 api is a C api. Can I do C function calls directly from Objective C? Seems plausible, since Obj C is an extension of C, and if I understand, Objective C is translated into C during the compile. Yes. Objective-C is a superset of C. Anything that works in C works in Objective-C. If that's OK so far, how about linking? Is Linking to the SQLite library transparent from XCode? Looks like the CoreData framework is directly linked against sqlite. So you can just include sqlite3.h and linkage will be fine if you already depend on that framework. (Which you probably do :-) % otool -L /System/Library/Frameworks/CoreData.framework/CoreData | grep sqlite /usr/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0) The raw SQLite API is pretty simple. If you need help then I would suggest to get the SQLite book. http://www.apress.com/book/view/9781590596739 (The index of the book sucks, i would suggest to buy the PDF if you don't mind reading on the screen) S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSURLConnection substitutes characters?
-- Original message -- From: Stefan Arentz [EMAIL PROTECTED] If you want to send Base64 encoded data in a query parameter (or post data) then you will need to 'percentage-escape' it properly. In which case a '+' needs to be translated to a '%2b'. Bingo! That did the trick. Thanks Stefan. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSURLConnection substitutes characters?
-- Original message -- From: Stefan Arentz [EMAIL PROTECTED] If you want to send Base64 encoded data in a query parameter (or post data) then you will need to 'percentage-escape' it properly. In which case a '+' needs to be translated to a '%2b'. I posted basically the same question on a PHP forum and one poster set off a lightbulb. I use the following method in the PHPInvocation class to build the post and because of my choice of Content-Type in the httpHeaderField of the NSMutableURLRequest, the data is getting urlencoded on the Cocoa end. + (id) phpRequestWithURL:(NSURL *) inURL data:(NSData *) inData { NSMutableURLRequest *result = [NSMutableURLRequest requestWithURL: inURL]; NSString*dataLength = [[NSNumber numberWithInt: [inData length]] stringValue]; [result setHTTPMethod: @POST]; [result setValue: @application/x-www-form-urlencoded forHTTPHeaderField: @Content-type]; [result setValue: dataLength forHTTPHeaderField: @Content-length]; [result setValue: @close forHTTPHeaderField: @Connection]; [result setHTTPBody: inData]; return result; } Is there some content type I could use other than application/x-www-form-urlencoded that would work with PHP scripts? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Trigonometric Problem, Particularly tan() Function
For some reason, using standard trigonometric functions are not behaving as they should once you hit 90 degrees. I'm not importing another framework/library and assuming the ones I'm calling are the same ones found in the standby math.h. The functions return correct values until you reach odd multiples of 90 degrees when one should not be getting finite values as I am getting. I'm assuming that the functions that I am using are basically from math.h and using a Taylor-like numerical method. Any suggestions or alternatives? I've looked/searched through the documentation and have not found any other options. Thank you for your time. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trigonometric Problem, Particularly tan() Function
Just to make sure, you are aware those functions from math.h take arguments in radians, and not degrees, right? -- ivan On Jul 13, 2008, at 12:30 AM, Patrick Walker wrote: For some reason, using standard trigonometric functions are not behaving as they should once you hit 90 degrees. I'm not importing another framework/library and assuming the ones I'm calling are the same ones found in the standby math.h. The functions return correct values until you reach odd multiples of 90 degrees when one should not be getting finite values as I am getting. I'm assuming that the functions that I am using are basically from math.h and using a Taylor-like numerical method. Any suggestions or alternatives? I've looked/searched through the documentation and have not found any other options. Thank you for your time. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/isk_lists%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSURLConnection substitutes characters?
On Jul 13, 2008, at 12:25 AM, [EMAIL PROTECTED] wrote: -- Original message -- From: Stefan Arentz [EMAIL PROTECTED] If you want to send Base64 encoded data in a query parameter (or post data) then you will need to 'percentage-escape' it properly. In which case a '+' needs to be translated to a '%2b'. I posted basically the same question on a PHP forum and one poster set off a lightbulb. I use the following method in the PHPInvocation class to build the post and because of my choice of Content-Type in the httpHeaderField of the NSMutableURLRequest, the data is getting urlencoded on the Cocoa end. + (id) phpRequestWithURL:(NSURL *) inURL data:(NSData *) inData { NSMutableURLRequest *result = [NSMutableURLRequest requestWithURL: inURL]; NSString*dataLength = [[NSNumber numberWithInt: [inData length]] stringValue]; [result setHTTPMethod: @POST]; [result setValue: @application/x-www-form-urlencoded forHTTPHeaderField: @Content-type]; [result setValue: dataLength forHTTPHeaderField: @Content-length]; [result setValue: @close forHTTPHeaderField: @Connection]; [result setHTTPBody: inData]; return result; } Is there some content type I could use other than application/x-www- form-urlencoded that would work with PHP scripts? Depends on what you are posting to the script :-) If it is a query string then the above is correct. If it is XML or JSON then you probably want to use something different. S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trigonometric Problem, Particularly tan() Function
Yes, I'm aware that you need to supply radians. Everthing appears to be fine when going from 0 to 45 degrees but at 90 degrees, the tangent returns -22877334. I've even tried doing the tan(x) = sin(x) / cos(x) approach. On 13-Jul-08, at 1:36 AM, Ivan Kourtev wrote: Just to make sure, you are aware those functions from math.h take arguments in radians, and not degrees, right? -- ivan On Jul 13, 2008, at 12:30 AM, Patrick Walker wrote: For some reason, using standard trigonometric functions are not behaving as they should once you hit 90 degrees. I'm not importing another framework/library and assuming the ones I'm calling are the same ones found in the standby math.h. The functions return correct values until you reach odd multiples of 90 degrees when one should not be getting finite values as I am getting. I'm assuming that the functions that I am using are basically from math.h and using a Taylor-like numerical method. Any suggestions or alternatives? I've looked/searched through the documentation and have not found any other options. Thank you for your time. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/isk_lists%40mac.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Click to edit
On 12 Jul '08, at 7:50 PM, Stefan Arentz wrote: I would like to use text labels that turn into editable text fields when you click them. Like Address Book has when you edit an address card. Does anyone know how those work? Is it a matter of flipping the editable property or are those custom controls? You can implement a text field like that fairly easily; I have one that's a subclass of NSTextField overriding two methods (see below). What Address Book does is a different matter. The card is, I believe, a single NSTextView with some tricky delegate methods that control what ranges of the text are editable and selectable. —Jens - (void) mouseDown: (NSEvent*)event { if( ! [self isEditable] ) { [self setBezeled: YES]; [self setDrawsBackground: YES]; [self setEditable: YES]; self.frame = NSInsetRect(self.frame, -2, -3); [self.window makeFirstResponder: self]; } } - (BOOL)sendAction:(SEL)theAction to:(id)theTarget { if( [self isEditable] ) { [self setEditable: NO]; [self setDrawsBackground: NO]; [self setBezeled: NO]; self.frame = NSInsetRect(self.frame, 2, 3); } return [super sendAction: theAction to: theTarget]; } smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Triangulating webcams
On Jul 12, 2008, at 9:40 PM, em wrote: ... I can easily transport 'strings' over a network using UDP multi- casting/broadcasting via Quartz Composer, but some of these strings may get a little lengthy. What's a good language statement(s) (obj c API) for transporting small (10MB) data structures over a network? 10 MB is not exactly small. Depending on your network that will take at least a second (in case of gigabit ethernet) to transmit. S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trigonometric Problem, Particularly tan() Function
Show your code. Obviously the tan() function works as it should, so it must be how you're using it. Graham On 13 Jul 2008, at 2:43 pm, Patrick Walker wrote: Yes, I'm aware that you need to supply radians. Everthing appears to be fine when going from 0 to 45 degrees but at 90 degrees, the tangent returns -22877334. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trigonometric Problem, Particularly tan() Function
On Sun, Jul 13, 2008 at 12:43 AM, Patrick Walker [EMAIL PROTECTED] wrote: Yes, I'm aware that you need to supply radians. Everthing appears to be fine when going from 0 to 45 degrees but at 90 degrees, the tangent returns -22877334. I've even tried doing the tan(x) = sin(x) / cos(x) approach. Floating point arithmetic is inherently imprecise. Atan(-22877334) is equal to pi/2 to within roughly eight decimal places or approximately 25 bits. I'm not sure what the guaranteed accuracy of that function is supposed to be, and this does seem to be a bit excessive, but on the other hand you are right next to a singularity in the function. Depending on how you're generating 90 degrees, that could be introducing further inaccuracy. These aren't mathematically ideal functions, so you can't expect them to behave as such. This goes particularly when using them in a region of extreme behavior such as this. In particular you should never expect a function which is undefined or infinite at a single point and defined and finite in all the regions immediately adjacent to that point to produce an undefined or infinite result, unless that point is a value which can be represented precisely, such as 0. 90 degrees cannot be represented precisely when converted to radians, so you'll never get NaN or INFINITY out of the tan() function. If you still think they're misbehaving, I suggest posting the code you're using. It's difficult to provide more specific help with no code. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Triangulating webcams
On 12 Jul '08, at 6:40 PM, em wrote: I can easily transport 'strings' over a network using UDP multi- casting/broadcasting via Quartz Composer, but some of these strings may get a little lengthy. What's a good language statement(s) (obj c API) for transporting small (10MB) data structures over a network? UDP's not well suited to that. The maximum size of a packet is 64kbytes, and in practice, packets larger than a few kbytes often get lost due to fragmentation. Best practice with UDP is to keep the packet size under about 1400 bytes so it fits in a single Ethernet packet, and to be ready to handle packets that are dropped, or arrive multiple times or in the wrong order. So you're better off using TCP. Leave a connection open between the machines and send messages over it (in either direction) when you have data. But you need a framing protocol to define the boundaries of messages, match messages with responses, let you interleave messages, and so on. Nowadays most people do this with HTTP, but that's an asymmetric protocol and CF/Cocoa don't come with a server-side implementation, only a client. Other options are to invent yet another protocol to do this (which can become a mess) or use a generic message protocol like BEEP. In my case I went with BEEP, but there is no available Obj-C API for it [though Xgrid has its own private implementation], and the open- source C library I first used became more trouble than it was worth, so I ended up designing and implementing a simple BEEP-like protocol called BLIP http://projects.mooseyard.com/wiki/1/BLIP. It has a simple Objective-C API that lets you send messages from one machine to another, and optionally send replies. It should work well for what you're trying to do. —Jens smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Trigonometric Problem, Particularly tan() Function
On 12 Jul '08, at 9:43 PM, Patrick Walker wrote: Everthing appears to be fine when going from 0 to 45 degrees but at 90 degrees, the tangent returns -22877334. That's not what I get. I just compiled and ran: printf(tan(90) = %g\n, tan(M_PI/2)); which printed: tan(90) = 1.63312e+16 Which is not infinity, but close enough, given that π/2 can't be represented precisely in floating-point arithmetic. I think you need to show us the code you're using, as there seems to be something wrong with it. —Jens smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: importing sqlite data into a core data database
On Jul 12, 2008, at 8:33 PM, Stefan Arentz wrote: If that's OK so far, how about linking? Is Linking to the SQLite library transparent from XCode? Looks like the CoreData framework is directly linked against sqlite. That doesn't matter. If you want to use the SQLite 3 API from your application, you need to add the SQLite 3 dynamic library to your target. In Xcode 3.1, you can do this in the General pane of the info panel for your target - it will show all frameworks and libraries available based on the SDK you're using and the framework library search paths that you've set up. -- Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Re: How to make the FileOwner of a nib file accessible globally in whole project (JArod Wen)
Now I have found a possible solution, which is working well to me: just simply change the declaration in header file by adding extern keyword, which will prevent the instant being created repeatedly. Wish this helpful to others. On Jul 1, 2008, at 2:53 PM, [EMAIL PROTECTED] wrote: -- Message: 13 Date: Tue, 1 Jul 2008 14:48:15 -0400 From: JArod Wen [EMAIL PROTECTED] Subject: Re: How to make the FileOwner of a nib file accessible globally in whole project (JArod Wen) To: cocoa-dev@lists.apple.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes I need to make some clearance on this problem: the biggest issue is that MovieDocument is instantiated by IB, since it is the FileOwner of the MovieDocument.nib. So the problem should be: is there a way to access a class from a method of another class when the first class is instantiated from a NIB file. I am now trying to set an IBOutlet in the other classes for MovieDocument. It is the only way I can find from my brain... Frankly say, I am a real newbie... sorry for any confusion... Hi Jedis, Here is my problem: my application now have a main nib file MovieDocument.nib with its FileOwner MovieDocument.mm(We used AVCVideoServices which requires to be in a c++ source file). I need to send messages to the methods in MovieDocument.mm from other classes in the project(I have many other windows and also corresponding controllers), so i need a way to access the movieDocument globally. One example: there is another controller VideoController.m which contains some measurement methods on the movie loaded in movieDocument. Once we finish the measurement in VideoController, we need to update the movie in MovieDocument, where we need to send message to the methods in MovieDocument. This is from VideoController.m - (void)writeMeasureOutput:(MeasureView *)sender { // Some measurement code here... object = [[movieDocument measureView] whatsNext]; NSLog(@Next measurement: %@,object); } Such calls should be used in many other controllers in the projects. So the instant of MovieDocument should be accessed globally. I have tried to instantiate MovieDocument in MovieDocument.h, but it is clearly wrong since when the header file is imported, the instant will be created once. So any suggestion on this problem? Thanks in advance! --- JArod Wen --- JArod Wen --- JArod Wen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSURLConnection substitutes characters?
On 12 Jul '08, at 9:25 PM, [EMAIL PROTECTED] wrote: Is there some content type I could use other than application/x-www- form-urlencoded that would work with PHP scripts? You can use any content-type you like, but your PHP script will then have to read the data from the input stream itself, because PHP won't parse it into a $POST dictionary for you. Or you could keep using the urlencoded type, but then you have to encode the body according to that data type, i.e. as name-value pairs with the right delimiters and URL encoding, or it'll get mangled when PHP tries to decode it. —Jens smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: importing sqlite data into a core data database
On 12 Jul '08, at 8:25 PM, John Velman wrote: I'd be happy to be pointed to the right documentation! I've read a few hundred pages in the past week, but haven't come across anything directly related to this. Introduction to the sqlite3 API: http://www.sqlite.org/cintro.html Full API reference: http://www.sqlite.org/capi3ref.html It's pretty straightforward, but I think it'd probably make more sense for you to use an existing wrapper like QuickLite or FMDB. There's nothing wrong with third party code; it's what you're writing yourself, after all, and you can save time by taking advantage of someone else's having written the same code already. —Jens smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Setting Up Socket Streams
On 12 Jul '08, at 5:22 PM, StaS Bandol wrote: but my 192.168.1.1 still not recieve nothing... where i'm wrong? That's because you didn't write anything to the streams. You just opened and scheduled them. You need to wait for the streams to finish opening them, then write to the output stream. NSInputStream *iStream = [NSString stringWithFormat:@ping]; NSOutputStream *oStream = [NSString stringWithFormat:@ping]; [NSStream getStreamsToHost:host port:8000 inputStream:iStream outputStream:oStream]; This code doesn't make any sense. First you're assigning values of the wrong type to the pointers (which surely produced a compiler warning, and you should pay attention to those). Then when you called NSStream it simply overwrote those pointers with the pointers to the streams it opened. You really need to read the documentation for +[NSStream getStreamsToHost:], as it doesn't behave the way you seem to think it does... —Jens smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Problem on reload data source of a table view
Hi all, I met some problems on updating the content of my table with the following scenario: My table is contained in a separated window(tableWindow.xib), so I use a TableController class to control it(File's Owner of the window). The following is the instant of TableController: @interface TableController : NSWindowController { IBOutlet NSTableView*dataTable; IBOutlet NSTableHeaderView* headers; IBOutlet NSTableColumn* column; IBOutlet TableSource* tableSource; } In IB I connected the window containing table view to window of File's Owner(TableController), and also table view to dataTable. I have another TableSource class: @interface TableSource : NSArrayController{ NSMutableArray * items; NSMutableDictionary * parameters; NSMutableDictionary * paramLabels; } - (int)numberOfRowsInTableView:(NSTableView *)tableView; - (id)tableView:(NSTableView *)tableView objectValueForTableColumn: (NSTableColumn *)tableColumn row:(int)row; - (void)tableView:(NSTableView *)aTableView setObjectValue:anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; In this class, I store the data into the items array. I added an object for Table Source in IB and connected it to tableSource of File's Owner and also dataSource of table view of the window(tableWindow.xib). There is a AppController which is used to initialize TableController with the following code: -(void)loadTableController{ if (tableController == NULL) { [self setTableController:[[TableController alloc] init]]; if (![NSBundle loadNibNamed:@tableWindow owner:tableController]) { NSLog(@Error loading TableController);} else{ NSLog(@TableController NIB Loaded); } [tableController loadWindow]; } } When running, the window containing table can be showed correctly, and I can also initialize the column of the table by the following code: NSTableColumn* column = [[NSTableColumn alloc] init]; [[column headerCell] setStringValue:str1]; [column setWidth:cWidth]; [[[appController tableController] dataTable] addTableColumn:column]; [column release]; The problem is that after I update the data source, which is tableSource in tableController, [dataTable reloadData] will not update the table view in the window. I have debugged the program and found that the content of data source has been updated, which means that, the updated information has been stored in data source. However, these changes cannot be showed in the table view in the window. I have checked the connection between dataTable and tableSource, and no problem found there. Any suggestions on this problem? Thanks in advance! --- JArod Wen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSMenuItem custom view and isHighlighted
I'm trying to use the new custom views in NSMenuItem from within an NSPopUpButton. However, I would like these items to still be selectable, that is, if the user lets go while hovering on top of one, I'd still like the NSPopUpButton to use it's index for the displayed item. I can't seem to find any way of telling the NSPopUpButton to select the said item if the user lets go of the mouse (or clicks), on the custom view. Is there any way to achieve this? Thanks, Francisco ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem on reload data source of a table view
On 12 Jul '08, at 10:35 PM, JArod Wen wrote: The problem is that after I update the data source, which is tableSource in tableController, [dataTable reloadData] will not update the table view in the window You're sure that, at runtime, 'dataTable' is not nil? It's easy to overlook an outlet when wiring up the nib, and a nil object pointer acts as a no-op. If that's not the problem, add an NSLog call to your - objectValueForTableColumn: method, so you can see whether it's getting called again after you call reloadData. —Jens smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]