NSSearchField and Dates

2015-08-20 Thread Jaime Magiera
Hello folks,

This question is a bit simplistic, but I’m not having luck finding an 
explanation. This is my first time using NSSearchFields. I’m in the process of 
binding them to an NSArrayController of data from a previous developer. So far, 
so good for the most part. However, one of the values to query is an NSDate 
with the key of “Start Date” (there is a corresponding “End Date” value). How 
do NSSearchFields interact with NSDate values? What would be the appropriate 
way to handle this? If I write a dateformatter and add it to the 
ValueTransformer, does the search field query against that? 

thanks for any info,

Jaime 


___

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: Trigger nextkeyview based on NSTextField input length

2013-05-17 Thread Jaime Magiera
On May 17, 2013, at 11:03 PM, Kyle Sluder  wrote:

> So rather than the four-field approach, why not use _one_ text field with an 
> NSFormatter subclass that adds and removes the dashes in the license code? 
> Then you get all the text handling behavior users expect for free.


Very wise. Thanks Kyle. 

Jaime Magiera

Sensory Research, Inc.
http://www.sensoryresearch.net

___

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


Trigger nextkeyview based on NSTextField input length

2013-05-17 Thread Jaime Magiera
Hello folks,

I'm writing a license key input window. The license key is broken into four 
parts, separated by "-". I've created four NSTextFields for each component of 
the key to aid typing and identification (e.g. NSTextField1 - NSTextField2 - 
NSTextField3 - NSTextField4 ). The textfields utilize a NSFormatter subclass. 

What is the most appropriate way to trigger nextkeyview after x number of 
characters in the textfields? I'd like for the user to get forwarded to the 
next textfield after typing the appropriate number of characters in the current 
textfield. This is a common practice in license key windows. 

Should I put it [[inputField window ] selectNextKeyView:self] in the formatter 
subclass? Do it in the window controller?

thanks for any thoughts, 

Jaime Magiera

Sensory Research, Inc.
http://www.sensoryresearch.net


___

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: Command line tool using NSImage?

2010-08-21 Thread Jaime Magiera

On Aug 21, 2010, at 5:33 AM, Ken Thomases wrote:

> In short, you can't reliably use AppKit (including NSImage) from a daemon or 
> remote shell.


Thanks for the link. Interesting read.

In short, that's really a bummer. It totally negates a chunk of functionality 
from my framework. I'll have to resort to something like keeping a client app 
running on the server that communicates with the webapp/shell via webservice (a 
security risk in itself). Also, it removes a lot of functionality from the API. 
There are a myriad of useful shell/server tools that could be created with that 
Cocoa functionality. 

Has anyone heard of Apple coming up with a solution to this conundrum? Or is it 
Bug Report time? There has to be some way to do it securely. 

thanks again Ken,

Jaime Magiera

Sensory Research, Inc.
http://www.sensoryresearch.net







___

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


Command line tool using NSImage?

2010-08-21 Thread Jaime Magiera
Hello,

I've got a OSX command line tool that I wish to run in a shell and via a 
WebObjects application. The binary tool is linked to a framework I wrote which 
contains NSImage manipulations. It seems the [NSApplication sharedApplication] 
trick isn't working. I'm still getting... 

Aug 21 02:56:45 node2 MyApp[28773]: An uncaught exception was raised
Aug 21 02:56:45 node2 MyApp[28773]: Error (1002) creating CGSWindow
Aug 21 02:56:45 node2 MyApp[28773]: *** Terminating app due to uncaught 
exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating 
CGSWindow'

The binary is running on Leopard. Are there any ways to run NSImage methods in 
a command line app run remotely? Did I perhaps miss a step?

thanks for any info,

Jaime Magiera

Sensory Research, Inc.
http://www.sensoryresearch.net







___

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 tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Jaime Magiera

On Jun 26, 2010, at 12:46 PM, Dave DeLong wrote:

> -[NSNumber objCType]
> 
> Compare that against @encode(float), @encode(int), etc.


That did the trick. Thanks!

if((strcmp([aNumber objCType], @encode(int))) == 0) {
NSLog(@"It's a int");
} else if((strcmp([aNumber objCType], @encode(float))) 
== 0) {
NSLog(@"It's a float");
    }


Jaime Magiera

Sensory Research, Inc.
http://www.sensoryresearch.net







___

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


How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Jaime Magiera
Hello,

The list search keeps timing out for me, and web searches are not finding 
anything. I can see how to tell if an NSNumber was initialized with an int or 
boolean (NSCFNumber vs. NSCFBoolean). However, I can't figure out how to 
determine if the NSNumber was initialized with an int or float.

thanks for any help,

Jaime Magiera

Sensory Research, Inc.
http://www.sensoryresearch.net







___

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: NSFileHandle or a better way?

2009-01-30 Thread Jaime Magiera

On Jan 30, 2009, at 11:08 AM, Keary Suska wrote:


I suspect your bottleneck is the filesystem. To know for sure you  
could try the raw C calls and see if it speeds up. In any case,  
instead of doing a grow/shrink on the file, write to a temp file  
instead then swap them. This way you could also do optimized batch- 
writes. This alone could speed the process up immensely.  
Notwithstanding, how do you recover if your app crashes after you  
truncate the file?



Hi Keary,

Thanks for the response. The project did originally start out writing  
to temp files for these processes. However, I got a complaint from a  
customer about the disk footprint of temp files. So, I tried going the  
other route. (I explained the value of tmp files, but they felt the  
tradeoff wasn't worth it). Now, it seems the original path was the  
best regardless. I shall return to that method.


thanks for the advice,

Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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


NSFileHandle or a better way?

2009-01-30 Thread Jaime Magiera

Hi folks,

I've been using NSFIleHandle for a project that inserts data into a  
file and synchs it back to disk. Everything went smoothly until the  
app started getting used for larger files ( > 200 megs). First, I ran  
into the NSFileHandle -> NSData 256 megs conundrum. That was solved  
by, as others suggested on this list in other threads, iterating with  
readDataOfLength or availableData  instead of a single  
readDataToEndOfFile. That worked well. I've got pools set up to keep  
the memory down. The problem now is that the reads are still really  
slow. For example, with a read length of 50 megs, I can only get in 3  
reads per second. My apps ends up taking almost a minute to perform  
all of its functions on a file of 500 megs.


Perhaps my overall approach was wrong to start out. What I've been  
doing is opening a file handle, copying the data after the insertion  
point to an NSData, truncating the file handle at the insertion point,  
adding the new data, then adding back the trimmed data. This works  
fairly well if the insert point is towards the end of the file.  
However, there are instances where I need to insert a few hundred kb  
into a the file at a location only a few hundred kb into the file.


xxx ^ x

The time hit comes from copying the trim data to the NSData. Is there  
a better way to do this with NSFileHandle?  Is there a better way to  
do this than NSFileHandle?


thanks for any thoughts,

Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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: NSOperationQueue

2008-09-13 Thread Jaime Magiera


On Sep 13, 2008, at 8:07 AM, John Love wrote:



// I also call this method from another Controller

- (void) stopCalculation {

   [self stopQueue];

}



For clarification: It crashes after you call stopCalculation? Does it  
crash if you let the entire calculation complete?


Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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: 9/11 was an INSIDE JOB!

2008-09-11 Thread Jaime Magiera


On Sep 11, 2008, at 10:55 AM, Jamie Daniel wrote:


This kind of


Relax man. Seriously. Every once in a while something slips through  
the cracks. Surely one silly email isn't enough to ruin your day.


Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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: Sending a GET or POST HTTP request with Cocoa

2008-08-31 Thread Jaime Magiera



 it's URL, set it's


"its"

Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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: Sending a GET or POST HTTP request with Cocoa

2008-08-31 Thread Jaime Magiera


On Aug 31, 2008, at 12:30 PM, Sam Schroeder wrote:


However, I've been unable to
find something simple that _just_ explains how to send a GET and
capture the returned results.  My google_fu is weak.  My ultimate goal
is to send and receive XML (or maybe JSON) requests over HTTP, but
first I want to understand simple GETs and POSTs.


Hello,

The easiest way for non-network programmers is probably  
NSMutableURLRequest. You simply instantiate an NSMutableURLRequest  
object, set it's URL, set it's HTTP method and away you go.


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableURLRequest_Class/Reference/Reference.html

- (void)setHTTPMethod:(NSString *)method

hope that helps,

Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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: accessing netinfo db from cocoa?

2008-08-31 Thread Jaime Magiera


On Aug 31, 2008, at 4:57 AM, Kieren Eaton wrote:


Hi,

I am trying to find a way to access the netinfo DB from cocoa.   
Specifically the sharing (AFP, SMB, etc).

Pointers or ideas are much appreciated.



Hello,

Quick question: Are you using Leopard or Tiger machines? On Tiger, you  
can run the commands "niultil" or "nicl" to query the NetInfo database  
from your application. Note that in Leopard, Netinfo has been  
completely deprecated in favor of a local LDAP database. So, if you  
are using Leopard, run the command "dscl" from your application. In  
either case, you'll have to parse the command results in your app.


On Tiger, the path you want to query is...

/config/SharePoints/

On Leopard, the path you want to query is...

 /Local/Default/SharePoints

hope that helps,

Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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 check the capital letter?

2008-08-11 Thread Jaime Magiera


On Aug 11, 2008, at 8:52 AM, Macarov Anatoli wrote:


HI!
Cocoa, Obj-C.


Hi,

You'll want to look into NSScanner and NSCharacterSet. The String  
Programming Guide should provide all you need...


http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/index.html

hope that helps,

Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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: Decoding digital POCSAG / analog 5-tone (=selective call) sounds

2008-07-26 Thread Jaime Magiera

On Jul 26, 2008, at 7:36 PM, Joeles Baker wrote:


Hi,

i wonder if anyone of you ever tried decoding POCSAG (http://en.wikipedia.org/wiki/POCSAG 
) sounds or 5-tone alarm sounds on the Mac.
POCSAG is used for public radio transmissions (digital firefighter  
alarming system etc) and private radio transmissions (pagers) as well.


Hello Joeless,

Yes, people have used Cocoa/MacOS X to decode analog phone and radio  
transmissions. In particular, 2600 hz ;) You can write a CoreAudio  
AudioUnit to accomplish this. In general audio parlance, you would use  
an FFT to determine the frequency of the sound. Then, account for rate  
(as in how many times it comes across the wire) to determine it's more  
specific meaning in the protocol (i.e. POCSAG, DTMF, etc.) The Mac OS  
X Audio API is called CoreAudio. Here are a few links to get you  
started...


http://developer.apple.com/audio/

http://developer.apple.com/documentation/MusicAudio/Conceptual/AudioUnitProgrammingGuide/

http://developer.apple.com/technotes/tn2007/tn2200.html

http://developer.apple.com/documentation/Performance/Reference/vDSP_2D_FFTransforms_Reference/vDSP_2D_FFTransforms_Reference.pdf
(dated but useful)

Also, if you want to go the non-Cocoa route, there is code in the  
Asterisk VoIP project that handle DTMF (essentially, what you need.  
You could learn from that...


http://www.asterisk.org

As you delve into this, it's probably best to move the thread to the  
CoreAudio-API mailing list.


hope that helps,

Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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: Stopping actions mid stream

2008-07-06 Thread Jaime Magiera


On Jul 6, 2008, at 3:04 AM, Jeff Brown wrote:

 The delegate method has some code that checks whether the radio  
buttons are allowed to be changed from 1 to 2 and if not, sends an  
alert to the user.
My problem is how can I stop the radio buttons themselves changing  
from 1 to 2. When programming in Visual Basic there was a method  
that stopped the action from completing. Is there something similar  
I can do here or some other way.



Hi,

I don't have an answer to your question, but an observation: Giving a  
user the option to click something, then telling them they cannot,  
seems kind of weird. Radio buttons are generally for options a user  
has. If the functionality denoted by an item is unavailable, generally  
it is hidden or at the very least inactive. In other words, using  
logic to determine availability of an interface item before it is  
clicked. Such a thing can be done with bindings.


anyway, good luck finding the answer to your question.

Jaime


Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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: Creating a NSView with Interface Builder

2008-02-25 Thread Jaime Magiera


On Feb 25, 2008, at 4:41 PM, Herr Thomas Bartelmess wrote:


Hello,
i'm currently working on a Plugin. My problem is that i have to  
provide a preference View. I have to give a NSView to the programm.  
Currently i wrote a NSView Subclass, but its to much work to do  
every button an textfield by code. My question is, how can I design  
an View in Interface Builder an give the result as an NSView to an  
other object.



Hi Thomas,

Yes, this is something popular to do. Here is what I've done for  
plugins...


- Create a window controller class in the plugin
- Create a IBOutlet that is connected to an NSView (in the plugin's NIB)
- During runtime, instantiate that window controller (when you  
instantiate the plugin) in the main app.
- From within the main app, query the the plugin's window controller  
for the IBOutlet NSView, and add it to the app's master view.
- If you are creating an app that has multiple plugins, you can simply  
remove the previous subview from the master view each time a different  
plugin is selected in the app.


hope that helps,

Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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]


which choice to implement iterations on separate threads

2008-02-25 Thread Jaime Magiera

Hello,

I'm trying to get a sense of what folks are doing for applications  
with individual threads for pulling samples at timed intervals,  
updating UI, etc. Looking over the docs, the options are NSTImer,  
NSThread and the new NSOperationQueue.


At a casual glance, NSOperationQueue doesn't have any scheduling.  
There are a couple ways to ostensibly add it. Not ideal though.  
NSTimer seems like a bad choice due to the dropping of an iteration if  
the previous isn't completed. Not good if the called method takes a  
little longer than expected (found this out the hard way).


This leads me in the direction of using an NSThread with either an  
NSTimer in it or utilizing a while() with the new sleepForTimeInterval  
or some other delay within.


Is this is a reasonable understanding of the situation for Cocoa? What  
are folks generally using for timed actions on separate threads?


Jaime Magiera

Sensory Research
http://www.sensoryresearch.net

___

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]