Re: CGDisplayRegisterReconfigurationCallback not called when view in fullscreen

2012-07-24 Thread Tom Hohensee
Ken
You are right. I was capturing the screen.  Setting the presentation options in 
the options dictionary for enterFullScreenMode with options: did the trick.  
However, with the presentation options set, I am only getting one view to show 
the other is blacked out (ie the view on the external monitor is shown but the 
main screen on the built-in display is black).  I have tried various 
presentation options but results are similar.

Thanks
Tom
 
On Jul 24, 2012, at 8:09 PM, Ken Thomases wrote:

> On Jul 24, 2012, at 7:47 PM, Tom Hohensee wrote:
> 
>> Anyone familiar with CGDisplayRegisterReconfigurationCallback callback and 
>> fullscreen when connecting and disconnecting an external monitor?
>> I have written an application that places a custom NSView into fullscreen 
>> (using enterfullscreenmode with options) on an external monitor while the 
>> main window remains on the main (built-in screen).  The view enters and 
>> exits as expected but I was trying to cover all my bases and have the 
>> fullscreen exit gracefully if the external monitor is unplugged while my 
>> application is running.  In my research I came across 
>> CGDisplayRegisterReconfigurationCallback.
> 
>> When the application is not in fullscreen my application receives and the 
>> callback function works as expected.  However, when the view is in 
>> fullscreen the callback function is not called when the monitor is 
>> unplugged.  In fact the OS does not update the screen configuration until I 
>> exit fullscreen (through a test button I implemented on the main window).
> 
> I suspect you're not receiving the callback because the display is captured.  
> The docs for -[NSView enterFullScreenMode:withOptions:] explain how to avoid 
> capturing the display.
> 
> Capturing the display means that you're taking over sole responsibility and 
> access to it.  It also means that other apps won't be notified when that 
> display's configuration is changed.  (For example, the Finder won't rearrange 
> your desktop icons if the display is set to a low-resolution mode.)  It's not 
> obvious to me that that would include preventing your own app from being 
> informed when the display is disconnected, but apparently it does.
> 
> You might file a bug with Apple.  Also, you might ask on the quartz-dev list.
> 
> Regards,
> Ken
> 


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


CGDisplayRegisterReconfigurationCallback not called when view in fullscreen

2012-07-24 Thread Tom Hohensee
Anyone familiar with CGDisplayRegisterReconfigurationCallback callback and 
fullscreen when connecting and disconnecting an external monitor?
 I have written an application that places a custom NSView into fullscreen 
(using enterfullscreenmode with options) on an external monitor while the main 
window remains on the main (built-in screen).  The view enters and exits as 
expected but I was trying to cover all my bases and have the fullscreen exit 
gracefully if the external monitor is unplugged while my application is 
running.  In my research I came across 
CGDisplayRegisterReconfigurationCallback.  I implemented the callback as 
follows  

void TheDisplayReconfigurationCallBack ( CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void *userInfo)
{
if (flags & kCGDisplayAddFlag) {
NSLog (@"Display Added");
}
else if (kCGDisplayRemoveFlag) {
NSLog (@"Display Removed");
[[NSNotificationCenter defaultCenter] 
postNotificationName:@"ScreenDisconnected" object:nil];

}
}

and called:

CGDisplayRegisterReconfigurationCallback(TheDisplayReconfigurationCallBack, 
NULL);

in a method in my implementation.

When the application is not in fullscreen my application receives and the 
callback function works as expected.  However, when the view is in fullscreen 
the callback function is not called when the monitor is unplugged.  In fact the 
OS does not update the screen configuration until I exit fullscreen (through a 
test button I implemented on the main window).

Any help would be appreciated I think I have exhausted all my google answers 
for CGDisplayRegisterReconfigurationCallback.

Thanks
Tom

The applications runs on both 10.6 and 10.7.
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Base64 encoding of NSImage

2012-07-01 Thread Tom Hohensee
Try here.  it is a category for nsdata in this post.
http://www.thohensee.com/?page_id=435

Tom

Sent from my iPhone

On Jul 1, 2012, at 10:26 AM, Alexander Hartner  wrote:

I am looking at available option to send an NSImage to a webserver. I came
across gSoap however its licensing model makes it not suitable. Using REST
/ JSON seems like an easy option however NSDATA does not seem to be
supported by the JSON Serialiser. The one remaining option I considered was
to encode the image myself to base64 before including in the JSON request.
This could work quite nicely, however there doesn't seem to be a standard
method for base64 encoding.

Any suggestion on how to best achieve this.

Kind regards
Alex
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/tom.hohensee%40gmail.com

This email sent to tom.hohen...@gmail.com
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-20 Thread Tom Hohensee
Have a look at iCarousel.  Has a port for iOS as well as Mac OS.  
This can be done with ImageKit in IB as well.  Just disable the scroll view and 
setup forward and back buttons that call the image index (nextIndex, etc). See 
imageKit docs.

Tom
 

On Dec 20, 2011, at 3:00 PM, Nick wrote:

> Hello
> I am wondering, if a component exists similar to this
> http://www.ajaxdaddy.com/demo-jquery-carousel.html
> for Mac OS.
> 
> Basically, what I need is just "next" and "previous" buttons (and
> these images smoothly scrolled one image per "next" or "prev" button
> click).
> 
> At the moment I am trying to implement it on my own.
> This seems to be a simple NSScrollView with hidden scroll bars whose
> inner view has these image views added as subviews.
> 
> However, I am not sure how to implement smooth scrolling of one image
> per click. I guess I need to use Core Animation?
> Are there any simple examples that I could look at?
> ___
> 
> 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/tom.hohensee%40gmail.com
> 
> This email sent to tom.hohen...@gmail.com

___

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 arch...@mail-archive.com


Re: IKImageBrowserView spinning animation on the Cell

2011-10-29 Thread Tom Hohensee
Create a CALayer with the spinning effects. and use the following 
IKImageBrowser cell Core Animation layer method.  

- (CALayer *)layerForType:(NSString *)type

where NSString is a “Cell Layer Positions” type 
IKImageBrowserCellForegroundLayer.

For the spinning effects layer have a look at 
https://github.com/kelan/yrk-spinning-progress-indicator-layer.  You should be 
able to use the YPKSpinningProgressLayer classes for what you need.

Tom

On Oct 29, 2011, at 7:58 AM, XiaoGang Li wrote:

> IKImageBrowserCel

___

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 arch...@mail-archive.com


Re: Best way to parse a time today?

2011-10-13 Thread Tom Hohensee
I use the same approach the Roger pointed out  and have not encountered any 
problems as well.  However, I not only set the time but the date (month, day, 
year) as well.  The DST boundries should not matter since I am decomposing 
today's date [NSDate date],  which is set by the end user's time settings in 
system preferences.  Is this not correct? 

Thanks.

Tom

On Oct 12, 2011, at 9:01 PM, Roger Dalal wrote:

> Dave:
> 
> Would it be possible for you to present an improved approach, please? I use 
> this solution frequently, and have not yet encountered any issues, but now 
> you have me worried! What approach do you suggest?
> 
> Roger Dalal
> 
> 
> On Oct 12, 2011, at 9:49 PM, Dave DeLong wrote:
> 
>> Be careful with this approach, since there are some weird edge cases where 
>> that time may not exist on the proposed day (think DST boundaries). 
>> 
>> Dave
>> 
>> Sent from my iPhone
>> 
>> On Oct 12, 2011, at 6:46 PM, Roger Dalal  wrote:
>> 
>>> Rick:
>>> 
>>> The following code, which is likely what you are doing, will return the 
>>> time in 1970 (NSDate's reference date) because you have not specified a 
>>> date:
>>> 
>>> NSString *timeString = @"14:50 PDT";
>>> NSDateFormatter *df = [[NSDateFormatter alloc ] init];
>>> [df setDateFormat:@"HH':'mm zzz"];
>>> NSDate *date = [df dateFromString:timeString];
>>> [df release];
>>> 
>>> 
>>> Instead, you need to use date components to set the day as well as the 
>>> time, per the following:
>>> 
>>> NSString *timeString = @"14:50 PDT";
>>> NSDateFormatter *df = [[NSDateFormatter alloc ] init];
>>> [df setDateFormat:@"HH':'mm zzz"];
>>> NSDate *date = [df dateFromString:timeString];
>>> 
>>> NSCalendar *calendar = [NSCalendar currentCalendar];
>>> NSDateComponents *dateComponents = [calendar components:( 
>>> NSYearCalendarUnit | NSMonthCalendarUnit |  NSDayCalendarUnit ) 
>>> fromDate:[NSDate date]];
>>> NSDateComponents *timeComponents = [calendar components:( 
>>> NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit ) 
>>> fromDate: date ];
>>> 
>>> [dateComponents setHour:[timeComponents hour]];
>>> [dateComponents setMinute:[timeComponents minute]];
>>> [dateComponents setSecond:[timeComponents second]];
>>> 
>>> NSDate *timeToday = [calendar dateFromComponents:dateComponents];
>>> [df release];
>>> 
>>> Change 'fromDate' in NSDateComponents *dateComponents to whatever date you 
>>> want in order to create your time on a different day.
>>> 
>>> Best Wishes.
>>> 
>>> Roger Dalal
>>> 
>>> 
>>> 
>>> 
>>> On Oct 12, 2011, at 9:30 PM, Rick Mann wrote:
>>> 
 I have a situation where I have to parse times like "14:50 PDT". If I just 
 set up an NSDateFormatter with dateFormat = @"HH:mm z", I end up with a 
 time of day in 1970.
 
 What's the best way to get it to give me that time of day today?
 
 Thanks,
 Rick
 
 ___
 
 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/roger.dalal%40gmail.com
 
 This email sent to roger.da...@gmail.com
>>> 
>>> ___
>>> 
>>> 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/davedelong%40me.com
>>> 
>>> This email sent to davedel...@me.com
> 
> ___
> 
> 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/tom.hohensee%40gmail.com
> 
> This email sent to tom.hohen...@gmail.com

___

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 arch...@mail-archive.com


Re: creating multiple NSTimers

2011-09-30 Thread Tom Hohensee
Thanks for the discussion.  What I implemented last night was what Graham had 
suggested.  I simply bind my table column values to an NSArrayController 
controller and observed by KVO in my set box object.  It works great.  I think 
this is also what Conrad had meant as well.  Simply changing the time updates 
or invalidates the timer for each box.  It is far more elegant that what I was 
originally doing.
Not to carry this discussion too long,  I created this confusion in my head by 
looking at a project I did 4 years ago while developing a sprinkler controller. 
 In that project I ended up creating a schedule object which was a property for 
each relay on a controller board which was as an object as well.  Each relay 
(sprinkler zone) had an address, on and off commands and an indeterminate 
number of schedule objects as properties.  If you think about this it is quite 
challenging as you can very easily end up with 100's of timers on the run loop 
at any one time.  Many of these timers (on a 7 day schedule) would be sitting 
around for days waiting to fire.  For just one relay you would have at a 
minimum 2 timers (on and off timers) a day.  Each relay was on a relay board 
with 12 relays. Complicating matters was the fact that here (drought stricken 
Texas) many areas are running a sprinkler zone at multiple short interval times 
per day (mainly at night).  To avoid having all of these timers on the run loop 
I ended up using the one initial timer that when fired started a loop through 
the array of timers. But keep in mind that each "on" command timer also had an 
"off" command timer as well as setting up the next on timer. Also keep in mind 
that only one zone can be on at a time due to water pressure (this being the 
difference between this set top box project and the sprinkler project). 
etc.

Anyway food for thought.

Tom


On Sep 30, 2011, at 3:37 AM, Conrad Shultz wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 9/30/11 12:29 AM, Thomas Davie wrote:
> 
>>> When the user updates a timer, one is forced to re-sort the
>>> array and reposition the index (under the above implementation).
>> 
>> Why would you need to resort?  Just remove, and reinsert.
> 
> OK, I'll grant you it's a fast re-sort, but you still have to find the
> new insertion point and move the index (if needed).
> 
>>> One would also have to implement the scheme carefully,
>>> particularly if the shut-off code is offloaded onto separate
>>> threads, to avoid potential race conditions arising from a user
>>> changing a fire date in the middle of a shut-off sequence.
>> 
>> Careful locking required in multithreaded environment – 
>> unsurprising.
> 
> Of course, though my gut feeling (admittedly happening at a time of
> day where I'm fast fading and likely to put my foot in my mouth...) is
> that the locking would be simpler if one had discrete timers that can
> be scattered across threads (or run their invocations on separate
> threads - though that might be unsuitable for the task at hand).  I
> haven't sat down and implemented this (as you evidently have), so I
> must confess I don't have much to stand on here.
> 
>>> And as Graham mentioned, polling is probably less CPU and power 
>>> efficient than using timers anyway.
>> 
>> Who's suggesting polling - you simply have one timer set for the
>> time at which the first of your actual timers goes off.  When it
>> goes off, you fire the first of your actual timers, and reschedule
>> your "when do other timers go off" timer.
> 
> OK, my apologies, I got turned around and had the earlier suggestion
> about a high-resolution poll still stuck in my head.  You're
> absolutely right - no one is suggesting polling in the above.
> 
>>> Am I missing something conceptually here?  Why are people
>>> pushing for the single timer model?  Is there some hidden
>>> complexity in a multi-timer approach that I'm not seeing?
>> 
>> I implemented the single timer model yesterday, but I have to
>> admit, the reason was because I'm targeting GNUstep, and when I
>> stared at their source I discovered that they simply itterate
>> through *all* timers every run loop iteration checking if they've
>> gone off, their code also starts NSLogging warnings if you have
>> more than 1000 timers.  I have no idea if apple's solution is
>> better than GNUstep's, but if it isn't, the single timer approach
>> would be vastly beneficial.
> 
> Wow, I have to imagine there are a fair number of timers getting fired
> off throughout the system all the time for various tasks and that
> Apple would have optimized it more thoroughly.
> 
> But a cursory inspection of the most recent open source CFRunLoop.c
> suggests that indeed is what is happening inside __CFRunLoopDoTimers.
> It's possible that I'm missing something in my tired state, but it
> sure does look like a simple loop.  (There's a lot of magic happening
> in __CFRunLoopDoTimer, but it still gets called during each loop
> iteration.)
> 
> Huh... c

Re: creating multiple NSTimers

2011-09-29 Thread Tom Hohensee
Bingo!  Thanks.  This is where I was going wrong.  I saw John and Jamie's 
responses earlier and got me thinking in objects again.  But still wasn't 
putting it together.  I had a mental block and was not thinking of the timers 
as properties of the boxes.  Just kept getting stuck on the NSTimer object 
being the object.  Man it is hard to get off of a train of though sometimes.  
Ultimately each facility has between 20 and 30 boxes.  I really did not want to 
poll.

Thanks again
Tom

On Sep 29, 2011, at 7:27 PM, Graham Cox wrote:

> Timers are objects, and can be retained like any other independently of 
> whether they are scheduled on a run loop or not. The run loop will 
> additionally retain the timer, but that's its business.
> 
> In the object that represents the set-top box, just add a 'timer' property 
> (retained), so that you can get the timer associated with the box. Then you 
> are free to invalidate it, reschedule it, add it or remove it from the run 
> loop at will. While leaving the run loop to manage its timers is the usual 
> M.O., if you need more control, then all you need to do is take it.
> 
> Depending on how many set-top boxes there are likely to be (I'm guessing tens 
> rather than thousands), then a separate timer per box is probably a good idea 
> rather than have one timer which is repeatedly compared against a list of 
> schedule times, which amounts to polling and hence will mean waking up the 
> thread more often than necessary.
> 
> --Graham
> 
> 
> On 30/09/2011, at 9:48 AM, Tom Hohensee wrote:
> 
>> Sorry, I started this out wrong.   I am probably over thinking this to the 
>> point of confusion.  Here is where I am. 
>> I have an application for a facility that uses a number of ip enabled set 
>> top boxes to drive TV's  throughout the place.  Each box is to be shutdown 
>> at certain times of the day depending on what part of the facility is closed 
>> for the day.  In my app the user sets up a configuration in an NSTable 
>> whereby each device is set to shut down at a certain time each day.  From 
>> this configuration, I setup timers to correspond to the shutdown time and 
>> have them repeat each 24 hours. I originally thought I would simply load 
>> each into the runloop using NSTimers class method 
>> +scheduledTimerWithTimeInterval:target:selector:userinfo:repeats.  without 
>> retaining a reference to it.  But I ran into the problem of the user 
>> changing a device's shutdown time while the app is running.  I needed to 
>> retain a reference to the timer to invalidate it .  In other words, if the 
>> user comes along and wants to change the configuration (a shut down time) of 
>> one device while the app is running I need to be able to stop the timer that 
>> is currently in the run loop and use the new configuration.  Without 
>> invalidating that timer would I not have an active timer in the run loop on 
>> top of what is created by new configuration? I then moved on the creating 
>> timers and instead of loading them into the run loop I would load them into 
>> an array and and sort them according to time.  I then loop through the array 
>> loading only the first timer of the array into the run loop and retain a 
>> reference to it. Each firing of the timer loads the next timer into the run 
>> loop and retains a reference to it. But this has other issues particularly 
>> when firing times are real close together.
>> 
>> At this point I need a fresh prospective on this.  Any thoughts would be 
>> greatly appreciated. 
> 
> ___
> 
> 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/tomhoh%40mac.com
> 
> This email sent to tom...@mac.com

___

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 arch...@mail-archive.com


Re: creating multiple NSTimers

2011-09-29 Thread Tom Hohensee
Sorry, I started this out wrong.   I am probably over thinking this to the 
point of confusion.  Here is where I am. 
 I have an application for a facility that uses a number of ip enabled set top 
boxes to drive TV's  throughout the place.  Each box is to be shutdown at 
certain times of the day depending on what part of the facility is closed for 
the day.  In my app the user sets up a configuration in an NSTable whereby each 
device is set to shut down at a certain time each day.  From this 
configuration, I setup timers to correspond to the shutdown time and have them 
repeat each 24 hours.  I originally thought I would simply load each into the 
runloop using NSTimers class method 
+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats.  without 
retaining a reference to it.  But I ran into the problem of the user changing a 
device's shutdown time while the app is running.  I needed to retain a 
reference to the timer to invalidate it .  In other words, if the user comes 
along and wants to change the configuration (a shut down time) of one device 
while the app is running I need to be able to stop the timer that is currently 
in the run loop and use the new configuration.  Without invalidating that timer 
would I not have an active timer in the run loop on top of what is created by 
new configuration?  I then moved on the creating timers and instead of loading 
them into the run loop I would load them into an array and and sort them 
according to time.  I then loop through the array loading only the first timer 
of the array into the run loop and retain a reference to it. Each firing of the 
timer loads the next timer into the run loop and retains a reference to it. But 
this has other issues particularly when firing times are real close together.

At this point I need a fresh prospective on this.  Any thoughts would be 
greatly appreciated. 

Tom


On Sep 29, 2011, at 5:15 PM, David Duncan wrote:

> I think you need to backup and explain exactly what your requirements are. If 
> you really do need to track these timers, you will probably need an array or 
> dictionary, but if these timers are all one-shot and they configure the next 
> timer to execute, there seems little reason to maintain your own owning 
> reference to them...
> 
> On Sep 29, 2011, at 3:06 PM, Tom Hohensee wrote:
> 
>> Yes.  What I have worked on is using an array of timers fired sequentially.  
>> Each firing of the timer sets up the next one in the array.  Each new 
>> addition to the array requires invalidating of the active timer and 
>> reordering of the array according to times.   But i have run into problems 
>> when two or more timers are set to fire at the same time. 
>> 
>> Tom
>> 
>> On Sep 29, 2011, at 4:51 PM, David Duncan wrote:
>> 
>>> On Sep 29, 2011, at 2:47 PM, Tom Hohensee wrote:
>>> 
>>>> However, I do not know wether the user will have 1 device or 100 devices.  
>>>> Do I have to setup a finite amount of timers (ultimately having a limit on 
>>>> the number of devices that can be added) or is there a better way?  I have 
>>>> googled for a while now trying to find example code but have come up empty 
>>>> (plenty of finite examples).  I see there are timer applications out there 
>>>> that seem to handle an infinite number of timers.  
>>> 
>>> 
>>> Have you looked into NSMutableArray?
>>> --
>>> David Duncan
>>> 
>>> ___
>>> 
>>> 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/tomhoh%40mac.com
>>> 
>>> This email sent to tom...@mac.com
>> 
> 
> --
> David Duncan
> 

___

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 arch...@mail-archive.com


Re: creating multiple NSTimers

2011-09-29 Thread Tom Hohensee
Yes.  What I have worked on is using an array of timers fired sequentially.  
Each firing of the timer sets up the next one in the array.  Each new addition 
to the array requires invalidating of the active timer and reordering of the 
array according to times.   But i have run into problems when two or more 
timers are set to fire at the same time. 

Tom

On Sep 29, 2011, at 4:51 PM, David Duncan wrote:

> On Sep 29, 2011, at 2:47 PM, Tom Hohensee wrote:
> 
>> However, I do not know wether the user will have 1 device or 100 devices.  
>> Do I have to setup a finite amount of timers (ultimately having a limit on 
>> the number of devices that can be added) or is there a better way?  I have 
>> googled for a while now trying to find example code but have come up empty 
>> (plenty of finite examples).  I see there are timer applications out there 
>> that seem to handle an infinite number of timers.  
> 
> 
> Have you looked into NSMutableArray?
> --
> David Duncan
> 
> ___
> 
> 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/tomhoh%40mac.com
> 
> This email sent to tom...@mac.com

___

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 arch...@mail-archive.com


creating multiple NSTimers

2011-09-29 Thread Tom Hohensee
For the life of me I cannot figure this one out.  I need to create an 
indeterminate amount of timers for an app I am working on.  The app is petty 
simple.  For example, provide a list of ip enabled devices with times to shut 
off and the app executes the device's shutdown at the specified time.  I need 
to retain a reference to each timer so that I can invalidate the timer if 
necessary.  Obviously setting up one timer or two timers is not a problem. 

NSTimer *myTimer1;
NSTimer *myTimer2;
etc.

However, I do not know wether the user will have 1 device or 100 devices.  Do I 
have to setup a finite amount of timers (ultimately having a limit on the 
number of devices that can be added) or is there a better way?  I have googled 
for a while now trying to find example code but have come up empty (plenty of 
finite examples).  I see there are timer applications out there that seem to 
handle an infinite number of timers.  

Thanks
Tom___

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 arch...@mail-archive.com


Re: JSON Parser

2011-09-08 Thread Tom Hohensee
I did give JSONKit a quick run and ran into some issues that I think are the 
64bit issue you are referring to.  I did not spend a whole lot of time trying 
to figure it out.  That is when I decided to ask the list.  I am going to give 
JSON framework a try.   I see that there are some performance differences 
between the two but I should be ok as the JSON responses are short and request 
are few.

Thanks for the responses

Tom

On Sep 8, 2011, at 1:37 PM, Jens Alfke wrote:

> 
> On Sep 8, 2011, at 10:25 AM, Tom Hohensee wrote:
> 
>> I have recently come across the need to handle JSON in an application I am 
>> working on for 10.6 and 10.7.  After googling for a parser I came across 
>> several of them but some look abandoned.  I am unsure which to pick.  Anyone 
>> know of a good current JSON parser for cocoa in 10.6 and 10.7?  
> 
> I’ve been using JSONKit. It claims to be the fastest, and it’s easy to add to 
> a project because it’s only one .m and one .h file.
> 
> As of a month ago, though, it wasn’t compatible with 64-bit apps on 10.7 
> (it’s groping the internals of NSObjects, and there’s a new optimization to 
> the representation of NSNumbers that caused that to crash.) Hopefully this 
> has been fixed. I worked around the problem by conditionally using the 
> built-in NSJSONParser instead when running on 10.7.
> 
> —Jens

___

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 arch...@mail-archive.com


JSON Parser

2011-09-08 Thread Tom Hohensee
I have recently come across the need to handle JSON in an application I am 
working on for 10.6 and 10.7.  After googling for a parser I came across 
several of them but some look abandoned.  I am unsure which to pick.  Anyone 
know of a good current JSON parser for cocoa in 10.6 and 10.7?  

Thanks
Tom

___

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 arch...@mail-archive.com


Re: IKImageBrowserView

2011-08-09 Thread Tom Hohensee
How are you handling the drag operation?

Sent from my iPhone

On Aug 9, 2011, at 2:49 PM, koko  wrote:

> I have implemented
>
> - (void) imageBrowser:(IKImageBrowserView *) view removeItemsAtIndexes: 
> (NSIndexSet *) indexes
>
> and
>
> - (BOOL) imageBrowser:(IKImageBrowserView *) aBrowser moveItemsAtIndexes: 
> (NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex
>
> They are in the same file.  removeItemsAtIndexes is called as expected.
>
> moveItemsAtIndexes is not called when I select images in the view and drag.
>
> I have seen questions on this being encountered by others but no solution.
>
> any help would be appreciated.
>
> -koko___
>
> 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/tom.hohensee%40gmail.com
>
> This email sent to tom.hohen...@gmail.com
___

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 arch...@mail-archive.com


Re: Scanning images

2011-08-09 Thread Tom Hohensee
Ikscannerdevice  (part if image kit) and its related classes is the
new method going forward. There is a drop in IB solution. Double check
10.5 compatibility. Really easy.

Sent from my iPhone

On Aug 9, 2011, at 10:43 AM, Eric Matecki  wrote:

> Hi Tom,
>
> Yes I'm talking about scanner devices.
> But I don't have to support versions EARLIER than 10.5, but from 10.5 to 10.7.
>
> So is it twain or ICA ?
> Which one should have the longest life ?
>
> Thanks.
>
> Tom Hohensee wrote:
>> If you are talking getting images from scanner device. You need TWAIN for 
>> versions earlier than 10.5
>> Sent from my iPhone
>> On Aug 9, 2011, at 10:14 AM, Eric Matecki  wrote:
>>> Hello,
>>>
>>> I need to scan images into my app.
>>> Which technology should I use, it has to work from 10.5.x upwards, PPC and 
>>> Intel, 32 and 64 bits.
>>>
>>> I know only of ICA.
>>> Is there something "better" (ICA dates back to 10.2) ?
>>>
>>> Thanks.
>>>
>>> --
>>> Keep intel OUTSIDE my Mac !
>>> Hiii !!! I can see Intel chips creeping around my G5 !
>>>
>>> Eric M.
>>> ___
>>>
>>> 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/tomhoh%40mac.com
>>>
>>> This email sent to tom...@mac.com
>
>
> --
> Keep intel OUTSIDE my Mac !
> Hiii !!! I can see Intel chips creeping around my G5 !
>
> Eric M.
> ___
>
> 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/tom.hohensee%40gmail.com
>
> This email sent to tom.hohen...@gmail.com
___

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 arch...@mail-archive.com


Re: standardDefaults

2011-07-21 Thread Tom Hohensee
Terminal commands to unhide user/Library in Lion

chflags nohidden ~/Library/   

chflags hidden ~/Library

Tom Hohensee


> I'm not seeing a user/library/Preferences folder on Lion.  Where are they 
> hiding application pLists in Lion (searching for them doesn't find any).
> 
> Tony
> 3CAAM
> ___
> 
> 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/tom.hohensee%40gmail.com
> 
> This email sent to tom.hohen...@gmail.com

___

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 arch...@mail-archive.com


Re: Cocoa-preferred licensing key style?

2011-05-29 Thread Tom Hohensee
http://www.aquaticmac.com/

Sent from my iPhone

On May 29, 2011, at 6:58 PM, Todd Heberlein  wrote:

> For Cocoa apps not distributed through the Mac App Store, is there a 
> common/recommended design pattern for license keys?
> 
> A little googling around I found common locations were:
>/Library/Application Support/YourApp/
>/Library/Preferences/YourAppBundleID.plist
> 
> I'm leaning towards a plist file in /Library/Preferences. Is this a good idea?
> 
> Are there any standard Cocoa classes/frameworks that are helpful for using 
> license keys?
> 
> Thanks,
> 
> Todd
> 
> ___
> 
> 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/tom.hohensee%40gmail.com
> 
> This email sent to tom.hohen...@gmail.com
___

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 arch...@mail-archive.com


IKScannerDeviceView transferMode set to memory

2011-05-26 Thread Tom Hohensee
I am currently rewiring a scanner application which I originally wrote some 
years ago using the TWAIN driver directly into the more modern ImageKit 
IKScannerDeviceView .  I thought that I could customize it enough to meet my 
needs without having to build it using ImageCaptureCore framework with 
extremely limited docs.   I am gathering most of my info from the headers which 
is not to poorly documented but still limited.  Before I abandon the 
convenience of IKScannerDeviceView, I want to confirm some troubles I am having 
with it to be sure that I am not missing some undocumented methods or 
workaround. I have been googling for days through this process but have turned 
up empty.

The goal of my app is to have a scan (or multiple scans) go into memory and 
converted to a multi PDF document by my controller class.  Limited UI settings 
needed.
 
1.  Memory Mode. 
Setting up purely in IB using an IKDeviceBrowserView to discover the scanner(s) 
and setting IKScannerDeviceView as it's delegate works well.  However, setting 
the transferMode to memory in IB does not work.  Basically what I end up with 
is the Image capture app (file mode only). 

 I have tried setting my controller as the delegate and handling the 
IKDeviceBrowserView delegate - (void)deviceBrowserView:(IKDeviceBrowserView 
*)deviceBrowserView selectionDidChange:(ICDevice *)device  Here I set the 
transferMode manually and it works.  However if I change the functionalUnit on 
the scanner using the standard IKScannerDeviceView (ie from flat bed to 
document feeder) I am back to file mode permanently. 
 I am not sure why this is happening as from what I can tell from the headers 
the functional unit change simple makes multiple (1 per page or image in doc 
feeder mode) calls to IKScannerDeviceView delegate - 
(void)scannerDeviceView:(IKScannerDeviceView *)scannerDeviceView 
didScanToURL:(NSURL *)url fileData:(NSData *)data error:(NSError *)error.   
There seems to be no other place to set the transferMode that would affect 
this.  I have tried various other customizations in IKDeviceBrowser delegate 
method and they work as well as survive the functionalUnit change.

2.  UI elements.  
In IB I am able to choose between Simple and Advance modes, Post processing and 
various UI other options.  Setting them in IB works.  However, the checkbox for 
"select separate items"   is the only UI item that is not able to be set or 
removed.  I find this odd as It is the only element  that is not an option in 
IB or documented in the headers.  

Are these Bugs in IKScannerView IB or am I just missing something?

Thanks
Tom___

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 arch...@mail-archive.com


Re: Mac App Store requirements

2011-04-10 Thread Tom Hohensee

Yes
I second what Todd has said.  I am currently working on receipt  
validation for my third app store app.  I did not do it for my first  
two apps, too many other thinks to worry about.   The documentation is  
not very good at this point.


Tom

On Apr 10, 2011, at 6:45 PM, Todd Heberlein wrote:



On Apr 10, 2011, at 4:32 PM, davel...@mac.com wrote:

And you also have add code to verify a valid receipt. There's a few  
samples of how to do this on github (you should modify them to make  
the app more difficult to crack unless you're giving the app away  
for free). Apple has more about this that you can read once you  
join the developer program.


Validating the receipt is optional.

Having recently gone through this with my first application, I  
generally would not recommend it for version 1.0 of someone's first  
app (unless it is a very expensive app). It is surprisingly complex  
and poorly documented, and there are too many other things to worry  
about when getting your first app through the approval process.


If you want copy protection (which is what receipt validation in  
about), I would leave it until the first update to your application  
or the second app you submit.


Todd

___

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/tomhoh%40mac.com

This email sent to tom...@mac.com


___

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 arch...@mail-archive.com


Re: Mac App Store requirements

2011-04-10 Thread Tom Hohensee
Not yet. You have some setup work to do in itunesconnect.  
Apple provides a step by step guideline for submission

Sent from my iPhone

On Apr 10, 2011, at 2:28 PM, Artemiy Pavlov  wrote:

> I am aware of this, and I meant only the technical side. So I built a Cocoa 
> app with XCode, so I can join the developer programme and I am ready to go 
> just like that?
> 
> A.
> 
> On 10 Apr 2011, at 21:47, Laurent Daudelin wrote:
> 
>> There is a set of guidelines about things you should avoid if you don't want 
>> your app to be rejected. Not sure if it's available to non-registered Mac 
>> developers but I think it should.
>> 
>> -Laurent.
>> -- 
>> Laurent Daudelin
>> AIM/iChat/Skype:LaurentDaudelinhttp://www.nemesys-soft.com/
>> Logiciels Nemesys Software  laur...@nemesys-soft.com
>> 
>> On Apr 10, 2011, at 11:16, Artemiy Pavlov wrote:
>> 
>>> Hey all,
>>> 
>>> I am not yet a member of the Mac Developer program, but I am experimenting 
>>> with my own Cocoa OS X app and I would like to know what are the 
>>> requirements on getting it into the Mac App Store.
>>> 
>>> I mean, I have a 32/64 bit Intel build of a vanilla Cocoa app in XCode. 
>>> Where will I go from there? Apart from signing the code with a certificate 
>>> that you receive from Apple, what one needs to do to get his app bundle 
>>> into the Mac App Store? 
>> 
> 
> ___
> 
> 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/tom.hohensee%40gmail.com
> 
> This email sent to tom.hohen...@gmail.com
___

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 arch...@mail-archive.com


Re: how would a beginner know about built-in outlets?

2010-05-10 Thread Tom Hohensee
Yes it is kind of odd.  When I moved on from C to Objective-C and  
Cocoa I found there are many disconnects in the documentation.  More  
specifically, IB and class documentation seems to not tie in very well  
just as you are pointing to in you question.  I always figured it was  
because some concepts (and classes) where so broad and complex that it  
is best to limit the scope.  As to why it is not in the header files?  
I cannot specifically recall any class header files that list the  
built in outlets.
Anyway, very early on I got into the habit of checking for built in  
outlet in IB first then googling from there if needed.


Tom

On May 10, 2010, at 7:31 PM, Matt Neuburg wrote:

I've been thinking about how to explain to a beginner that some  
classes have
built-in outlets, and it strikes me that the documentation falls  
down here.
For example, you know and I know that a UIViewController has a view  
outlet;
it is visible in the Connections inspector in IB when you select an  
object
that's a UIViewController (or a subclass thereof). But the  
UIViewController
class documentation never mentions this fact; and neither does the  
header,

if it comes to that. Doesn't this strike you as kind of odd? m.

--
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com



___

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/tomhoh%40mac.com

This email sent to tom...@mac.com


___

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 arch...@mail-archive.com


Re: Serial device open(2) hang.

2009-06-27 Thread Tom Hohensee

Steve,
Serial out is the tty prefixed with cu.

./a.out/dev/cu.USA49W62P1.1

Tom

On Jun 27, 2009, at 7:55 PM, Steve Checkoway wrote:

I have a Keyspan USA-49WLC USB to 4 serial ports adapter which, when  
plugged in, correctly shows 4 /dev/tty.USA* and 4 /dev/cu.USA*  
devices. I'm trying to talk to a microcontroller on the other end of  
the serial, reading and writing data, so the first step I'm taking  
is to open(2) the appropriate tty. As far as I can tell, this is  
hanging until I unplug the USB cable.  Once I unplug it, it returns  
-1.


[mb:~/temp/serial] steve$ cat gah.c
#include 
#include 
#include 

int main( int argc, char *argv[] )
{
   if( argc != 2 )
   {
   fprintf( stderr, "Usage: %s device\n", argv[0] );
   return 1;
   }
   puts( "Opening file" );
   int fd = open( argv[1], O_RDWR );
   if( fd == -1 )
   {
   perror( argv[1] );
   return 1;
   }
   puts( "Opened!" );
   close( fd );
   return 0;
}
[mb:~/temp/serial] steve$ gcc -Wall gah.c
[mb:~/temp/serial] steve$ ./a.out /dev/tty.USA49W62P1.1
Opening file
/dev/tty.USA49W62P1.1: Device not configured



This same code, when run on Linux using  /dev/ttyS0, works as I  
would expect: It prints "Opening a file" and then "Opened!".


Is this a problem with the Keyspan driver or (as is more likely) am  
I doing something wrong?


--
Steve Checkoway




___
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list  (darwin-...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/tomhoh%40mac.com

This email sent to tom...@mac.com


___

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 arch...@mail-archive.com


Re: Serial port access from C / Objective C

2009-06-16 Thread Tom Hohensee
If you want to access the serial port via Objective-C classes try  
AMSerialPort. It is a collection of classes to access serial ports.  I  
have used it extensively for my serial programs and it works very well.


Tom

On Jun 15, 2009, at 5:10 PM, Vansickle, Greg wrote:




I'm trying to communicate with a Photo Research Spectral photometer  
via USB. The device responds to simple ascii commands via a terminal  
program.


I have no problem accessing this via the screen command from  
Terminal. I need to get to the same capability from a Cocoa project.



From terminal I'd enter:
screen /dev/cu.usbmodem1a21


Once the screen utility starts, I simply type PHOTO (no carriage  
return) and the device would respond "REMOTE MODE" (no carriage  
return) and the spectro photometer displays "REMOTE" on it's panel.


Here's the C code I'm trying to make work. It's Apples  
SerialPortSample, stripped to it's minimum (so I understand what's  
important and what's fluff ...)


#include 
#include 
#include 

int main(void)
{
   intfileDescriptor;
   const char *bsdPath = "/dev/cu.usbmodem1a21";
   const char *cmdString = "PHOTO";
   inthandshake, numBytes;
   int result;
   char buffer[256];
   char *bufPtr;

   fileDescriptor = open(bsdPath, O_RDWR | O_NOCTTY |  
O_NONBLOCK); // returns 3

  if (fileDescriptor == -1) { return -1;}

   result = ioctl(fileDescriptor, TIOCEXCL);
   if (result == -1) { return  
-1; }// returns 0


   result = ioctl(fileDescriptor, TIOCMGET,  
&handshake);   // returns 0, handshake is 0x26
  numBytes = write(fileDescriptor, cmdString,  
strlen(cmdString)); // returns 5


   bufPtr = buffer;
   numBytes = read(fileDescriptor, bufPtr, 15); // returns -1

   close(fileDescriptor);

   return 0;
}

If I remove the read and write, the USB device opens and closes  
properly, i.e. I can access the device successfully using the screen  
command again.


With the write / read in place, although the write appears to work  
(numbytes returns 5),  the photometer does not respond (I get no  
"REMOTE" indication on the instrument panel. The subsequent read  
fails (returns -1).


I've never programmed at the device level like this, so please  
confirm my assumption - I do not need to set the baud rate, parity  
and all that as the device appears to default to a sane state.  
(Screen utility doesn't set it, I assume the default values are set  
in the device it self.)


FWIW, the complete SerialPortSample code, complete with setting up  
the terminal, baud, parity, ... and changing the command strings,  
behaved the same way. I stripped all this out in case the problem  
was setting this stuff up.


Any pointers appreciated.

Greg
___

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/tom.hohensee%40gmail.com

This email sent to tom.hohen...@gmail.com


___

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 arch...@mail-archive.com


Re: generation of software license keys

2009-06-08 Thread Tom Hohensee

Try AquaticPrime.  It is very good and has good documentation.

Tom

On Jun 8, 2009, at 2:57 AM, Matthew Delves wrote:


Hey Folks,
I'm looking for a tutorial or some sample code for creating software  
licenses for an app I'm developing. Unfortunately the interwebs seem  
to be rather confusing with regard to this topic.


Any help would be greatly appreciated.

Thanks,
Matt Delves
___

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/tomhoh%40mac.com

This email sent to tom...@mac.com


___

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 arch...@mail-archive.com


Re: Making an NSButton appear selected.

2009-06-05 Thread Tom Hohensee
I think what you want is to set the button to enabled or not through  
the action of another button? Since NSButton is a subclass on  
NSControl you could use the setEnabled method.


interface
IBOutlet NSButton *Abutton;
IBOutlet NSButton *Bbutton;

implementation

-(IBAction)someActionMethod:(id)selector
{
[Abutton setEnabled:NO];
[Bbutton setEnabled:YES];
...
..
...
}

You can set the state of the other button in the action method.

On Jun 5, 2009, at 6:41 AM, Shraddha Karwan wrote:


I have a series of buttons of type NSButton.
When a particular button is selected, I want to make it appear gray  
as in
this button is selected. When another button is selected, I need to  
change
the color of the previously selected button from Gray to normal. By  
gray I

mean textured.
How do I achieve this?

--
Regards,
Shraddha Karwan

Success usually comes to those who are too busy to be looking for it.
___

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/tomhoh%40mac.com

This email sent to tom...@mac.com


___

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 arch...@mail-archive.com


Re: Scheduling an application

2009-06-05 Thread Tom Hohensee

You are going to have to programmatically load the plist.

On Jun 3, 2009, at 4:52 AM, rethish wrote:


hi,

I want to launch my application using a time based scheduling. I have
created a plist by setting the keys: Label, onDemand,  
ProgramArguments and
startCalenderInterval. And I placed the plist in /Library/ 
LaunchDaemons.


Then i loaded the plist manually using the terminal. It works fine  
on the

specified time.

I want the plist to be loaded automatically on the specified time  
and launch

my application.

How can be it done?

Is there any thing to be set additionally?

Is LaunchDaemons the correct folder to place the plist?


thankyou in advance

___

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/tom.hohensee%40gmail.com

This email sent to tom.hohen...@gmail.com


___

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 arch...@mail-archive.com


Re: launchd detecting when an application is running

2009-06-04 Thread Tom Hohensee

Thanks for the replies.

I am actually quite familiar with launchd but was thinking that maybe  
I had missed something.  I vaguely remember reading a blog where  
someone had used launchd to detect the app launching event but for the  
life of me I cannot find it.   It probably had something to do with  
detecting file changes of the launching app.  Unfortunately, the app I  
want to monitor is a commercial app which is not mine and I am not  
aware of any temp files it creates or files it alters.  For the time  
being I have written a small background app using NSWorkspace to  
detect the event, but I find it a waste of resources especially since  
the program it starts is only used for a brief period of time.  I  
probably will not incorporate it into the final release.


Also,  thanks to Kyle for pointing out the launchd IPC reading on the  
launchd man page.  I have must have scanned that page several times  
but never really paid much attention to that statement.


Tom

On Jun 4, 2009, at 11:51 AM, Greg Guerin wrote:


Tom Hohensee wrote:

I have written an application that I would like to launch whenever  
a certain app is launched. I have used LaunchAgents in the past to  
detect events such as USB insertion and volume mounting to perform  
certain actions. I was wondering if there was a launchd.plist key  
that allowed for launchd to detect an application startup.


Is this for distribution, or only for your personal use?

How soon after the original app launches do you need to start the  
secondary app?


How much control do you have over the original app?

Can you replace the original app's existing executable with another  
one that triggers your secondary app, then goes on to exec the  
original executable?  The trigger could be many things, including  
something that launchd monitors (see 'man launchd.plist' for on- 
demand conditions).


Maybe run a daemon that monitors FSEvents for creation of a temp- 
file you know the original app will create.


Maybe on-demand monitor the original app's user-defaults, so launchd  
triggers that way.


Those are just some random ideas.  It might help if you described  
exactly what you're trying to accomplish, including what the  
original app is.  Describe the problem; don't propose a solution.   
If you've already tried something, tell us what you've tried and  
exactly why it didn't work.  Be specific.


 -- GG

___

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/tomhoh%40mac.com

This email sent to tom...@mac.com


___

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 arch...@mail-archive.com


Re: launchd detecting when an application is running

2009-06-03 Thread Tom Hohensee


On Jun 3, 2009, at 5:23 PM, Dave Keck wrote:
Sorry, that question really was bad.
I have written an application that I would like to launch whenever a  
certain app is launched.  I have used LaunchAgents in the past to  
detect events such as USB insertion and volume mounting to perform  
certain actions.  I was wondering if there was a launchd.plist key  
that allowed for launchd to detect an application startup.


Tom


Your question is unclear and doesn't make much sense.

Please give lots of clarification, and consider posting your question
on a list where it's more on-topic, such as darwin-dev or launchd-dev
(over at macosforge).

David


___

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 arch...@mail-archive.com


launchd detecting when an application is running

2009-06-03 Thread Tom Hohensee
How do I configure a launchd .plist file to detect when an application  
running.


Thanks
Tom
___

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 arch...@mail-archive.com