Re: Do Debug Apps Expire on iOS?

2016-07-22 Thread Michael David Crawford
Debug it some other way than with Xcode.  Possibly you have a serious
bug, but running under the debugger alters something so that the bug
isn't stimulated.
___

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: Prioritize my own app's disk access

2016-07-05 Thread Michael David Crawford
If it's a dedicated workstation, it should be OK to require a RAID 0.
That won't affect anyone's priority, but all disk I/O will be divided
among two or more disks.

Alternatively, dedicate a single drive only to video, with your other
drive being for everything else.
Michael David Crawford, Baritone
mdcrawf...@gmail.com

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Tue, Jul 5, 2016 at 10:20 AM, Quincey Morris
<quinceymor...@rivergatesoftware.com> wrote:
> On Jul 5, 2016, at 05:36 , Jonathan Taylor <jonathan.tay...@glasgow.ac.uk> 
> wrote:
>>
>> suggestions that might be relevant here
>
> What worries me about the Darwin-level (i.e. Unix-level) API suggestions that 
> others have made is that you don’t know how these interact with Cocoa apps. 
> You didn’t actually say whether your app is a Cocoa app, but if so …
>
> I think the best modern approach is to route your CPU and IO usage via GCD. 
> That is, from the point where some callback gives you raw video, use 
> dispatch_async to schedule the processing on a GCD queue, and use the GCD I/O 
> primitives to actually do the I/O.
>
> That will allow you to specify a quality of service (“user interactive” is 
> the highest), which should interact properly with other apps, e.g. the Finder 
> doing a large copy.
>
> That should take care of CPU and IO. For memory, I agree with Jens that you 
> should preallocate and reuse memory buffers, rather than re-allocating them, 
> as far as possible.
>
> ___
>
> 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/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: Simplest way to generate audio tones?

2016-06-03 Thread Michael David Crawford
I wrote BirthCry.cpp when I was just getting started on Ogg Frog.
It's still not released but one of my beta testers released it for me
at Github after I specifically asked him not to.

Next time I'll request an NDA.

This sends 441 kHz PCM directly to the audio card.  It doesn't use
QuickTime in any way.

You don't want to block on a mutex when you do that and run out of
samples; send it silence instead.  I did it that way at first but it
scared both my dogs and very nearly set my MacBook Pro on fire!

https://github.com/rushgorden/oggfrog/blob/master/Source/OggFrog_10-Dec-2006/oggfrog/BirthCry.cpp

Michael David Crawford, Baritone
mdcrawf...@gmail.com

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Sun, May 29, 2016 at 10:10 AM, Jens Alfke <j...@mooseyard.com> wrote:
>
>> On May 28, 2016, at 8:24 PM, Graham Cox <graham@bigpond.com> wrote:
>>
>> I’m looking for general pointers to the simplest/quickest way to generate an 
>> audio tone (sine wave) of a given frequency and duration. Most of the audio 
>> APIs seem concerned with playing samples rather than generating tones, so 
>> it’s not immediately obvious where to look.
>
> It’s easy to generate a sample buffer of a sine wave. Allocate an array of 
> uint16_t, and fill in each sample by scaling such that -1 ⟶ 0 and 1 ⟶ 255. 
> Then tell whatever API you’re using that it’s a 1-channel 16-bit PCM buffer. 
> Choose whatever sample rate you want to make it come out the right frequency; 
> it’ll do the interpolation for you.
>
> —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:
> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: Apple Bug no response

2016-03-09 Thread Michael David Crawford
I have a bug in Apple's sample code that would be a trivial fix, that
has been open for eight years.

By contrast I've reported a few kernel bugs.  Each was fixed in the
very next build.
___

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: [OT] Forums for Web Development?

2016-02-15 Thread Michael David Crawford
Soylent News, http://soylentnews.org/

Submit an "Ask Soylent News" story.  If you ask your questions
intelligently they'll run your story.  Many Soylentils are web app
coders.
Michael David Crawford, Baritone
mdcrawf...@gmail.com

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Mon, Feb 15, 2016 at 3:57 PM, David Delmonte <ddelmo...@mac.com> wrote:
> Have you tried StackOverflow? They have sister (brother?) forums, including 
> one for web masters. I think SO would be a good place to scout around.. The 
> second for me is YouTube/Vimeo. If you don’t minding learning from teenagers, 
> it can be quite helpful.
>
> David
>
> On Feb 15, 2016, at 6:43 PM, John Bartleson <jfbartle...@me.com> wrote:
>
> After getting many great tips from this list over the years, I find myself 
> needing to switch gears and do some web development. I'm starting on a 
> server-based app that will be the front end to a SQL database that may grow 
> to be very large. Although it's easy to find info on the basic technologies 
> to be used in such an app (PHP, Javascript, HTML, SQL, AJAX, etc.), there 
> seems to be little written about how to front-end a large multi-server 
> database.
>
> So I'm looking for a forum where I can ask noob questions about large website 
> development. Apple (understandably) doesn't appear to have a list for this. 
> Can anybody here point to info sources such as forums, books, websites, etc.? 
> TIA
> ___
>
> 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/ddelmonte%40mac.com
>
> This email sent to ddelmo...@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:
> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: mmap quiet failure - all reads are 0x00

2016-02-05 Thread Michael David Crawford
Perhaps it is a bug unrelated to mmap, that screws up some of your
state, then later it causes the mmap to fail.

Or perhaps the mmap succeeds, but the bytes your are reading are
coming from some other place.

There are many debugging techniques, such as using assertions, guard
malloc etc.  But don't just focus narrowly on the mmap itself.
Michael David Crawford, Baritone
mdcrawf...@gmail.com

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Fri, Feb 5, 2016 at 4:36 PM, Jens Alfke <j...@mooseyard.com> wrote:
>
>> On Feb 5, 2016, at 10:09 AM, Trygve Inda <cocoa...@xericdesign.com> wrote:
>>
>> It seems like no matter what is in the mmap file, when I read from it I get
>> 0x00 for every byte and no error or exception is generated. I can't
>> reproduce it as it is very random. Quitting and relaunching solves it.
>
> That sounds strange to me. I’m not an expert at mmap, but my understanding is 
> that if a page fault can’t be satisfied the memory access will fail with a 
> signal. You might ask on the darwin-userlevel list since this is really a 
> Unix-level question.
>
> —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:
> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: catching statuses of lights

2016-01-29 Thread Michael David Crawford
color filters might simplify the problem.  Also are the lights in a
fixed location?

Do you plan to let your iDevice do the driving? ;-D
Michael David Crawford, Baritone
mdcrawf...@gmail.com

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Fri, Jan 29, 2016 at 5:24 PM, Graham Cox <graham@bigpond.com> wrote:
>
>> On 30 Jan 2016, at 9:42 AM, Scott Berry <sb356...@gmail.com> wrote:
>>
>> Hello there,
>>
>> I have a project I am working on and I was wondering if anyone has had to 
>> catch a status of a light or set of lights.  For example, green safe, yellow 
>> caution, red stop.  Then I need to relay this to the program I am building 
>> so that it knows what the lights actually mean.
>
>
>
> Presumably the self-driving car folks have solved this one. If not, we’re in 
> trouble…
>
> —Graham
>
>
>
> ___
>
> 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/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: OpenGL Vertical Syncing effect on run loops

2015-09-23 Thread Michael David Crawford
My Warp Life implementation of Conway's Game of Life updates its model
- a square grid of bits - up to 8,000 times per second, but
invalidates the display with a display link.  It works really well and
results in a frame rate far faster than the refresh rate but with
smooth animation.

I was puzzled that my App was getting only one-tenth of the available
CPU.  This turned out to be due to my early code invalidating the
display every generation.  I operated the life generation update on a
separate thread but invalidated the display on the main - GUI -
thread.  Ninety percent of my CPU was devoted to back and forth
context switches that did no other work of any sort.

My current use of the display link resulted in a tenfold increase in
performance.
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Tue, Sep 22, 2015 at 7:51 PM, Greg Parker <gpar...@apple.com> wrote:
>
>> On Sep 22, 2015, at 6:56 PM, Jerry Krinock <je...@ieee.org> wrote:
>>
>> In Apple document QA1385, in Listing 2, describing how to drive OpenGL 
>> Rendering Loops 10 years ago, an NSTimer, repeating every 1 millisecond, is 
>> added to an app’s run loop [1].
>
> Just to be clear: don't do that. Use CVDisplayLink.
>
>
>> Referring to this timer, the text says that:
>>
>> "When vertical synchronization is enabled in your OpenGL application, during 
>> each retrace period, when the timer fires, …”
>>
>> H, a timer with time interval of 1 millisecond is now going to fire 
>> during each retrace period, 16.7 milliseconds or so!  This implies that when 
>> vertical synchronization is enabled in an OpenGL application, the 
>> application’s run loop, in all modes, is synchronized to the video frame and 
>> can go no faster.  Is this correct?
>
> It is not. The timer would fire multiple times per retrace if it were 
> unhindered. But at some point the timer callback will provoke an OpenGL 
> buffer swap, and that will block until the next retrace when vertical 
> synchronization is enabled. The gated buffer swap inside the timer callback 
> is the rate-limiting factor, not anything in the runloop or NSTimer itself.
>
>
> --
> Greg Parker gpar...@apple.com Runtime Wrangler
>
>
>
> ___
>
> 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/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: iOS 9 or Watch App

2015-09-21 Thread Michael David Crawford
For me, it works OK to put the Xcode app bundles in folders:

/Applications/Xcode_5/Xcode.app

/Applications/Xcode_6/Xcode.app

however you may only have one version of the command line tools
installed in /usr/bin and the like.
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Sun, Sep 20, 2015 at 8:35 PM, Quincey Morris
<quinceymor...@rivergatesoftware.com> wrote:
> On Sep 20, 2015, at 11:41 , Raglan T. Tiger <r...@crusaderrabbit.net> wrote:
>>
>> So, against my better judgement, I updated to Xcode 7.
>>
>> The installed version is 6.31, there ar no iOS9 or Watch SDKs.
>
> I don’t know what “6.31” means - maybe you mean 6.3.1? In which case you’re 
> running Xcode 6, not Xcode 7.
>
> There’s no “installed” for Xcode any more, in the sense of stuff copied into 
> a standardized system-wide location. Xcode 6 and Xcode 7 are just two 
> gigantic app bundles, each of which contains all and only the SDKs that are 
> allowed for that Xcode version. You can have both available simultaneously.
>
> So, if you want iOS 9 or watchOS, then you need to launch Xcode 7. If you’re 
> launching Xcode 6 by mistake, you’re going to have to figure out where it is, 
> and delete it if you don’t want it anymore. Or launch Xcode 7 by explicitly 
> double-clicking on its app bundle.
>
>
>
> ___
>
> 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/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: Is it possible to transfer data by using light

2015-09-18 Thread Michael David Crawford
Do iOS devices support Trusted Computing in hardware?  If so is it
accessible to userspace apps?

If so, you could store your phones secret in a write-only register.
For the profoundly paranoid, even the duplication of your storage
would not yield your phone's secret, The Bad Guy would need your
personal phone.

Modern Macs - to the best of my knowledge - provide trusted computing
chips, on can access them from userspace with a modest bit of code.
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Fri, Sep 18, 2015 at 3:12 AM, Maxthon Chan <m...@maxchan.info> wrote:
> The "over-the-shoulder" issue can be avoided using what is effectively a 
> Diffie-Hellman on top of QR codes. This can be done using front-facing 
> cameras on two devices placed face-to-face.
>
> Sent from my iPhone
>
>> On Sep 18, 2015, at 00:46, Pascal J. Bourguignon <p...@informatimago.com> 
>> wrote:
>>
>>
>>
>>> On 17/09/15 17:32, Michael David Crawford wrote:
>>> And what the man said: I myself experience seizures in which I lose
>>> consciousness for as long as three weeks.  Before they were diagnosed
>>> I would experience seizures while driving my car then suddenly find
>>> myself in unfamiliar places without any clue how I got there.
>>>
>>> I don't know for sure but strongly suspect that modern computer user
>>> interfaces caused my seizure disorder as well as that of my cousin.
>>> Seizures are not otherwise found among any of our blood relatives.
>>
>> But then if you don't use the whole screen, but only the area that
>> should be in front of the camera of the superposed phone, then users
>> shouldn't be subjected to much stroboscopic light.
>>
>> Having the objective so close from the light source does not allow
>> the camera to distinguish pixels; for example, a black to white
>> transition takes about 1/10 of the height of the camera view.
>> But this means that you might still able to transmit about ten pixels at 
>> once,
>> and you can multiply that by a number of color that you can detect reliably
>> being that out of focus. Basically, I would expect 8 colors to be clearly
>> distinguishable.  Actually, probably more colors should be distinguishable,
>> if you can filter out the interferences due to the grid of the camera vs.
>> the grid of the screen. So assume 4 bits for the color, and 9 areas,
>> that's 36 bit/moment, and you should be able to do 30 moment/second,
>> for a total of 1080 bit/second.  A little less for ECC, about 1 KB/s
>> is not too bad.  It's good enough to transmit a good private key, and then
>> transfer the data thru wifi.
>>
>>
>> Of course, if you move the camera out to focus on the screen, then
>> you can transmit at a higher speed things like QR codes, but they
>> could also be seen over the shoulder by high resolution cameras.
>>
>> --
>> __Pascal J. Bourguignon__
>> http://www.informatimago.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/max%40maxchan.info
>>
>> This email sent to m...@maxchan.info
>
> ___
>
> 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/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: Is it possible to transfer data by using light

2015-09-17 Thread Michael David Crawford
Strictly speaking, light is the most common way that data is
transferred, in that the forces between electrically charged particles
are moderated by virtual photons.  Other than light we have the
gravitational, strong nuclear and weak nuclear forces however it is
impractical to transmit much data by modulating gravity.

Look up the protocol standards for IrDA - Infrared Developer's
Association.  I don't think IrDA is in common use but at one time was
supported by Apple PowerBooks.  It enabled relatively private data
transfer between two boxen by transmitting and receiving infrared
light.  The source and sensor need not be pointed at each other as one
can bounce the beam off the walls or ceiling.

By contrast 802.11x wireless internet penetrates walls, unless
encrypted, James Bond could sit outside your house in a white van and
read your repository pushes.

A crude but simple way to transmit data from iOS devices would be to
write an app that displayed a plain black screen for zeroes and a
plain white screen for ones.  Blink the white screen on and off for
each ASCII 1 bit, black for 0 bits.

You will need error correction, but blinking ASCII will get you started.

And what the man said: I myself experience seizures in which I lose
consciousness for as long as three weeks.  Before they were diagnosed
I would experience seizures while driving my car then suddenly find
myself in unfamiliar places without any clue how I got there.

I don't know for sure but strongly suspect that modern computer user
interfaces caused my seizure disorder as well as that of my cousin.
Seizures are not otherwise found among any of our blood relatives.

Have A Nice Day.

Mike
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Thu, Sep 17, 2015 at 6:06 AM, Alex Zavatone <z...@mac.com> wrote:
> Yes.  How do you think TV remotes work?
>
> They use IR transmitters/receivers.
>
> They are, however, PAINFULLY SLOW.
>
> When we were making FiOS TV, we had to create an app called FiOS Mobile 
> Remote for the iPhone that would control your FiOS set top box.
>
> EVEN THOUGH the iPhone had to pipe its commands through a much much much 
> longer chain to get to the STB, it was a night and day in terms of 
> performance.  In fact, it was almost instant.
>
> Back then when we were prototyping FiOS I took an IR receiver and hooked it 
> up to a PC.  Then, using Director, we detected the signal that was being 
> broadcast and mapped each signal to the appropriate keypress.
>
> Then, we wrote a layer on top of that which created key events (press, 
> release, hold and repeat), and that allowed us to have a library which would 
> we could then use to issue commands based on the action being performed on 
> the remote.
>
> All being done by sending a signal over light.
>
>
> At another company, we turned data into QR codes and the QR codes became data 
> packets which we used to reimplement TCP/IP over a video capture transmission 
> method.  Our implementation was to have an iPhone in video capture mode and 
> flash a bunch of QR codes on another computer's screen.
>
> We then pulled each frame out of the video as it was captured, detected when 
> the image representing the QR code changes and rebuilt the data on the device 
> and decoded it.
>
> As I recall, we were testing driver's license detection software and used a 
> kitten as the photo in the license.
>
>
> So, yes, you can use light to transmit data.
>
>
>
>
> On Sep 16, 2015, at 11:14 PM, ico wrote:
>
>> First of all, please take a look at this video:
>> https://www.youtube.com/watch?v=LPyLHhiGTHM
>>
>> This toy can connect to the iphone's network by detecting the blinking
>> screen of an iPhone. I wonder if it is possible that using this technique
>> to transfer data.
>> For instance,
>> 1. you have some data, and transform it into a frequency of flash light
>> 2. you control iPhone A to blink its screen or its flashlight according to
>> this frequency
>> 3. you control iPhone B to detect this frequency of light
>> 4. you transform this message into some data which is the same as you have
>> in the 1st step
>>
>> Anyone can give a hint about achieving this?
>> Sorry for my bad English.
>>
>> 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:
>> https://lists.apple.com/mailman/options/coco

Re: Is it possible to transfer data by using light

2015-09-17 Thread Michael David Crawford
Flashing the entire screen as I describe should not be done in product
(App Store) code, rather one might use it as a very, very rough
prototype.

I expect production-quality software could modulate the screen is
far-more subtle ways that both would transmit data far faster as well
as avoid stimulating seizures.

For the most part it is sharp, sudden flashes as from the Xeon strobes
in emergency responder vehicle lights (ie. Squad Car Lights) that,
without a doubt, trigger my own seizures.  While I also suspect
computer animations, I am as yet uncertain.

Analog transmission by displaying shades of grey could transmit more
data while avoiding the stimulation of seizures.
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Thu, Sep 17, 2015 at 9:46 AM, Pascal J. Bourguignon
<p...@informatimago.com> wrote:
>
>
> On 17/09/15 17:32, Michael David Crawford wrote:
>>
>> And what the man said: I myself experience seizures in which I lose
>> consciousness for as long as three weeks.  Before they were diagnosed
>> I would experience seizures while driving my car then suddenly find
>> myself in unfamiliar places without any clue how I got there.
>>
>> I don't know for sure but strongly suspect that modern computer user
>> interfaces caused my seizure disorder as well as that of my cousin.
>> Seizures are not otherwise found among any of our blood relatives.
>
>
> But then if you don't use the whole screen, but only the area that
> should be in front of the camera of the superposed phone, then users
> shouldn't be subjected to much stroboscopic light.
>
> Having the objective so close from the light source does not allow
> the camera to distinguish pixels; for example, a black to white
> transition takes about 1/10 of the height of the camera view.
> But this means that you might still able to transmit about ten pixels at
> once,
> and you can multiply that by a number of color that you can detect reliably
> being that out of focus. Basically, I would expect 8 colors to be clearly
> distinguishable.  Actually, probably more colors should be distinguishable,
> if you can filter out the interferences due to the grid of the camera vs.
> the grid of the screen. So assume 4 bits for the color, and 9 areas,
> that's 36 bit/moment, and you should be able to do 30 moment/second,
> for a total of 1080 bit/second.  A little less for ECC, about 1 KB/s
> is not too bad.  It's good enough to transmit a good private key, and then
> transfer the data thru wifi.
>
>
> Of course, if you move the camera out to focus on the screen, then
> you can transmit at a higher speed things like QR codes, but they
> could also be seen over the shoulder by high resolution cameras.
>
> --
> __Pascal J. Bourguignon__
> http://www.informatimago.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/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@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: Progress Bar Gripe

2015-09-09 Thread Michael David Crawford
Someone mail me off-list to inquire as to why I was griping about
progress bars on Cocoa-Dev.

>> Because many Cocoa apps display the kinds of progress bars I gripe about.
>
> While that fact is true, it is unrelated to the purpose of the mailing list 
> as a technical resource, not a user experience design forum.

I expect my problem stems from the fact that few developers subscribe
to user experience fora; commonly graphic artists - art school
graduates do that.

Even so, I just purchase a Windows notebook computer from Acer.  I run
Linux Mint under VirtualBox, once I verify that it works OK when I
boot natively I will remove Windows.

My point is that I'd like to see my colleagues among the Apple
Developer Community, as well as my dear old friends who actually work
for Apple, prosper, rather than have their products abandoned by
people like me.

I've been an Apple Developer since 1986, I SQAed MacTCP 1.0.1 and 1.1
then write a new test tool and test plan for 1.2.  I was a Senior
Engineer in Apple's Traditional OS Integration Team in 1995 and 1996,
where I isolated the very-most serious bugs, I also optimized some of
the System 7.5.2 and 7.5.3 Resource Manager code.

 That the bug reports I file don't get fixed is what led me to abandon
the Apple platform for Linux.

I invite you to continue our friendly debate.

Mike
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.
___

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

Progress Bar Gripe

2015-09-08 Thread Michael David Crawford
This isn't specific to any one product nor publisher:

It is quite common that non-deterministic progress bars - "barber
poles" - are displayed when a deterministic process is taking place
such as the download of a file whose size is known ahead of time.

To the extent that deterministic progress bars are used, other than -
for the most part but not always - correct that they indicate that the
process has completed, they are largely incorrect throughout the
duration of the process.  That is, if I download one gigabyte, that
the progress bar is at ten percent doesn't have any particular
relation to anything that I can tell.

What I find most exasperating is that progress bars continue to, uh...
"progress" despite that the process clearly being hung; I expect
that's the result of running the bar in a different thread than the
process.

Back in the day it was common to litter one's code with "SpinCursor".
That wasn't a Toolbox Trap, rather it was a convention that most
developers followed.

But then some joker got the idea it would be cool to spin his cursor
from a VBLTask.  That quite commonly resulted in the entire Mac OS
being hung as the cursor continued to spin.

I know all manner of ways to avoid these problems, doubtlessly you do too.

Finally I will say that little details like this disproportionately
impact my purchasing decisions.  I am completely cool that your app
crashes once in a blue moon what I cannot tolerate is _constant_
aggravation.

Curmudgeonly Yours,

Mike
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.
___

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: Puzzling memory creep

2015-09-04 Thread Michael David Crawford
A memory pool will appear to be a leak however pools usually reach a
maximum size then stop growing.

Such a pool may be an internal implementation detail that is invisible
to your client code.

I don't know that your leak is really a pool however this is a common
false positive for leak detectors.
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Fri, Sep 4, 2015 at 9:13 AM,  <dangerwillrobinsondan...@gmail.com> wrote:
> So don't create a new for matter every time.
> Create one once outside of the timer.
> Formatters are heavy.
> Beyond that you might try judicious use of @autorelease{}
>
> Sent from my iPhone
>
>> On Aug 15, 2015, at 5:29 AM, Richard Kennaway <rich...@kennaway.org.uk> 
>> wrote:
>>
>> I've written an iOS app that, according to Instruments, seems to very slowly 
>> allocate more and more memory over time, although I can see no reason for 
>> it.  After starting it, and letting it settle down, I see in the Allocations 
>> tool several entries in the "#Persistent" column creeping upwards.  
>> Typically, I see an item "CFArray (mutable-variable)" incrementing its 
>> #Persistent once a second, and an item "Malloc 32 Bytes" incrementing by 2 
>> every second.  The Leaks tool shows nothing.  Taking Generation snapshots at 
>> intervals of a second or two shows the steady accumulation of small 
>> allocations, described as .
>>
>> I'm using XCode 6.4 and running this in the simulator for iPhone 6 and iOS 
>> 8.4.  I've also tried the iPad2 and iOS 8.4 with similar results, although 
>> there the item that ticks up and up is "Malloc 64 bytes", at a rate of about 
>> 1 KB every 5 seconds.  The project is compiled with ARC turned on.  The high 
>> water mark of total memory use displayed in XCode increases by a megabyte in 
>> something over an hour and an overnight run shows no sign of it stopping.
>>
>> But I cannot see what is causing this.  It's a very small app, and if I let 
>> it run without interacting with it, the only code it executes is the 
>> following method of the single view controller, invoked by an NSTimer once a 
>> second to update a display of the time.
>>
>> - (void)updateTime {
>>NSDate *now = [NSDate date];
>>double seconds = [now timeIntervalSinceReferenceDate];
>>double intseconds = round(seconds);
>>now = [NSDate dateWithTimeIntervalSinceReferenceDate:intseconds];
>>
>>[dateFormatter setDateFormat:
>>[NSDateFormatter dateFormatFromTemplate:@"jjmmss" options: 0 locale: 
>> thelocale]];
>>[[self timestring] setText: [dateFormatter stringFromDate: now]];
>>
>>[dateFormatter setDateFormat:
>>[NSDateFormatter dateFormatFromTemplate:@"EEEdMMM" options: 0 locale: 
>> thelocale]];
>>[[self daystring] setText: [dateFormatter stringFromDate: now]];
>>
>>[dateFormatter setDateFormat:
>>[NSDateFormatter dateFormatFromTemplate:@"" options: 0 locale: 
>> thelocale]];
>>[[self yearstring] setText: [dateFormatter stringFromDate: now]];
>> }
>>
>> timestring, daystring, and yearstring are properties of my ViewController 
>> class connected to labels in the storyboard:
>>
>> @property (weak, nonatomic) IBOutlet UILabel *timestring;
>> @property (weak, nonatomic) IBOutlet UILabel *daystring;
>> @property (weak, nonatomic) IBOutlet UILabel *yearstring;
>>
>> dateFormatter and thelocale are private instance variables, initialised once 
>> in viewDidLoad().   I've also tried versions where these are variables local 
>> to updateTime(), and where "now" is an instance variable, but moving these 
>> around gives the same results.  I've also tried, with equal lack of effect, 
>> splitting up some of the one-liners into things like:
>>
>>NSString *thestring = [dateFormatter stringFromDate: now];
>>[[self timestring] setText: thestring];
>>
>> When the app is in the background it does nothing (it invalidates the 
>> NSTimer and sets the instance variable holding it to NULL), and Allocations 
>> reports no activity.
>>
>> What is causing this problem?  Instruments says the Responsible Library is 
>> libdispatch.dylib, and the Responsible Caller is 
>> _dispatch_continuation_alloc_from_heap.  The names suggest that this may be 
>> nothing to do with the code above.  Google turns up a small number of 
>> querie

Re: How to terminate an NSTask whenever my app terminates?

2015-08-31 Thread Michael David Crawford
On the UNIX command line "nohup" prevents children from being killed when
the parent exits.  If you want to manually start a daemon:

   $ nohup mydaemon &

Then you can log out and it keeps running.


-- 
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To
Light.
___

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: Crash help?

2015-08-20 Thread Michael David Crawford
Assert the validity of all your method parameters.  While it can help to
assert return results thats less helpful as most return results are later
used as input parameters:

#import assert.h

- (void) foo( int *p, int n )
{
 assert( NULL != p  n  0  n  10 );
...
return;
}

This might not have found the crash we're discussing but it will find many
others by the time you ship.  Also assertions are more effective than
comments for documenting APIs because one is forced to maintain them along
with the rest of the code.

- Mike



-- 
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To
Light.
___

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: Completely baffled by NSTabViewController + Autolayout

2015-08-17 Thread Michael David Crawford
 I am missing something big, because I am having nothing but insane trouble
 when trying to get a simple tab view working with autolayout. Every path I 
 head down
 has strange problems. I've tried slimming it down to the smallest test 
 project and
 I'm still confused.

That's because you're not using the...

ZooLib C++ Cross-Platform Application Framework:
http://www.zoolib.org/

The ZooLib Cookbook
http://zoolib.soggywizard.com/doc/cookbook/

ZooLib will also make your iOS and Mac OS X apps readily portable to
many of the operating system offerings of Apple's friendly
competitors.

(Soggy Wizard is a brand-new domain however I expect to start my web
server by tomorrow afternoon or so.)

Have A Nice Day.

Michael David Crawford P.E., Consulting Process Architect
http://mike.soggywizards.com/
mdcrawf...@gmail.com

   One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.

PS: I've been bleeding in six colors since 1986.


On 8/17/15, Seth Willits sli...@araelium.com wrote:
 I am missing something big, because I am having nothing but insane trouble
 when trying to get a simple tab view working with autolayout. Every path I
 head down has strange problems. I've tried slimming it down to the smallest
 test project and I'm still confused.

 The problems I'm seeing are randomly positioned views and inconsistent
 sizing:
 http://www.sethwillits.com/temp/TabViewResizing1.mp4

 Here's the project:
 http://www.sethwillits.com/temp/TabViewResizing.zip


 The goal of this project as is, is simple: using an NSTabViewController, add
 multiple tab view items where each of the items has a view with its own
 autolayout-determined fixed size (as in, either an intrinsic content size,
 or the constraints of the subviews dictate the size of the view itself.)
 **That's it.** And I've been struggling with this for hours.

 In the test project I have two tabs. Each has an NSView subclass that has an
 intrinsic size so that the view itself must always be at that size. Those
 views are then added to the tabview via tab view items. I expect that the
 layout system will resize the views to be at their intrinsic size, and
 position them properly within the tab view.

 Instead I'm seeing them a) not always be at their intrinsic size, and b) if
 the tab switches in the middle of animating, then it stops at some
 interrupted size.


 Can anyone explain this?



 Bonus question:
 How am I supposed to get a normal bordered tab view with tabs on top using
 an NSTabViewController? Using
 NSTabViewControllerTabStyleSegmentedControlOnTop shows the segmented
 control, but there's no border? Using NSTabViewControllerTabStyleUnspecified
 + tabView.tabViewType = NSTopTabsBezelBorder; is as close as I can get, but
 then the tab view item's view placement is wrong?



 --
 Seth Willits




 ___

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

 This email sent to mdcrawf...@gmail.com


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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

Request iOS setting to disable ALL UI animation.

2015-08-11 Thread Michael David Crawford
rdar://22243459

Radar's Javascript prevents me from selecting the text of my bug report on
my iPad.

tl;dr:  Despite that seizures do not run in either sides of our respective
families, my cousind and I both experience quite severe brain seizures.

I went to Emergency last monday evening when my seizures grew violent.  The
last time that happened I had one of those beckoning dead relatives
experiences in a surgical theatre because I hit my head on a concrete floor.

I dont know why he and I experience seizures but I do know that a week in
hospital enables me to use my ipad without nausea.  I expect that nausea to
return but by then I expect to earn the coin required for a new MacBook Pro.

My request could be implemented by disabling screen refresh during Core
Animation.  After animation is complete, invalidate the entire screen.

Thine In Eternal Torment,

El Ingenioso Hidalgo Don Miguel de la Chula Vista
http://www.warplife.com/mdc/
mdcrawf...@gmail.com

53n7 fr0m my 1P4d.



-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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: Regarding these Olivia messages. Can we do something about the list security?

2015-07-31 Thread Michael David Crawford
Blue-Eyed Cass promised me what every man desired but few can obtain
mere hours after we friended each other on Facebook.

I live with my mother in Ghana.

I expect her really does, but the real tragedy of Blue-Eyed Cass is
not that she depletes lonely men of all they possess, but that she
does not really return our affection.

-- Mike

On 7/31/15, Graham Cox graham@bigpond.com wrote:

 On 30 Jul 2015, at 11:45 pm, Shane Stanley sstan...@myriad-com.com.au
 wrote:

 Olivia seems to get around.


 Maybe we should give her the benefit of the doubt. I sent her my credit card
 details and now she’s promised she’s going to come and visit once she’s
 sorted out the flights. You’ll all be sorry when I’m going out with my new
 sexy girlfriend! Ha!

 —Graham



 ___

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

 This email sent to mdcrawf...@gmail.com


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.

___

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: Regarding these Olivia messages. Can we do something about the list security?

2015-07-30 Thread Michael David Crawford
Chris,

Your old homey Mike suggests that cocoa-dev could use a little TLC.

Mike

On Thursday, July 30, 2015, Michael David Crawford mdcrawf...@gmail.com
wrote:

 Internet Crime Complaint Center

http://www.ic3.gov/complaint/default.aspx

 The CERT Division

 http://www.cert.org/

 Forum on Risks to the Public in Computers and Related Systems

  http://catless.ncl.ac.uk/

 I once used one-time emails to great effect.  Unfortunately my hosting
 service configured my mail to accept any username, commonly but incorrectly
 known as a postmaster account.   I once received 400 MB of spam per day!

 I strongly recommend one-time emails but dont make them obvious.  Use
 common given names, but not your own name.  Onfigure your mail server to
 accept each one you actually use.  When the spam gets you down, unsubscribe
 from the list, configure a new one-time email, resubscribe.  Keep the
 now-unused mail user for a while but mark everything as spam.  When you
 grow weary of doing so delete the username.

 Gmail does work but it is impolite to draw so heavily on a free as in beer
 resource.  If you like Gmail, Google offers a paid service that will
 mailhost your own domain.

 Javascript email obfuscation is effective because the bots dont even try
 to crack it:

 http://www.warplife.com/moat/alligators.js

 For extra credit, design your own custom software.

 If you desire only the very best:

 Set up an apparently legitimate site with some innocuous content that
 appears to belong to a real business.  Provide a sitemap:

http://www.sitemaps.org/

 Put your sitemap's URL in your robots.txt:

   http://www.robotstxt.org/robotstxt.html

 supply a permissive one:

 User-agent: *
 Disallow:

 Sitemap: http://www.example.com/urllist.txt.gz

 ... or...

 Sitemap-index: http://www.example.com/sitemap-index.xml.gz

 ... the sitemap index points to urllist.txt.gz but contains a timestamp
 that reduces everyone's load.

 Plaster that site with lots of apparently-legitimate email addies.

 Submit your homepage URL:

 Painless Search Engine Site Submission
 http://www.warplife.com/tips/webmaster/site-submission.html

 ... wait until the spam gets REALLY out of control then install a
 Teergrube:

http://www.catb.org/jargon/html/T/teergrube.html

https://en.m.wikipedia.org/wiki/Tarpit_(networking)

 Onw simple way is that when a spammer tries to deliver mail to your smtp
 server you start to cooperate but then pause until just before the timeout,
 then issue a continuation character:

-

 .. then pause again.

 But do _eventually_ accept the mail, that way the spammer wont receive a
 bounce.

 A few hours after each spam arrives, use cURL or wget to fetch each of its
 images.  That's how spammers know that you like to read spam.  Also click
 some of their links.

 The Coup d' Gras is to drop this domain's emails into a bunch of
 newsletter subscription forms.

 I'll Send You My Bill In The Mail.

 Mike
 mdcrawf...@gmail.com
 javascript:_e(%7B%7D,'cvml','mdcrawf...@gmail.com');



 --
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 javascript:_e(%7B%7D,'cvml','mdcrawf...@gmail.com');
 http://www.warplife.com/mdc/

 Every Deity Hath the Insight to Foretell the Future
 Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.



-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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: Regarding these Olivia messages. Can we do something about the list security?

2015-07-30 Thread Michael David Crawford
Internet Crime Complaint Center

   http://www.ic3.gov/complaint/default.aspx

The CERT Division

http://www.cert.org/

Forum on Risks to the Public in Computers and Related Systems

 http://catless.ncl.ac.uk/

I once used one-time emails to great effect.  Unfortunately my hosting
service configured my mail to accept any username, commonly but incorrectly
known as a postmaster account.   I once received 400 MB of spam per day!

I strongly recommend one-time emails but dont make them obvious.  Use
common given names, but not your own name.  Onfigure your mail server to
accept each one you actually use.  When the spam gets you down, unsubscribe
from the list, configure a new one-time email, resubscribe.  Keep the
now-unused mail user for a while but mark everything as spam.  When you
grow weary of doing so delete the username.

Gmail does work but it is impolite to draw so heavily on a free as in beer
resource.  If you like Gmail, Google offers a paid service that will
mailhost your own domain.

Javascript email obfuscation is effective because the bots dont even try to
crack it:

http://www.warplife.com/moat/alligators.js

For extra credit, design your own custom software.

If you desire only the very best:

Set up an apparently legitimate site with some innocuous content that
appears to belong to a real business.  Provide a sitemap:

   http://www.sitemaps.org/

Put your sitemap's URL in your robots.txt:

  http://www.robotstxt.org/robotstxt.html

supply a permissive one:

User-agent: *
Disallow:

Sitemap: http://www.example.com/urllist.txt.gz

... or...

Sitemap-index: http://www.example.com/sitemap-index.xml.gz

... the sitemap index points to urllist.txt.gz but contains a timestamp
that reduces everyone's load.

Plaster that site with lots of apparently-legitimate email addies.

Submit your homepage URL:

Painless Search Engine Site Submission
http://www.warplife.com/tips/webmaster/site-submission.html

... wait until the spam gets REALLY out of control then install a Teergrube:

   http://www.catb.org/jargon/html/T/teergrube.html

   https://en.m.wikipedia.org/wiki/Tarpit_(networking)

Onw simple way is that when a spammer tries to deliver mail to your smtp
server you start to cooperate but then pause until just before the timeout,
then issue a continuation character:

   -

.. then pause again.

But do _eventually_ accept the mail, that way the spammer wont receive a
bounce.

A few hours after each spam arrives, use cURL or wget to fetch each of its
images.  That's how spammers know that you like to read spam.  Also click
some of their links.

The Coup d' Gras is to drop this domain's emails into a bunch of
newsletter subscription forms.

I'll Send You My Bill In The Mail.

Mike
mdcrawf...@gmail.com



-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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: Cocoa Error Domain code symbols in Swift

2015-07-24 Thread Michael David Crawford
There is a market opportunity for a service that indexes software tips by
software version.

This because when I google for

   Xcode 6 NSInfiniteLoop

... I mostly get hits for the NSInfiniteLoop from XCode 4.

I often think of doing this myself but I have too many ideas, even when
they are good ones.


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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: MODERATOR: End of Thread (was Re: I am reluctant to file any more bugs until those already reported are fixed)

2015-07-21 Thread Michael David Crawford
My post is technical.

My concern is that new bugs are created faster than old ones are fixed,
also that many of those who experience defects do not understand that they
are defects.  For example it is very common for users to regard crashes and
data loss as their own fault, because they arent doing something right.

Pick out a few software products at random them look up their reviews, then
if you can sort them by Most Critical first.  One can do this at the App
Store as well as many other eCommerce sites.  I do this from time to time;
this leads to my reluctance to install any software I do not absolutely
require, even if it is free.

I raise this concern in other venues than Apple's lists as well.  It is a
widespread problem that our profession must address.  While I could name
many specific examples of software and hardware faults that cause grievous
damage I want to avoid doing so for the specific reason that I do not want
my constructive criticism to be regarded as a personal attack.

Ever Faithful,

Mike

On Tuesday, July 21, 2015, Chris Hanson chan...@apple.com wrote:

 This is the place for neither rants nor personal attacks.

 Please keep it technical. Thanks.

   -- Chris Hanson (cocoa-dev co-moderator)

 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com javascript:;)

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

 This email sent to mdcrawf...@gmail.com javascript:;



-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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: C Sharp?

2015-07-16 Thread Michael David Crawford
This is done in two different ways for java and pascal.  In principle
either would work for C# but I do not know of any actual implementations.
One could add C# to clang or some other front end to buil native code as
does the gcj ahead of time java compiler.  You will still need to link to
a runtime but you wont need an interpreter.

p2c translates pascal source to C source that may not be pretty but can be
built.  However pascal and C are conceptually quite similar so the
translation is straightforward.

Maybe it would be easiest to translate the C# to java then generate native
code with gcj.

This would be too much work for just one use but could be a market
opportunity.  Knock yourself out.



-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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

I am reluctant to file any more bugs until those already reported are fixed

2015-07-15 Thread Michael David Crawford
 doesn't really work.

The problems I see with poor quality - not just in software but
hardware as well - are not specific to any one codebase.  It is
widespread in Free Software, Open Source and proprietary software.

For years I have worked diligently to advise others of ways they can
fix their code, as well as why they should do so.  My articles, essays
as well as mailing list and message board posts are quite popular but
also controversial in that there are many who do not welcome my
message of quality.

Quite a serious problem is that some of these faults are in systems
used by law enforcement.  For example some clever fellow escaped from
prison by sending an email to an employee at his prison.  Again I
don't recall all the details but would be happy to dig them up.

Similarly innocent people go to jail or even prison because of software faults.

My jocular outlook on life frequently leads to my own arrest.  Not the
last time I was in the slammer but the time just before that, I was
promptly ordered released on my own recognizance - that is, without
bail.  Even so I was detained for five more months before my case was
completely dismissed.  I think the world of the Clark County,
Washington Sheriff's Deputies but they were unwilling to release me
until they received my release order themselves, which somehow got
dropped on the floor.

No doubt you've seen Terry Gilliam's Brazil.  That's happening in
real life this days and with increasing frequency and severity.

I could detail the problems I experience but there are so many.  It's
not just me; consider that Mozilla stored its email in a proprietary,
compressed database.  I lost my email database when my filesystem
filled up.  I did report the bug at http://bugzilla.mozilla.org/ but
when I did so I found many other reports as well as gnashing of teeth
because that bug had been reported years before but not fixed.

While the Mozilla developers - not just the Mozilla corporation but
its unpaid volunteers - are among the more-egregious offenders there
are many others.

Other problems are the introduction of features that I and others
regard as bug, and the deprecation of features that I and others
depend on for our livelihoods.

I am well aware of the Free Software community's opposition to Apple's
proprietary code, vendor lock-in and other evildoing but at least at
one time, Apple Computer produced very high-quality products.

But no more, and not for a long time.

I discuss this in:

   Apple's Deep Insight Into User Interface Design
   http://www.warplife.com/mdc/essays/jump-the-shark.html

The bug I found in 2012 was trivial to reproduce, however the steps to
reproduce it are quite obscure.  While I could help Apple fix just
that one bug by filing a report at http://bugreport.apple.com/ what I
really want is for Apple to clamp down on all the hookers and blow
that are readily available within Infinite Loop.

Again: these are widespread problems.  I find examples almost
everywhere I look.  Free Software is no exception.

However:

My satirical writing and my harsh, confrontive criticism in meatspace
aren't doing the job.  Recently I attempt gentle diplomacy.  To some
extent that seems to help, but I'm just one person.

Can you help in any way, or recommend something or someone else who can?

Ever Faithful,

Mike
-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: I am reluctant to file any more bugs until those already reported are fixed

2015-07-15 Thread Michael David Crawford
On 7/15/15, dangerwillrobinsondan...@gmail.com
dangerwillrobinsondan...@gmail.com wrote:
 Yet in the time you spent wasting keystrokes on this thread, you both could
 easily have filed bugs.

In the time I could have wasted by filing bugs, I actually did write:

   I State This That It May Be Rejected:
   The Lysistrata Manifesto
   http://www.warplife.com/manifestos/lysistrata.html

Among my several points is that new bugs are created far, far faster
than old bugs are fixed.  I no longer regard it as a productive use of
anyone's time - not just my own - to file new reports.

Rather, my objective is to halt the production of new features until
old bugs are closed.  That's not a goal I can achieve all by myself; I
initiated this thread and wrote the above essay in hopes that others
will join me by boycotting all the bugbases.

Not just Radar - Bugzilla and all the rest.

I am quite diligent with my bug reports; many of my minimal test cases
are trivial to reproduce.  When I was a Debug Meister at Apple I wrote
something like the following:

  tell Finder restart

... dropped it in the Startup Items folder then manually rebooted.

Once per day over the next month or so I found the box had dropped
into MacsBug, eventually to isolate it to the Open Transport Ethernet
driver.  That driver's engineer found and fixed an edge case in its
shutdown proc.

My persistence yielded a Gold Star on my performance review.

It is not at all that I am lazy.  I work like a demon.

It is not at all that I don't care about our professional colleagues.

It is not at all that I am unconcerned for our users.

It is because I regard halting the introduction of new features so we
can fix the bugs we already know about as the best way to improve the
quality of our existing products.

I reiterate: this problem is not unique to Apple, nor to the computer industry.

Here in Clark County Washington there is quite a lot of political
corruption.  I know how to deal with that too but elected officials
who are on the take don't like to read my Walls of Text so I'm going
to speak at County Council meetings, register voters, make Get Out The
Vote phone calls and transcribe hardcopy campaign finance disclosure
statements onto the Web.

Thanks for letting me clear all that up.

Mike
-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

Every Deity Hath the Insight to Foretell the Future
Yet G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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: I am reluctant to file any more bugs until those already reported are fixed

2015-07-15 Thread Michael David Crawford
On 7/15/15, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 Take it to Reddit and leave us alone.

Thanks for setting me straight.  I didn't realize that Apple's
engineers hang out at Reddit.

Mike
-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Translate curl command to NSURLRequest

2015-07-04 Thread Michael David Crawford
Would it work to use libcurl instead?

I dont know but would be unsurprised were that to be what NSURLRequest
actually does.


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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

Would you pay for a better table view?

2015-06-30 Thread Michael David Crawford
My own app would benefit from a better table view were I to write one from
scratch.

Cocoa Touch's table view works for simple things but it is painful for
anything fancy.

Were I to write a better table view, would any of you fine folks be into
licensing it for your own apps?

I once made what appeared to be a Mac OS List Manager list work with three
billion items.

Mike


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Cheating a synchronous call on the main thread

2015-06-29 Thread Michael David Crawford
Use a background task to do the real work then deliver the result on a
queue. mUseba synchronous call to fetch the result from the queue or return
an error result if the queue is empty.

-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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

Why do so many iOS apps have such poor quality?

2015-06-23 Thread Michael David Crawford
Apple's written policy is that crashy apps are not permitted in the
app store.  Why is this not enforcd?

Pick a few apps at random.  Sort the reviews by Most Critical.
Quite common are complaints about crashing.

it is better not to ship a product at all than to ship a product that
drives away customers.

I once worked on a defense contract.  the primary contractor chose the
part by looking at vendor product literature, then selected me to
write the firmware based on my expertise with that part.  despite that
i could not work around a hardware mask bug they made a bunch of very
expensive prototype boards then distributed them to The Client with
the expectation that i would deliver the firmware later.

After six weeks of fruitless struggle i bluntly told them they had
selected the wrong part and would have to redesign their circuit
board.nnquite likely they lost the contract.

How hard can it be to add assertions to your source?
-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Scary Stuff!

2015-06-17 Thread Michael David Crawford
I was a Debug Meister for Apple in the mid-90s.  It was fascinating
work but I applied for an internal transfer because I had the sense
that my work would never be finished.

That is, we will never run out of bugs.  It gets me down sometimes.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, Jun 17, 2015 at 1:17 PM, Doug Hill cocoa...@breaqz.com wrote:
 This is indeed some scary stuff. The problem with apps creating a local web 
 server for Web Socket support also seems particularly worrisome. I second 
 Jens’ suggestion to read the paper because it will cause eyes to bug out.

 For most of the security problems, you could rewrite your app to opt-out of 
 the insecure APIs, system services, etc. and use your own implementation. 
 (see Google Chrome not storing passwords in the Keychain anymore) This is 
 obviously it’s own set of security issues. Do you want to implement your own 
 secure password store and ensure you don’t introduce other security holes? 
 Good luck with that.

 The one feature that I don’t know anyway to opt-out yet still keep 
 functionality is the custom URL scheme registration on iOS. This gets used 
 for IPC to open files in another app. Any app could register the same custom 
 URL scheme for another app without the knowledge of the user or the original 
 app. Users would Open In one of their files, thinking it will go to the 
 original app, which gets hijacked by the malicious app. I don’t know if 
 there’s even a way to know if another app has hijacked your scheme. Think 
 about opening files with confidential/financial data and they suddenly get 
 sent to a malicious app.

 I’m looking forward to fixes and/or workarounds soon.

 Doug Hill

 On Jun 17, 2015, at 12:44 PM, Jens Alfke j...@mooseyard.com wrote:

 As usual, don’t put too much weight into the bite-size digests from the 
 press, especially the Register, which has a track record of sensationalism. 
 Unfortunately the actual truth is fairly bad. I recommend reading the paper:

 https://drive.google.com/file/d/0BxxXk1d3yyuZOFlsdkNMSGswSGs/view 
 https://drive.google.com/file/d/0BxxXk1d3yyuZOFlsdkNMSGswSGs/view

 Haven’t gotten all the way through it, but the security problems in the OS 
 seem to be not about the fundamentals — the integrity of sandboxes and the 
 Keychain are OK — but some slipshod security at the API level and in the 
 ways these components get used. The two OS X attacks I’ve read about are:

 1. Keychain ACLs control which apps are allowed to read which Keychain 
 secrets. But it’s possible for a malicious app to create a blank Keychain 
 password item for a secret it knows some other app will store there (like a 
 login password), and give both itself and the real app access. Then the true 
 app will store the secret in the existing Keychain item, which is readable 
 by the malware so it can get the password from it.

 2. Sandboxed apps are given private directories named after their bundle 
 IDs. The Mac App Store submission process verifies that an app’s bundle ID 
 is a valid one that’s registered to the developer … but it doesn’t verify 
 the bundle IDs of embedded executables like plugins, which get their own 
 sandboxes. So a malicious app can include a plugin with the bundle ID 
 registered to a real app, and its plugin will be able to share the sandbox 
 with the real app and read/write its data.

 (I may have gotten details wrong. Don’t quote me on this, read the paper 
 yourself.)

 Both of these are pretty bad. I’m very disappointed that Apple didn’t 
 address these during the six months’ advance notice that the security 
 researchers gave before they went public.

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

 This email sent to mdcrawf...@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

Most People Still Use Dialup

2015-06-16 Thread Michael David Crawford
Where I live I can only get dialup; to download anything these days I
have to go to a wifi spot.

Just now I'm downloading the 1 GB Epson Printer Drivers from Apple's
downloads page; despite being the only customer in the place, Firefox
estimates the download will require 18 hours.

I have a Facebook friend who lives in West Africa.  He has decent
connectivity but only from a cybercafe.  He has no way to save his own
documents because no one sells flash drives there.

There are many places in the world where one can get online with a
smartphone but again have no way to save any documents they download.

When I was the Product Development Manager for Working Software I kept
twelve people employed despite that I only had a 40 MB hard drive.

Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Most People Still Use Dialup

2015-06-16 Thread Michael David Crawford
Northern China has to talk to Southern China via Japan.  This because
some party official gave his son the gift of what at one time was the
northern part of the state telecommunications monopoly.

On 6/16/15, Michael David Crawford mdcrawf...@gmail.com wrote:
 I was finally able to download that 1 GB printer driver assortment,
 but only by wandering around trying different wifi spots.

 I knew that I could have downloaded just a 24 MB driver for my
 specific printer but that would have come at the cost of bringing that
 printer with me to a wifi spot so OS X would see that it was connected
 via USB.  If OS X can choose my driver because it identifies itself,
 why can't I just tell OS X myself?

 Or Epson; Epson's driver download page specifically says to plug the
 printer in then let OS X take care of it.

 Some wifi spots have a lot of capacity but rate-limit individual clients.

 In the case of my dialup I would be able to download that 24 MB driver
 but there is some problem somewhere out on the Internet backbone.  I
 don't really know but speculate that it has to do with the routers all
 being optimized to server Facebook to cable modem users.

 I used dialup from rural Maine from 2001 to 2003 and it worked just
 fine; it even worked OK to set up IP masquerading so my ex and I could
 share the dialup service.

 If I traceroute from here in Salmon Creek, Washington to my server at
 Hurricane Electric in Fremont, California it goes through dozens of
 routers, many of which are clearly in the same data center.  That is,
 I'll go through ten or twenty routers at Level 3 in Seattle, then
 another ten or twenty in Fremont.

 When I start my day I flush the tubes with the following:

$ sudo ping -c 100 -f apple.com
$ sudo ping -c 100 -f berkeley.edu
$ sudo ping -c 100 -f www.vatican.va

 By tracerouting before and after that flushing, I can see that my
 packets traverse far fewer routers.
 --
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 http://www.warplife.com/mdc/

Available for Software Development in the Portland, Oregon Metropolitan
 Area.



-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Goodbye and Thanks for All The Code

2015-06-16 Thread Michael David Crawford
I wrote:

 while the legal
 rights of the mentally ill are well-established in legislation as well
 as court precedent, those rights are not only not enforced, they are
 largely unknown.

One way I determine whether psychiatric hospital staff are aware of
the rights on mental inpatients is by fighting tooth-and-nail when I
am requested to wear a hospital gown.  While I don't like them it's
not that I won't wear them however my objective is to educate the
hospital staff.

In California specifically this is provided for under the
Lanterman-Petris-Short Act.

In the emergency room at Stanford Medical Center:

I have the right to wear my own clothes.  I want my suit back.

Sir you are on an involuntary hold.  If you don't calm down, we have
the right to sedate you.

That's _completely_ cool but when you do I want to be wearing my damn suit.

In reality my concern is not for myself but for those who are too far
gone to even know that they have rights.  I once had a close friend
who was completely cool that a toxic rain was falling from the sky.
She wore a rain hat indoors and would cover her head with a newspaper
while outside.

Look up at the sky.

Hesitantly, she does.

Do you see that it's blue?  That there are no clouds?  Do you feel
the warm sun?

Oh yes!  It's very nice.

But when she looks down, she experiences the continued chemical weapon attack.

While some mental illnesses are chronic, I have the good fortune that
my Bipolar-Type Schizoaffective Disorder - somewhat like being
manic-depressive and schizophrenic at the same time - is episodic, in
that the symptoms come and go.

I used to worry quite a lot about my professional reputation but
decided to go completely public with my illness as a result of the
Heaven's Gate UFO Cult mass suicide in San Diego during the Spring of
1997.  My reason was that I wanted to warn the public that reality is
not as concrete as it may seem.  I discuss this in The Reality
Construction Kit:

http://www.warplife.com/mdc/books/schizoaffective-disorder/reality.html

My interest in cult phenomena commenced during the rise of Communism
in Cambodia in the early seventies when I read at first that Cambodian
children were taught to report their parents to the authorities,
shortly after which I learned that everyone in the entire country who
wore eyeglasses disappeared virtually overnight.

Computers are cool and all that, I really _do_ enjoy writing code but
some things are really more important than how many mice one's app
scores in a trade rag product review.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Mon, Jun 15, 2015 at 8:23 PM, Michael David Crawford
mdcrawf...@gmail.com wrote:
 I've been out of work for most of the last five years.  Many
 well-meaning yet sadly misinformed people give me what doubtlessly
 would be good advice for others, for example that I should go on
 disability, get into subsidized housing or to stop linking my essays
 about my mental illness from every page on my website, but those
 well-meaning people do not understand my values.

 For reasons having largely to do with the way I was raised, it is far,
 far more important to me to solve the problems of others than it is to
 solve my own problems.

 I sent this just now to an administrator at the Northwestern School of
 Law at Lewis and Clark College in Portland, Oregon.  I have many
 reasons to study law but primary among them are that while the legal
 rights of the mentally ill are well-established in legislation as well
 as court precedent, those rights are not only not enforced, they are
 largely unknown.

 That led for example, to my being very nearly beaten to death by two
 Oregon Health  Sciences University campus police officers.  When I
 regained consciousness three days later, while I could correctly
 visualize the spelling of my name when I thought out it, I could not
 spell it correctly when I tried to write it by hand with a pencil.

 I asked the American Civil Liberties Union to represent me in a Civil
 Rights complaint against OHSU but recieved a form letter that pointed
 out that they focus only on Constitutional concerns.  That doesn't
 make a whole lot of sense but that is what the ACLU actually said.

 To Wit:

 Ms. Sullivan,

 After a great deal of consideration, I have decided to change careers
 from Software Engineering to Public Interest as well as Civil Rights
 Law.

 However I'm not real sure how to get started.  I am of very modest
 means; were I to go back to Physics grad school, I know my way would
 be paid by my advisor's research grant.  I don't have a clue how I can
 pay for law school but given my lifelong dedication towards the
 service of others I expect some way can be found to pay my expenses.

 I wish to request an appointment for an Informational Interview,
 either with yourself or some other Law School staff

Re: Most People Still Use Dialup

2015-06-16 Thread Michael David Crawford
I was finally able to download that 1 GB printer driver assortment,
but only by wandering around trying different wifi spots.

I knew that I could have downloaded just a 24 MB driver for my
specific printer but that would have come at the cost of bringing that
printer with me to a wifi spot so OS X would see that it was connected
via USB.  If OS X can choose my driver because it identifies itself,
why can't I just tell OS X myself?

Or Epson; Epson's driver download page specifically says to plug the
printer in then let OS X take care of it.

Some wifi spots have a lot of capacity but rate-limit individual clients.

In the case of my dialup I would be able to download that 24 MB driver
but there is some problem somewhere out on the Internet backbone.  I
don't really know but speculate that it has to do with the routers all
being optimized to server Facebook to cable modem users.

I used dialup from rural Maine from 2001 to 2003 and it worked just
fine; it even worked OK to set up IP masquerading so my ex and I could
share the dialup service.

If I traceroute from here in Salmon Creek, Washington to my server at
Hurricane Electric in Fremont, California it goes through dozens of
routers, many of which are clearly in the same data center.  That is,
I'll go through ten or twenty routers at Level 3 in Seattle, then
another ten or twenty in Fremont.

When I start my day I flush the tubes with the following:

   $ sudo ping -c 100 -f apple.com
   $ sudo ping -c 100 -f berkeley.edu
   $ sudo ping -c 100 -f www.vatican.va

By tracerouting before and after that flushing, I can see that my
packets traverse far fewer routers.
-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Most People Still Use Dialup

2015-06-16 Thread Michael David Crawford
What that page actually says to do, is to connect your printer then
let OS X choose the driver for you.

The driver I need is not available for manual selection.

I didn't really want to have to connect a printer to download the
driver, because it would look quite strange, if not downright
offensive, to hook up my printer at Starbucks.

On 6/16/15, Alex Zavatone z...@mac.com wrote:

 On Jun 16, 2015, at 6:34 AM, Michael David Crawford wrote:

 I was finally able to download that 1 GB printer driver assortment,
 but only by wandering around trying different wifi spots.

 I knew that I could have downloaded just a 24 MB driver for my
 specific printer but that would have come at the cost of bringing that
 printer with me to a wifi spot so OS X would see that it was connected
 via USB.

 Or maybe you could have logged on to Epson's site and downloaded that one
 driver you wanted all by itself from the support page.

 http://www.epson.com/cgi-bin/Store/support/SupportYosemite.jsp





-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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

Goodbye and Thanks for All The Code

2015-06-15 Thread Michael David Crawford
I've been out of work for most of the last five years.  Many
well-meaning yet sadly misinformed people give me what doubtlessly
would be good advice for others, for example that I should go on
disability, get into subsidized housing or to stop linking my essays
about my mental illness from every page on my website, but those
well-meaning people do not understand my values.

For reasons having largely to do with the way I was raised, it is far,
far more important to me to solve the problems of others than it is to
solve my own problems.

I sent this just now to an administrator at the Northwestern School of
Law at Lewis and Clark College in Portland, Oregon.  I have many
reasons to study law but primary among them are that while the legal
rights of the mentally ill are well-established in legislation as well
as court precedent, those rights are not only not enforced, they are
largely unknown.

That led for example, to my being very nearly beaten to death by two
Oregon Health  Sciences University campus police officers.  When I
regained consciousness three days later, while I could correctly
visualize the spelling of my name when I thought out it, I could not
spell it correctly when I tried to write it by hand with a pencil.

I asked the American Civil Liberties Union to represent me in a Civil
Rights complaint against OHSU but recieved a form letter that pointed
out that they focus only on Constitutional concerns.  That doesn't
make a whole lot of sense but that is what the ACLU actually said.

To Wit:

Ms. Sullivan,

After a great deal of consideration, I have decided to change careers
from Software Engineering to Public Interest as well as Civil Rights
Law.

However I'm not real sure how to get started.  I am of very modest
means; were I to go back to Physics grad school, I know my way would
be paid by my advisor's research grant.  I don't have a clue how I can
pay for law school but given my lifelong dedication towards the
service of others I expect some way can be found to pay my expenses.

I wish to request an appointment for an Informational Interview,
either with yourself or some other Law School staff that you
recommend.  My schedule is wide open.  My number is (503) 688-8345 or
my email is mdcrawf...@gmail.com.

Among the reasons I want to read the law that I was taught from a very
early age that the reason America exists was so that we would not live
in the kind of country that in my actual experience, America has
become.

A great-great (not sure how many greats) uncle of mine, Roger Sherman,
signed the Declaration of Independence - on the back of the $2.00 bill
Uncle Roger is fourth from the right of the five founding fathers
standing before the signing table, the tall guy with the tall
forehead.  I'm also related to the two Union Army General-in-Chiefs
during the American Civil War, George B. McClellan and William
Tecumseh Sherman.

As a physicist and a computer programmer I know many ways to employ
technical measures to protect our privacy and our rights however my
experiences with those who don't take interest in technology is that
engineering falls far short of the mark.  My mother for example knows
to shred her paper documents but there's no way I could ever convince
her to use The Onion Router to protect her privacy.
(http://torproject.org/)

Mom attended Lewis and Clark her first year in college but transferred
to the U of Idaho after she met my father.

I attended Solano Community College and UC Davis for just a few
classes after passing the California High School Proficiency
Examination.  I majored in Astronomy at the California Institute of
Technology, then transferred to UC Santa Cruz where I obtained my BA
in 1993.  I enrolled in graduate school with a focus on Elementary
Particle Physics, but dropped out as I was not prepared financially.

While I would love to go back into Physics I don't see it as solving
the kinds of problems I see.

My experience is that while I do not get the best grades I am very
well-known for asking the most-insightful questions.

There is absolutely no doubt in my mind that my difficulty finding
work in my present profession is due to my being so notoriously
outspoken; a while back I wrote an online book called Solving the
Software Problem: a Taxonomy of Error.  While I wrote it
pseudonymously as Jonathan Swift, on my Contact page I wrote:

=

I suppose this is a good place to clue you all in to the fact that my
real name is Michael David Crawford.

I use Jonathan Swift as a pseudonym not because he wrote the
well-known book Gulliver's Travels but because he wrote the more
historically important pamphlet A Modest Proposal.

A Modest Proposal suggested that the problem of Irish poverty could be
solved by slaughtering Irish infants that their meat may be served on
the dinner tables of wealthy Britons. For his contribution to the
social discourse of the day, Swift got a price put on his head by the
British Crown.

Perhaps if I work very, very

Re: Language options: Objective-C, Swift, C or C++?

2015-06-13 Thread Michael David Crawford
I strongly support program correctness but regard C++ is the best at
facilitating that for me personally.

However I'm not a language zealot, and it took me years to figure out
how to get C++ right.

Pick out a few apps completely at random in the app store.  Sort the
reviews by most-negative first.  Last time I tried the vast majority
complained of crashes, user interfaces that did not work or were
sorely confusing or end-user data loss.  I held back an old version of
Skype for years despite that it commonly crashed because so many
complained that the new versions were far worse.

I fault Apple, given that it is Apple's written policy to reject
crashy apps from the app store.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Sat, Jun 13, 2015 at 7:50 PM, Rick Mann rm...@latencyzero.com wrote:

 On Jun 13, 2015, at 19:06 , Carl Hoefs newsli...@autonomy.caltech.edu 
 wrote:

 Thanks for the informative listing. So Swift offers refinements (not a 
 paradigm shift like object orientation over functional), many of which could 
 be added to ObjC, and many of which I wouldn’t want. I guess I was trying to 
 find the main, overwhelming purpose driving the adoption of Swift. I think I 
 was looking too high.

 Watch the talk on protocol-oriented programming 
 (https://developer.apple.com/videos/wwdc/2015/?id=408).

 And remember, you an do object-oriented programming in C. There's nothing 
 magical about a language that makes it OO or prevents OO. But the language 
 can certainly make it easier or harder to do.

 What I think Swift gives, more than any of the other options we have, is 
 program correctness. I've only scratched the surface with Swift, and there 
 are things about Obj-C I miss (well, one thing), but I'm quickly coming 
 'round to the idea that Swift is better (than other languages).

 --
 Rick Mann
 rm...@latencyzero.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/mdcrawford%40gmail.com

 This email sent to mdcrawf...@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: Language options: Objective-C, Swift, C or C++?

2015-06-13 Thread Michael David Crawford
Gary,

Doubtlessly my availability for software development is not due to my
preference for C++ nor ZooLib, but because I am so outspoken regarding
ethics, as well as so explicitly public about my mental illness of
Bipolar-Type Schizoaffective Disorder.

Consider for example that I was expelled from Caltech because I slept
on a couch in Ricketts House after Master of Student Housing Chris
Brennan told me not too.

(I used to live in the room right next to Jens.)

It is commonly said that surviving such catastrophes as heart attacks,
cancers or wars gives one quite a different outlook on life.  After
having been damn near beaten to death by three Caltech security
guards, I classify such concerns as frameworks, programming languages
and platforms in the same bin that I place discussions concerning the
angel capacity of pinheads.

What I regard as more important to us all is:

   Every Engineer's Solemn Duty
   http://www.warplife.com/ethics/duty.html

Thanks for letting me clear all that up.

Mike
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Sat, Jun 13, 2015 at 6:32 PM, Gary L. Wade
garyw...@desisoftsystems.com wrote:
 On Jun 13, 2015, at 5:14 PM, Michael David Crawford mdcrawf...@gmail.com 
 wrote:

 To code for OS X or iOS in C++ I can use ZooLib which I prefer quite a
 lot to any other framework I've ever used.
 …
  Available for Software Development in the Portland, Oregon Metropolitan 
 Area.

 And that's an example of how there's always consequences to our actions.
 --
 Gary L. Wade (Sent from my iPad)
 http://www.garywade.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: Language options: Objective-C, Swift, C or C++?

2015-06-13 Thread Michael David Crawford
I don't need either Swift nor Objective-C to code for OS X or iOS, I
need them to code for Cocoa or Cocoa Touch.

To code for OS X or iOS in C++ I can use ZooLib which I prefer quite a
lot to any other framework I've ever used.

Andy Green wrote in response to Apple's abandonment of Bedrock.  If
Andy finds the rug pulled out from under as when Apple cancelled
64-bit Carbon he just writes a new low-level shim.  I don't know but
expect ZooLib now talks directly to CoreGraphics, POSIX file I/O and
so on.

Ultimately the operating system is called by sending Mach messages to
it.  There's really nothing that Cocoa or Cocoa touch can do that
ZooLib couldn't do better in ISO C++.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Sat, Jun 13, 2015 at 4:53 PM, Maxthon Chan m...@maxchan.info wrote:
 The language complexity issue of C++ is one of the main reason it put me off 
 so much. And there is someone out there who posted a method of creating an 
 iOS app with no Objective-C code at all but quite a lot of runtime abusing. 
 The same method can be used on C++ but that requires some understanding how 
 Objective-C code works under the hood.

 On Jun 14, 2015, at 07:46, Graham Cox graham@bigpond.com wrote:


 On 13 Jun 2015, at 8:09 pm, Michael David Crawford mdcrawf...@gmail.com 
 wrote:

 The problem I've got is that those who pay for iOS and OS X
 development have it in their heads that one must know either
 Objective-C or Swift.


 You do need one of those to code for Apple devices, even if all your own 
 code is in C++, because that’s what the frameworks use, and all the 
 published APIs are expressed in. It’s a bit like the old days when you’d 
 code in C or C++ but all the published APIs were in Pascal - you had to have 
 an understanding of Pascal to follow the documentation at the very least, 
 and to work with OS-defined data structures.

 For me, coming from 12 years of C++ to Objective-C in the early 2000s was a 
 huge boost in productivity. A much simpler language can actually boost 
 output because you spend less time trying to understand all the “features” 
 you never actually need or use. YMMV.

 —Graham



 ___

 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/max%40maxchan.info

 This email sent to m...@maxchan.info


___

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: Language options: Objective-C, Swift, C or C++?

2015-06-13 Thread Michael David Crawford
While I think Swift is just dandy, and see it as a step in the right
direction that Apple has chosen to Open Source it, I won't be learning
it until it is an ISO standard.

The reason is specifically because Apple created Objective-C 2.0
without consulting a standards body.

Objective-C has many merits however I far prefer C++ and for many good
reasons.  Were I to state those reasons in this email no doubt a
language war will result.

The problem I've got is that those who pay for iOS and OS X
development have it in their heads that one must know either
Objective-C or Swift.  That leads to my extensive C++ experience being
of absolutely no use when I apply for such coding gigs - this despite
that I've used C++ on the Mac since 1990, while working for Apple.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Sat, Jun 13, 2015 at 12:10 AM, Graham Cox graham@bigpond.com wrote:

 On 13 Jun 2015, at 11:46 am, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:

 I also wonder if Swift is going to meet the Graham Cox test: “Will Graham 
 use it?” I’m picking on Graham (without giving offense, I hope) because he’s 
 a crusty (though lovable) retrovert who’s still doing manual memory 
 management *just in case* ARC isn’t doing things right.


 Ha ha! Thanks for the somewhat backhanded compliment.

 You might be surprised to find that I’ve been working with ARC lately, and 
 finding it does what it says on the tin. The only reason not to adopt it 
 without reservation at this point is not that it might not be doing things 
 right, it’s just that I have a huge codebase with MMM (and I’m leery of 
 changing things that work fine without some very good reason, so converting 
 it to ARC might do more harm than good, but that’s not a reflection on ARC, 
 but on my own “crusty” code). Where I did give up on ARC for a small project 
 a few months back, and went back to MMM was a feeling that it was getting 
 *something* wrong, in that I had a huge leak I couldn’t get a grip on, but 
 after converting laboriously back to MMM it was still there. Turned out that 
 was a framework leak/bug that AFACS is still unfixed from 10.10.1 Also, being 
 comfortable in MMM, ARC isn’t the breath of fresh air that it is to some - I 
 seem able to breathe underwater just fine ;-)

 Anyway, ARC isn’t an issue any longer, even for crusty retrovert me.

 Swift. Well, that’s still another matter. I will definitely learn Swift, 
 because as Roland says, that’s where the puck is going. Going, but not there 
 yet. I’m glad to hear that Swift has come on a lot since WWDC 2014, maybe by 
 WWDC 2016 it will be sufficiently settled. For me that’s still not really the 
 issue - the issue is the huge chunk of Obj-C code I have to maintain every 
 day. If I were to start a large new project I might use Swift even now, 
 especially after last week’s announcement of Swift 2.0, but I still get the 
 impression there is still some rough edges that cause frustration and 
 confusion. At the end of the day my goal is to write as much income-earning 
 code as I can, and as such I don’t have the luxury of learning a new language 
 that I can’t be productive in, however much I’d like to. So Swift adoption is 
 likely to be via a few small projects to dip my toe, and get comfortable, 
 before throwing something big at it.

 —Graham



 ___

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

 This email sent to mdcrawf...@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: Language options: Objective-C, Swift, C or C++?

2015-06-13 Thread Michael David Crawford
It is expected of me to learn languages, find out what they’re good
for, and apply the right tool to the right job.

The software director at a highly successful, well-known company I
once consulted for - that I would prefer not to name - emailed us all
to say that the company would not use Objective-c because he regarded
the syntax as ugly.

In 1997, a coworker who was one of the very finest Mac programmers to
have ever walked the Earth complained that C++ has to many
colon-colon operators.  Despite that he wrote lots of good C++ for
our company, but he hated every minute of it.

Javascript is now widely regarded as the world's most-popular
programming language.  While I can see the point of Javascript, I
personally would rather chew my own foot off than write any.  I'm not
completely clear as to why, but among the reasons I enjoy C, C++,
Objective-C and Assembly Code is that I can do tweaky little
optimizations like reordering data accesses so as to reduce cache
misses.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Sat, Jun 13, 2015 at 12:18 PM, Uli Kusterer
witness.of.teacht...@gmx.net wrote:
 On 12 Jun 2015, at 22:48, Jens Alfke j...@mooseyard.com wrote:
 Even the “if” statement is a method on class Boolean. Objective-C on the 
 other hand is an awkward combination of Smalltalk objects on top of C. And 
 the C crap really gets in the way. That’s where Swift really helps.

  Or to paraphrase the Brad Cox book title: ObjC is “an evolutionary approach” 
 to OO. C is at once ObjC’s greatest strength (nobody would have adopted it 
 otherwise, and selective optimization would have been harder) and its 
 greatest liability (because without it it could be as beautifully clean and 
 learnable as Smalltalk).

 Cheers,
 -- Uli Kusterer
 “The Witnesses of TeachText are everywhere...”
 http://zathras.de


 ___

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

 This email sent to mdcrawf...@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

[OT] correcting mistaken identity

2015-06-12 Thread Michael David Crawford
Ladies and Germs,

I configured my gmail to send the following autoresponse just now; I'm
sending this to cocoa-dev in hopes that the word might get through to
all the potential employers who stumbled across the wrong pages while
considering my applications

--

Dear Friend,

Thank you for contacting me; I will reply to your inquiry as promptly as I can.

Please permit me to avail myself of this opportunity to point out that
I am a Physicist and a Software Engineer, and am very much alive.

The tattoo artist also named Michael David Crawford who did time in
Walla Walla commencing in 2005, died at the age of 35 in a shootout
with the Lakewood, Washington police on December 9, 2012.

Him:

http://www.blscourierherald.com/news/202781071.html

Me:

   http://www.warplife.com/mdc/

While I remain dismayed by this mistaken identity, given that I am a
specialist in software reliability I know very well how my colleagues
can screw up on the job.

Thanks for letting me clear all that up,

Michael David Crawford, Consulting Software Engineer
Solving the Software Problem
http://www.warplife.com/mdc/
mdcrawf...@gmail.com

   While every Deity hath the Insight to Foretell the Future,
   Even G-d Almighty Himself Possesseth Not the Power to Undo the Past.
___

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: Wanted: Elegant way to manage this task

2015-06-09 Thread Michael David Crawford
Would it help to read some of the Internet RFCs?  They deal with this
kind of things in various ways.

Not that they're concerned with Objective-C or Cocoa but the concepts
might be useful.

On 6/8/15, Graham Cox graham@bigpond.com wrote:
 I have the following task I need to implement.


 1. I have a queue of NSData objects, usually representing a continuous
 stream, but delivered in variable-sized chunks. However some chunks could be
 missing, but the queue represents the correct order of the stream that was
 delivered, and the missing chunks can be flagged.

 2. The data in the stream consists of packets of fixed length. I need to
 extract the packets and pass them as complete single entities to another
 object (a delegate) for further processing. All complete packets must be
 extractable, and I’d like to do this on a secondary thread if possible.

 3. Due to the possibility of missing data chunks, resynchronisation for each
 new data may be required. I can detect when a data entry is contiguous with
 the previous one, or when one or more chunks has been skipped. A packet may
 be split across input data, or may be incomplete due to being split across
 data where the second part was missing.

 4. Packet detection is based on a signature byte at the start of each
 packet, and the fixed length of the packet which is a few hundred bytes. If
 five consecutive packets are detected having the same signature byte, the
 packets are presumed to have been detected and can be extracted for
 processing.

 The object that handles this should accept NSData chunks as input and queue
 them, or if there is a missing chunk, a nil data object. The object’s
 delegate should be passed the extracted packets one at a time in order as
 they become available, again as NSData objects. No time synchronization
 between the input and output is required.

 This sort of processing isn’t really my strong point, so while I can think
 of various ways to solve it by brute force and ignorance, I would have
 thought this is something that would be recognisable as a standard sort of
 stream processing algorithm by those who’ve done it before. Even just an
 outline or pointer to something like this would be a help.


 —Graham



 ___

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

 This email sent to mdcrawf...@gmail.com


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.

___

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: Looking at self = [super init].

2015-06-02 Thread Michael David Crawford
I once worked for a company that had quite meticulous style rules
regarding comments.  I was also required to use a specific text editor
because someone had written scripts that either enabled or enforced
the comment style rules.

I resigned in protest because their actual source code is quite likely
to get someone killed someday, quite likely a great many people.  They
do industrial control systems software.  Consider that the Stuxnet and
Flame worms attacked HMI/SCADA software.

I do comment tricky stuff.

While I don't write actual comments regarding input parameters or
return results, I do assert them - assert( ptr != NULL ).  I regard
assertions as documentation not just tests; if you intentionally
change the input parameter space, then your assertions will fail.
Given that you really did want to change the parameters, you'll be
forced to update the assertions as well.  That's better than trying to
keep comments in sync as there is no really satisfying test for
correct comments.

I quite commonly ask potential employers whether they have any kind of
coding conventions.  Whether I pursue the job has a lot to do with
what those conventions actually are.  If they're picky about their
comments I withdraw my application.  If their coding conventions are
the sort that are likely to lead to correct code then I pursue the job
with enthusiasm.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Tue, Jun 2, 2015 at 5:08 PM, Graham Cox graham@bigpond.com wrote:

 On 3 Jun 2015, at 9:03 am, Michael David Crawford mdcrawf...@gmail.com 
 wrote:

 That's because comments are rarely maintained in sync with the actual
 source code.



 So part of the responsibility of coding well is to maintain comments, not to 
 remove them altogether.

 At a minimum, I comment what a method does, in broad terms, and what the 
 parameters are for, if they're not obvious. Also, any tricks should be 
 commented. Any code that only works because of some hidden factor that isn't 
 obvious should be commented. Any non-obvious algorithm should be commented, 
 and so on. Code that is obvious is generally not worth commenting - it only 
 adds clutter. The example you gave was obvious in my opinion, so there 
 wouldn't normally be a comment there, even if it was correct.

  All this is usually covered in the style guide for coding that your employer 
 probably has, if they do any sort of serious coding. If you work for 
 yourself, you should have one as well.

 I don't trust completely uncommented code.

 --Graham



___

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: Looking at self = [super init].

2015-06-02 Thread Michael David Crawford
While there were numerous reasons for my protest resignation, the
reason I walked out - no notice given - was that I was the only one in
the company who was aware that there even was such a thing as a C++
Smart Pointer.

I knew something was up when I was told to stop referring to the
computer programmers as the engineers.  In Canada, it's a civil
offense to call yourself an engineer unless you're the Canadian
equivalent of an American Professional Engineer.  At that company,
the engineers was taken to mean the industrial control system
engineers - those who worked with electrical and mechanical gadgets.
All the software was written by computer programmers for no reason I
can fathom.

In mechanical drawing - more commonly known as drafting - there is
always a very specific convention for documentation blocks in your
drawing.  There will be the company name, maybe a logo, the
draftsman's name, revision numbers, a title, date and so on.  I expect
their comment fetish evolved from that.

What horrified me was that they were completely unaware that their
product was likely to drop a pickup truck on top of an assembly plant
worker.  While the overall architecture had all manner of
fault-tolerance engineered in, that fault-tolerance depended on
correct C++ code.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Tue, Jun 2, 2015 at 5:38 PM, Graham Cox graham@bigpond.com wrote:

 On 3 Jun 2015, at 10:19 am, Michael David Crawford mdcrawf...@gmail.com 
 wrote:

 If their coding conventions are
 the sort that are likely to lead to correct code


 The reason for coding style guidelines is a) correctness b) maintainability. 
 If it's just a fetish that the chief developer has and he can't back it up 
 with reasoned argument then that's suspect.

 Having been handed several uncommented and undocumented messes and left to 
 sort it out a couple of times in my career I'm very sensitive to the needs of 
 developers coming to a codebase cold. I try to write code in such a way that 
 I imagine a developer who's never seen it before could get up to speed in a 
 relatively short time, even if 99% of the time that developer is me, several 
 years removed. There's nothing worse than wasting hours wondering what the 
 hell was I thinking? instead of just reading a comment that explains what I 
 was thinking.

 --Graham



___

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: Looking at self = [super init].

2015-06-02 Thread Michael David Crawford
After I pointed out my diligent use of comments to Scott Lydiard,
President of aerial photography firm Verde Technologies, he advised me
not comment my code in any way.

WUT?

That's because comments are rarely maintained in sync with the actual
source code.

For example:

int offset( void )
{
return 3;   // return 4
}

This isn't the same as the jerks who think you're stupid if you can't
follow their logic.  I regard it as my responsibility to make my
source clear and easy to maintain, even without comments.

However I am dead certain that it loses me work, when potential
clients look over my source and don't find any comments in it.

Mike
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Tue, Jun 2, 2015 at 2:22 PM, Kyle Sluder k...@ksluder.com wrote:
 On Tue, Jun 2, 2015, at 03:42 PM, Charles Srstka wrote:
  On Jun 2, 2015, at 3:31 PM, Jens Alfke j...@mooseyard.com wrote:
 
  I agree, actually. But in Swift the concept of ivar no longer exists, so I 
  have to rely on color/style to distinguish properties from locals.

 My solution with Swift is to consistently use the self. prefix when
 referencing properties. If Apple could include an optional compiler
 warning to enforce this like they do with Obj-C auto-synthesis, it'd be
 *great* (hint hint for any Apple engineers that happen to be reading
 this).

 If you think this would be a worthwhile change to Swift, please file a
 Radar.

 --Kyle Sluder

 ___

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

 This email sent to mdcrawf...@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: Looking at self = [super init].

2015-06-01 Thread Michael David Crawford
I've always used m to prefix ivars: mSpeed, mDistance.  I use s
for statics and k for constants.

I'd like to find a good convention for distinguishing properties but
haven't really found one that is appealing to me.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Mon, Jun 1, 2015 at 3:14 PM, Charles Srstka cocoa...@charlessoft.com wrote:
 On Jun 1, 2015, at 4:52 PM, Britt Durbrow 
 bdurb...@rattlesnakehillsoftworks.com wrote:

 I don't use underscores to prefix ivars. I think it's ugly, and unnecessary 
 -- it doesn't help with namespacing (if a subclass and a superclass both 
 declare _someVariable with the underscore they will collide just as badly as 
 if they declare someVariable without one)

 Which is not at all, actually:

 #import Foundation/Foundation.h

 @interface Foo : NSObject

 - (void)fooLogAnIvar;

 @end

 @interface Bar : Foo

 - (void)barLogAnIvar;

 @end

 int main(int argc, const char * argv[]) {
 @autoreleasepool {
 Bar *bar = [Bar new];

 [bar fooLogAnIvar];
 [bar barLogAnIvar];
 }
 return 0;
 }

 @implementation Foo {
 NSString *_anIvar;
 }

 - (instancetype)init {
 self = [super init];

 if (self == nil) {
 return nil;
 }

 _anIvar = @Foo;

 return self;
 }

 - (void)fooLogAnIvar {
 NSLog(@Foo: _anIvar is %@, _anIvar);
 }

 @end

 @implementation Bar {
 NSString *_anIvar;
 }

 - (instancetype)init {
 self = [super init];

 if (self == nil) {
 return nil;
 }

 _anIvar = @Bar;

 return self;
 }

 - (void)barLogAnIvar {
 NSLog(@Bar: _anIvar is %@, _anIvar);
 }

 @end

 2015-06-01 17:12:16.328 test[17203:2499855] Foo: _anIvar is Foo
 2015-06-01 17:12:16.329 test[17203:2499855] Bar: _anIvar is Bar

 and ivars vs accessors are obvious by context: [self obviouslyAnAccessor] or 
 self.obviouslyAnAccessor vs obviouslyAnIvar (or very rarely, 
 someObject-obviouslyAnIvar).


 Non-underscored ivars vs. local variables, however, are not obvious at all, 
 especially if the method is large.

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

 This email sent to mdcrawf...@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: Looking at self = [super init].

2015-06-01 Thread Michael David Crawford
The paper entitled Goto Considered Harmful - by Dijkstra? - was
criticizing spaghetti code.  At the time, commonly used programming
languages did not have control flow statements like if/then/else,
do/while, while or switch/case.  Instead, other than fortran's
do/continue you had to roll your own control flow; often it was done
quite poorly.

If you're experienced with coding as well as careful about it, there's
no real good reason that one cannot use goto to create control flow
that's not built-in to the language.  Despite that it is commonly
asserted that if you use goto, then you are clueless.  That's just
wrong.

Assembly code doesn't really have control flow constructs.  You make
them out of gotos - condition or unconditional branches.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Mon, Jun 1, 2015 at 4:05 PM, pscott psc...@skycoast.us wrote:
 On 6/1/2015 2:52 PM, Britt Durbrow wrote:

 I personally find early returns to be very useful, and also make use of
 forward-jumping goto statements sometimes (i.e, goto bail;).


 FWIW, while I embrace both early returns and the goto statement where it
 makes sense, for the case you make, I would use a break statement inside a
 do block:

 #define end_do while (0)

 do {
 if ( bailCondition ) break;
 if ( someOtherBailCondition ) break;
...
 } end_do;

 This creates another level of indentation, but structurally, that's the
 point.

 However, when working on somebody else's code (like, say, an open-source
 library); I'll adopt their coding style, even if some of the things they do
 make my eyes itch. ;-)


 We are cut from the same cloth, there.

 Paul

 --
 Paul Scott
 psc...@skycoast.us



 ___

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

 This email sent to mdcrawf...@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: Looking at self = [super init].

2015-06-01 Thread Michael David Crawford
Steve - are you saying that C++ destructors aren't called if you use a goto?

It was my understanding that the destructor is called if you go out of
scope for any reason, even if it's a goto.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Mon, Jun 1, 2015 at 4:39 PM, Quincey Morris
quinceymor...@rivergatesoftware.com wrote:
 On Jun 1, 2015, at 14:52 , Britt Durbrow 
 bdurb...@rattlesnakehillsoftworks.com wrote:

 I happen to like an extra semicolon after a closing brace when it's the end 
 of the logical block. It's just the way I like it to look (it feels 'funny' 
 to me to have a statement end without one); the compiler ignores it. YMMV.

 The issue here is that you may find it comforting to see ';' at the end of 
 a statement, but it skates right over the ambiguity of when a { ... } 
 construct is to be regard as a logical block. The compiler does *not* 
 ignore the ; after }. The following does *not* compile:

 if (...) {...}; else {...};

 You can argue that the intermediate ';' not the end of a logical block, but 
 if a } isn't the end of a logical block, you've just changed a stylistic 
 rule into a syntax rule.

 I don't use underscores to prefix ivars. I think it's ugly, and unnecessary 
 -- it doesn't help with namespacing (if a subclass and a superclass both 
 declare _someVariable with the underscore they will collide just as badly as 
 if they declare someVariable without one)

 The real reason for this convention is something else. In the bad old days 
 (meaning, more or less, pre-Leopard), there were multiple conflicting 
 conventions about using _ for naming. Perhaps it was when the clang 
 compiler was introduced, I can't remember exactly, but Apple decreed the 
 current convention, to work around the inherent unsafety of Obj-C namespacing:

 -- Private 3rd party instance variables *should* use the underscore.

 -- Private 3rd party methods *must not* use the underscore.

 It's not really a question of good or bad. It's more a question of what we 
 were required to do to avoid future Cocoa frameworks releases from 
 retroactively breaking our apps.

 On Jun 1, 2015, at 15:14 , Charles Srstka cocoa...@charlessoft.com wrote:

 Which is not at all, actually:

 The answer is not at all only with the modern ABI. 32-bit Mac compilations 
 will conflict.



 ___

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

 This email sent to mdcrawf...@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: Looking at self = [super init].

2015-06-01 Thread Michael David Crawford
I quite commonly fix bugs by refactoring all the lengthy routines into
several shorter ones.

I'll do that especially when I can't determine the cause of a bug;
instead I'll just look around for messy source then tidy it up.  That
has a way of making bugs go away.

On 6/1/15, Charles Srstka cocoa...@charlessoft.com wrote:
 On Jun 1, 2015, at 6:39 PM, Quincey Morris
 quinceymor...@rivergatesoftware.com wrote:

 On Jun 1, 2015, at 15:14 , Charles Srstka cocoa...@charlessoft.com
 mailto:cocoa...@charlessoft.com wrote:

 Which is not at all, actually:

 The answer is not at all only with the modern ABI. 32-bit Mac
 compilations will conflict.

 That's true. Also, code written for the Mac Plus using THINK C 3.0 will
 conflict. However, compilation targets that people are actually still using
 in 2015 will not conflict.

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

 This email sent to mdcrawf...@gmail.com


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Looking at self = [super init].

2015-06-01 Thread Michael David Crawford
Among the reasons I've always preferred Mac development is the common
use of CamelCase.  I have poor eyesight and commonly eye fatigue as
well, that leads to it being difficult for me to distinguish
underscores from hyphens:

   foo = unix_style;
   foo = unix-style;

It is for that same reason that I adopted someone else's practice of
putting spaces inside of parentheses:

   void foo( int x, char y )

I've done that for decades but I've never seen anyone else do it.

On 6/1/15, Britt Durbrow bdurb...@rattlesnakehillsoftworks.com wrote:
 In no particular order:

 On Jun 1, 2015, at 7:27 PM, Michael David Crawford mdcrawf...@gmail.com
 wrote:

 I quite commonly fix bugs by refactoring all the lengthy routines into
 several shorter ones.



 I have the same rule of thumb - if it's not obvious what's going on, I
 should probably think about refactoring it into smaller chunks.

 --



 On Jun 1, 2015, at 6:09 PM, Graham Cox graham@bigpond.com wrote:

 If you have a complex method whose function can't be determined at a
 glance (and that in itself could be a good argument for a refactoring)
 with multiple exit points rather than one clear exit point at the end, it
 can often be hard to follow the flow of control.

 Um... don't do that? :-)

 Yes, early returns  gotos are power tools that can be misused. YMMV, wear
 proper personal protective equipment, void where prohibited and/or
 uninitialized, not for sale to miners, etc...

 ...and no, I have no idea why people who dig ore out of the ground shouldn't
 be allowed to buy it (I suppose that's what I get for asking a muppet for
 legal advice, eh? :-)

 --



 On Jun 1, 2015, at 4:39 PM, Quincey Morris
 quinceymor...@rivergatesoftware.com wrote:

 On Jun 1, 2015, at 14:52 , Britt Durbrow
 bdurb...@rattlesnakehillsoftworks.com wrote:

 I happen to like an extra semicolon after a closing brace when it's the
 end of the logical block. It's just the way I like it to look (it feels
 'funny' to me to have a statement end without one); the compiler ignores
 it. YMMV.

 The issue here is that you may find it comforting to see ';' at the end
 of a statement, but it skates right over the ambiguity of when a { ... }
 construct is to be regard as a logical block. The compiler does *not*
 ignore the ; after }. The following does *not* compile:

  if (...) {...}; else {...};

 You can argue that the intermediate ';' not the end of a logical block,
 but if a } isn't the end of a logical block, you've just changed a
 stylistic rule into a syntax rule.


 The entire if statement is what I consider a logical block: the else {...}
 does not, and indeed cannot, stand alone.

   if(someCondition)
   {
   [someObject doSomething];
   }
   else
   {
   [someObject doSomeOtherThing];
   };
   
   [anotherObject doesSomethingElseEntirely];

 is the same to the compiler as:

   if(someCondition)
   {
   [someObject doSomething];
   }
   else
   {
   [someObject doSomeOtherThing];
   }
   
   [anotherObject doesSomethingElseEntirely];

 or even:

   someCondition?[someObject doSomething]:[someObject
 doSomeOtherThing],[anotherObject doesSomethingElseEntirely];

 although I will say that the readability on the third example does suffer
 somewhat. :-)

 --

 I don't use underscores to prefix ivars. I think it's ugly, and
 unnecessary -- it doesn't help with namespacing (if a subclass and a
 superclass both declare _someVariable with the underscore they will
 collide just as badly as if they declare someVariable without one)

 The real reason for this convention is something else. In the bad old days
 (meaning, more or less, pre-Leopard), there were multiple conflicting
 conventions about using _ for naming. Perhaps it was when the clang
 compiler was introduced, I can't remember exactly, but Apple decreed the
 current convention, to work around the inherent unsafety of Obj-C
 namespacing:

 -- Private 3rd party instance variables *should* use the underscore.

 -- Private 3rd party methods *must not* use the underscore.

 It's not really a question of good or bad. It's more a question of what we
 were required to do to avoid future Cocoa frameworks releases from
 retroactively breaking our apps.


 There were multiple arguments for and against underscores; the namespace
 issue is one of them; readability was another. FWIW, once upon a time, Apple
 claimed the entire namespace prefixed with an underscore as reserved (for
 both instance variables and methods). I believe that the modern runtime does
 indeed get around

Re: Looking at self = [super init].

2015-05-30 Thread Michael David Crawford
While in principle machine code implementations of subroutines can
return from several different places, in practice they don't.  Rather
the compiler's code generator emits a branch instruction to the end of
the subroutine, there there is an epilog.

There are many good reasons for returning from the middle in certain
specific cases; what if the only epilog you need is an rts?
Branching to the epilog could cause a cache miss.

I expect the compiler developers know all about this but don't
typically avail themselves of it because writing compilers is
difficult.

To be clear, the following source code:

- (id) init
{
   if ( self == [super init] ) return nil;

   // lots of code goes here

   return self;
}

... is implemented as something like this, but in machine code:

- (id) init
{
   id result;
   if ( self == [super init] ){
 result = nil;
 goto epilog;
   }

   // lots of code goes here
   result = self;

epilog:
   return result;
}
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Fri, May 29, 2015 at 6:25 PM, Graham Cox graham@bigpond.com wrote:

 On 30 May 2015, at 3:22 am, Alex Zavatone z...@mac.com wrote:

 // We don't care if this gets long.


 My take is that you're rewriting a well-recognised idiom to solve a 
 non-existent problem.

 The well-recognised idiom makes it easy to verify it's correct. Hiding a 
 different construct inside a macro obscures that, making it harder to verify 
 the code. It's not wrong exactly, just harder to see at a glance that it's 
 right.

 The non-existent problem you're trying to solve is that the gap between a 
 pair of braces could get large. So what? Early returns can be another source 
 of bugs, so structural purists would tell you that you shouldn't do that. 
 Sometimes I think it's justified, but not usually worthwhile. Another 
 religious issue is whether matching braces should line up or not. Personally 
 I prefer that they do, at the cost of an extra line. Because you aren't doing 
 that, your long distance between braces is bothering you, because you're 
 losing track of where it started (I assume that's why it's bothering you). If 
 you line up the braces that is much less of an issue.

 Source code is for humans, so it should be as readable as you can possibly 
 make it. Macros often hinder that. Unaligned braces hinder that. Multiple 
 statements per line hinder that.

 Factoring code helps, so I'd suggest that's the better way to solve this. 
 (and it's also beneficial when it comes to making sure that -initWithCoder: 
 and other initializers that don't correctly follow the designated initializer 
 rule can get access to your common initialization. While this is rarely a 
 problem, I did notice that the recent change to encourage the use of 
 -initWithCoder: for unpacking NSViews from a nib breaks this long-standing 
 rule and so a common init method that both can call is a simple workaround).

 --Graham



 ___

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

 This email sent to mdcrawf...@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: [PSA] OSStatus.com -- Error code lookup

2015-05-30 Thread Michael David Crawford
May I Bear Your Firstborn?
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Sat, May 30, 2015 at 9:38 PM, Seth Willits sli...@araelium.com wrote:

 I can't tell you how many times over the years I've been frustrated by having 
 to manually search multiple frameworks' header files to look up what the 
 symbol or description for an error code value was. (I know 'macerror' exists, 
 but I have never had any luck with it. I consider it useless.)

 I finally got fed up, wrote some code, and made a website. So, here's v1.
 http://www.osstatus.com/

 I hope someone besides me finds it useful. ;-)


 --
 Seth Willits




 ___

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

 This email sent to mdcrawf...@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

[OT] Computer Employer Index

2015-05-30 Thread Michael David Crawford
I am building a list of links directly to the Jobs or Careers
sections of computer employer websites.  Not just for coding jobs but
also hardware engineering, QA, project management, technical sales and
the like.

   http://www.warplife.com/jobs/computer/

So far I've done this mostly in a very painfully manual way however I
am developing some automated tools.

There is no charge for a listing there, nor will there ever be.
Please do not be dismayed if I do not yet list your company, just mail
your homepage URL - offlist - to mdcrawf...@gmail.com

I am not aiming to make money from this.  I'm doing it as a public
service to the community.  The Santa Cruz County, California page
explains why I started it way back in 1997; I little over a year ago I
decided to work towards a global index.

The best coverage so far is for Portland and Seattle.  The San Luis
Obispo page does not have many entries but because SLO doesn't have
much tech that list can be considered reasonably complete.  I also
cover San Francisco, Boston, New York City, London and Berlin.  There
is also a remote work page.

I have a great many links that I have not posted yet.  I generally
post a page for a new location once I have enough links that I can
make a splash by announcing that specific page.

You could help a lot of people out were you to pass the URL onto those
who you genuinely feel would be interested in or would benefit from
it.

Yours,

Mike
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Copy test docs to Simulator App's Documents folder?

2015-05-25 Thread Michael David Crawford
I'm still trying to load the simulator with some sample files for my
app's Documents folder.

I'm able to put documents in the Documents folder for my app on my
iPad.  I can use the Devices window to copy my .xcappdata folder to my
project heirarchy.  I can select it to be added to my simulated app in
the Edit Scheme / Options dialog.

The .xcappdata folder does contain the desired documents but they
don't show up in my app's UI.  Is this a known bug in Xcode or the
Simulator?

There is some possibility it is a bug in my code.  I'll look into that
while I eagerly await your response.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Mon, Apr 20, 2015 at 8:45 PM, Michael Crawford mdcrawf...@gmail.com wrote:
 (David Brittain sent me his AppDataInfo.plist.)

 That gets me part of the way there but now I get the message
 Application Data package not copied to the Simulator because it
 doesn't have a data folder, along with the promise to copy it the
 _next_ time it is run, however that doesn't happen.  Google yields no
 joy.

 Possibly the settings in my plist aren't consistent with the rest of
 the project I will check that.

 Someone already filed a radar in which he request that we be able to
 set up Application Data for the Simulator.

 --
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 http://www.warplife.com/mdc/

Available for Software Development in the Portland, Oregon Metropolitan
 Area.
___

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: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Michael David Crawford
there are good reasons to use properties that are backed by ivars,
there are good reasons to use properties that aren't backed by
anything, and there are good reasons to use ivars that are not
properties.

In my own code I started with nothing but ivars, but changed some of
them to properties while neglecting to remove the original ivar.  This
leaves me somewhat in the same situation as you.  As I refactor my own
code I keep in mind each of the above three situations.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, May 20, 2015 at 1:42 PM, Ken Thomases k...@codeweavers.com wrote:
 Have to correct a typo:

 On May 20, 2015, at 3:22 PM, Ken Thomases k...@codeweavers.com wrote:

 You are accessing a property if you use explicit message sending 
 ([someObject someProperty] or [someObject setSomeProperty:someValue]) or if 
 you use implicit message sending view dot syntax (someObject.someProperty).

 That should be via dot syntax, not view.

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

 This email sent to mdcrawf...@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: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Michael David Crawford
You could comment off their declarations in your header files, then
have a look at which uses of them in your sources result in fatal
compiler errors.

(Comment off just one at a time.)
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, May 20, 2015 at 4:08 PM, Eric Wing ewmail...@gmail.com wrote:
 Which are they, ivars or properties?

 I don't know.  I can't tell.

 Is there any way to inspect an instance and tell if it is a property or an
 ivar if both the property and ivar have the same name?

 Fun times, fun times.


 You could use the Objective-C runtime to find out which things are properties.
 Look for functions like:
 objc_property_t * class_copyPropertyList ( Class cls, unsigned int *outCount 
 );

 ivars that are not properties will not show up as properties, so you
 can cross-reference these with a master list you keep.


 -Eric
 --
 Beginning iPhone Games Development
 http://playcontrol.net/iphonegamebook/
 ___

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

 This email sent to mdcrawf...@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: Stupid Cocoa question. How can you tell if the object you are looking at is a property or an ivar?

2015-05-20 Thread Michael David Crawford
If you have so many ivars, or so many properties that it's a lot of
work to figure out which is which, quite likely you're doing something
wrong.

Now you're already refactoring your code, so you're doing something right there.

It is quite common that well-done refactoring reduces the numbers of
lines of code.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, May 20, 2015 at 4:17 PM, Jens Alfke j...@mooseyard.com wrote:

 On May 20, 2015, at 4:08 PM, Eric Wing ewmail...@gmail.com wrote:

 You could use the Objective-C runtime to find out which things are 
 properties.

 You could, but isn't it a lot easier to just look at the character before the 
 name and check whether it's a .?

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

 This email sent to mdcrawf...@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: How to draw a NSView on top of a WebView and don't get overriden trying

2015-05-13 Thread Michael David Crawford
would it work render the web view in an offscreen buffer, then copy
that onto an on-screen view of your own?

At that point you could either have your child view, or simply draw
into one big view.

On 5/13/15, Juanjo Conti jjco...@carouselapps.com wrote:
 I'm writing a screen saver, so using another window is not possible :(

 On Tue, May 12, 2015 at 6:00 PM, Mike Abdullah mabdul...@karelia.com
 wrote:

 The failsafe way is to place a child window over the WebView. I'm not 100%
 sure but I think popovers work that way behind the scenes, so maybe one of
 them would be usable for this.

  On 12 May 2015, at 22:44, Juanjo Conti jjco...@carouselapps.com wrote:
 
  I have a WebView and I want to show some messages over it. For this I'm
  using a NSView.
 
  If I add it as a subView of WebView or if I add it as a subView of the
  WebView's superView, it's shown for a while but if the WebView gets
  scrolled or if I load sites gmail.com or twitter (without logging in),
 the
  website hides my NSView.
 
  Is this a known problem? is there any solution?
 
  Thanks in advance,
  --
 
  Juanjo Conti jjconti http://goog_2023646312@carouselapps.com
  jjco...@carouselapps.com
 
  Software Engineer - Carousel Apps https://carouselapps.com
 
  --
  Carousel Apps Limited, registered in England  Wales with registered
 number
  7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket
  Street, London SE1 3HN. Any communication sent by or on behalf of
 Carousel
  App Ltd or any of its subsidiary, holding or affiliated companies or
  entities (together Watu) is confidential and may be privileged or
  otherwise protected. If you receive it in error please inform us and
  then
  delete it from your system. You should not copy it or disclose its
 contents
  to anyone. Messages sent to and from Watu may be monitored to ensure
  compliance with our internal policies and to protect our business.
  Emails
  are not secure and cannot be guaranteed to be error free. Anyone who
  communicates with us by email is taken to accept these risks.
  ___
 
  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/mabdullah%40karelia.com
 
  This email sent to mabdul...@karelia.com




 --

 Juanjo Conti jjconti http://goog_2023646312@carouselapps.com
 jjco...@carouselapps.com

 Software Engineer - Carousel Apps https://carouselapps.com

 --
 Carousel Apps Limited, registered in England  Wales with registered number
 7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket
 Street, London SE1 3HN. Any communication sent by or on behalf of Carousel
 App Ltd or any of its subsidiary, holding or affiliated companies or
 entities (together Watu) is confidential and may be privileged or
 otherwise protected. If you receive it in error please inform us and then
 delete it from your system. You should not copy it or disclose its contents
 to anyone. Messages sent to and from Watu may be monitored to ensure
 compliance with our internal policies and to protect our business. Emails
 are not secure and cannot be guaranteed to be error free. Anyone who
 communicates with us by email is taken to accept these risks.
 ___

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

 This email sent to mdcrawf...@gmail.com


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Michael David Crawford
I haven't tried it myself but this sounds like a bug in IB rather than
in your own code.

Perhaps you should take a stab at writing a minimal test case, then if
that demonstrates that it really is a bug, file a radar.

On 5/12/15, Roland King r...@rols.org wrote:

 On 12 May 2015, at 14:43, Graham Cox graham@bigpond.com wrote:

 I'm exploring the use of the new IB_DESIGNABLE macro to preview a custom
 view live in IB.

 It keeps complaining that my view is taking too long to draw, over 200mS,
 which seems to be a limit built into IB. However, when I measure the time
 myself for drawing, it's nowhere near this long - 10mS max, typically 2mS.
 Because of this constant and apparently erroneous complaint, IB doesn't
 show my custom view. I've even tried to do some minimal drawing (just
 filling the dirty rect) for just the Interface Builder target, but I get
 the same problem, so it's pretty clear that the timeout is nothing to do
 with my drawing.

 At other times IB complains that the rendering agent crashed, though
 it's actually an exception from the bowels of Core Graphics. My usual
 drawing code never triggers the same exception, only when it's drawn by
 the IB rendering agent.

 Has anyone been able to make this work?

 --Graham

 I have been able to make it work but it's not been a trouble-free
 experience. There was at least one version of Xcode I couldn't make it work
 at all. I've had other times that a quit/restart was needed to get it going.

 I suspect that this is not your problem but I will mention I have a bug
 report out that the IB render code calls initWithFrame: which isn't required
 in Swift and I hadn't in one case implemented it, so it just crashed, or
 hung or both. You're most-likely in obj-c so that is unlikely to be your
 issue. You could override it anyway just for good measure.

 The docs and the WWDC video say the custom control must be in a framework
 but I believe that's not actually true, or no-longer true as of the released
 Xcode 6? There was a note somewhere about this but I can't find it now and
 neither can google.

 You can debug these IB designable things. I found that if I was able to get
 the view to enable the Debug Selected Views menu item then it seemed IB was
 mostly happy with the control.

 Not entirely helpful I know - I just bashed my head against the brick wall
 for a while until it worked.
 ___

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

 This email sent to mdcrawf...@gmail.com


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Outlets are nil after awakeFromNib call

2015-05-10 Thread Michael David Crawford
I don't know why they are nil, but in general it is quite helpful to
use assertions anywhere you could have made a coding error.

This is, rather than:

void foo: (char*)buf
{
// buf points to a valid C string
   ...
 }

use this:

void foo: (char*)buf
{
   assert( buf != NULL );
   ...
}


On 5/10/15, Sasikumar JP jps...@gmail.com wrote:
 Hi,

I am observing outlets are nil after the awakeFromNib call in my
 viewcontroller which is created from the storyboard.

 As per the apple documentation, awakeFromNib will be called after
 initialising all the objects  and outlets for a view controller from nib.

   i hope awakeFromNib is valid for storyboard too.

my application is crashing if i do any operation on the outlet var. I am
 using Xcode 6.3 with Swift.


 Regards
 Sasikumar JP
 ___

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

 This email sent to mdcrawf...@gmail.com


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Rotate a standard Cocoa control?

2015-05-07 Thread Michael David Crawford
Thanks!
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Thu, May 7, 2015 at 4:24 PM, Graham Cox graham@bigpond.com wrote:

 On 8 May 2015, at 9:04 am, Michael David Crawford mdcrawf...@gmail.com 
 wrote:

 Then draw the indicator with an image from a PNG


 I usually use PDF, because then you get scalable graphics without having to 
 worry about 2x, 3x screens and so on. Any slower performance is usually 
 unnoticeable for simple graphics. SVG should also work in theory but the 
 built-in support is limited (I don't think it's supported by NSImage, only 
 WebKit) and also somewhat incomplete. Stick with PDF, it's native.

 --Graham



___

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

Drawing many thin vertical lines is very slow

2015-05-07 Thread Michael David Crawford
My iOS app enables the user to toggle on and off a square grid.  When
the grid is enabled, a tap inside a cell toggles the color of the cell
between black and blue.  When the grid is disabled, one can use a
pinch-zoom gesture to adjust the sizes of the cells.

(I'm not so sure that's a sensible UI but that's not the problem I'm
looking into just now.)

If the pitch of the gride is fine, then there are many lines on the
screen.  If I autorotate, redrawing the vertical lines takes hundreds
of times as long as redrawing the horizontal lines.  That makes sense
as one can draw a horizontal line by incrementing a pointer into the
image buffer.  To draw a vertical line one has to draw a pixel, then
calculate the memory address of the next pixel vertically downwards.

I wonder if there is a better way to do this?  I'm using UIRectFill to
draw 1.0 point thick rectangles.  I thought of using CoreGraphics
directly but Instruments tells me that all the time is spent way down
in the innards of CG.

Before I draw the grid, I erase the whole view to blue, then draw
black rectangles for my cells.  A small optimization is that if two or
more cells are horizontal neighbors, I draw them in one UIRectFill
operation.

The vertical line drawing is so slow that it is disruptive to the user
when autorotating - the whole UI freezes for as long as two seconds,
looks distorted during that time then very quickly renders the desired
appearance.

One way would be to render a single vertical line into a tall, narrow
offscreen image buffer then copy that buffer into multiple locations
on the screen.

Another way would be for me to render the entire view in an offscreen
image buffer, which I expect I could do far more efficiently than by
making many calls into UIRectFill or even CoreGraphics.

I've done lots of direct memory pixel manipulations over the years,
that wouldn't be a problem for me to implement but before I do, do you
think it would be a good idea?

-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Rotate a standard Cocoa control?

2015-05-07 Thread Michael David Crawford
You could do what Apple's UIKit engineers do: implement your own
subclass of UIView, with your own drawing and hit testing.  Then you
could put your radio in a wooden cabinet, maybe model some of the warm
distortion that vacuum tubes yield
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Thu, May 7, 2015 at 1:36 PM, David Rowland rowla...@sbcglobal.net wrote:
 In iOS I have used the transform property of UIView to rotate a slider.

 David


 On May 7, 2015, at 1:11 PM, Jerry Krinock je...@ieee.org wrote:

 I would like to subclass NSSlider to make it work like the volume control 
 on a mid 19th-century radio receiver. That is, I want the minimum value to 
 be at 7 o'clock, and the maximum value to be at 5 o'clock.  There two issues 
 in using the circular version of NSSlider for this:

 1.  There is no dead zone between the minimum and maximum settings.  (What 
 were they thinking?)
 2.  The min and max settings are at the top, 12 o'clock.

 I've solved the first issue by overriding -closestTickMarkValueToValue:.  
 (Oh, I'm also using detents, allowsTickMarkValuesOnly = YES).

 I think I could solve the second issue with more complicated code in 
 -closestTickMarkValueToValue:, but I'd also need to remap the values somehow 
 and this might be a mess.  So I was wondering if instead there was an easy 
 way to rotate the control on the screen by, say 165 degrees.

 Am I correct that the answer is no?  Keep in mind that we're not just 
 drawing here; this is a control; we need mouse clicks, etc.

 Indeed, I'm not much of a drawing and graphics guy.
 ___

 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/rowlandd%40sbcglobal.net

 This email sent to rowla...@sbcglobal.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/mdcrawford%40gmail.com

 This email sent to mdcrawf...@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: Rotate a standard Cocoa control?

2015-05-07 Thread Michael David Crawford
If you draw your own control, it might help you to get started to make
a very rough drawing of the control, one with no moving parts but with
the areas of the control clearly delineated so you know where to do
your hit-testing.  Then draw your indicator with a black circle or
square.  Then draw the indicator with an image from a PNG.  At the
very end have a designer do nice graphics.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Thu, May 7, 2015 at 3:55 PM, Graham Cox graham@bigpond.com wrote:

 On 8 May 2015, at 6:11 am, Jerry Krinock je...@ieee.org wrote:

  a mid 19th-century radio receiver

 Really Jerry? Radio receivers weren't a thing until the 1920s!


 Am I correct that the answer is no?  Keep in mind that we're not just 
 drawing here; this is a control; we need mouse clicks, etc.

 Indeed, I'm not much of a drawing and graphics guy.

 I suggest it's time to break out the subclass. I suspect it's not going to be 
 a hugely difficult task. One thing I've found is a good approach to custom 
 controls is to draw the graphical parts separately (in a drawing app) and 
 just use them as an included resource. That way you don't get bogged down in 
 low level drawing code, it's easy to modify or customise and you can 
 concentrate your coding effort on the functioning of the control rather than 
 its appearance.

 I wouldn't be surprised if there is a 3rd-party solution out there for this 
 already.

 --Graham



 ___

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

 This email sent to mdcrawf...@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: static analyzers says I'm leaking, I _think_ I'm not

2015-05-06 Thread Michael David Crawford
I agree that it's inappropriate to expect that the analyzer will
assume that the getters and setters work the way they conventionally
do.  One reason we have properties is so that, when required, they can
do other things:

- (void) setAdversary: (int)enemy
{
_enemy = enemy;

[_enemy setUpTheBomb];
}


Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, May 6, 2015 at 2:54 PM, Ken Thomases k...@codeweavers.com wrote:
 On May 6, 2015, at 4:40 PM, Aaron Montgomery eey...@monsterworks.com wrote:

 If the property is set to retain, then the line

 self.cycler = [[[initWithGrid:self] autorelease]

 will cause the setter to retain the passed in object, so after this line, 
 _cycler will have a (heuristic) retain count of 2 (an alloc and a retain).

 After this, when the autorelease pool is drained, reducing the (heuristic) 
 retain count by 1: you've still got a hold of it in the property.

 Then in dealloc, you release the object in dealloc to reduce the (heuristic) 
 retain count to 0.

 Or, in other words, sending an object -autorelease is just like sending it a 
 -release only the effect is delayed.

 A combined alloc/init/autorelease balances itself.  A strong (or retain) 
 property will be balanced if the setter is written properly (which a 
 synthesized setter will be) and you release in -dealloc.

 To release the object, you can use

 [_cycler release];

 or

 self.cycler = nil;

 Better to use the former in case the setter (in this class or a subclass) 
 does extra work that wouldn't be appropriate during deallocation.

 or you may be able to not even bother if you won't create a cycle, I haven't 
 done manual memory in a while, but I think retained properties are released 
 at destruction automatically.

 No, in manual retain-release, nothing is released automatically.  In 
 -dealloc, you have to explicitly release the objects you own.

 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

static analyzers says I'm leaking, I _think_ I'm not

2015-05-06 Thread Michael David Crawford
I've had problems in the past where I failed to understand the Cocoa
ownership conventions, I'm willing to grant that could be the case.

I know for sure that the analyzer enforces the naming conventions,
that is, the exact same function names in C or C++ won't yield that
same warnings as alloc, new or copy would in Objective-C.

I'm reluctant to use ARC because in my honest opinion, ARC will get
the leaks and most out of the crashes out of skanky code.  If you
don't use ARC, you get them out by fixing the skank:

  Dave, why do you add twelve extra bytes to all of Spellswell's allocations?

  That was so Spellswell would stop crashing.  Facepalm.

// LifeGrid.h
@property (assign, nonatomic) GridCycler *cycler;

// Lifegrid.m - init
 self.cycler = [[GridCycler alloc] initWithGrid: self];  // Potential
leak of an object
 if ( nil == self.cycler ) goto cycler_failed;

// dealloc
[self.cycler release];

Expanding the potential leak message yields:

1. assuming 'self' is not nil

2. method returns Objective-C object with +1 retain count

3. Object leaked: allocated object is not references later in this
execution path and has a retain count of +1.

Isn't that what I want?  I should be taking ownership of it with
alloc/initWithGrid.

(initWithGrid doesn't do a cyclic retain.)

Thanks,

Mike

Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: static analyzers says I'm leaking, I _think_ I'm not

2015-05-06 Thread Michael David Crawford
John McCall wrote:

 You should probably make the property readonly and just directly assign to 
 the ivar in -init.

That works.

In this particular case, it might make more sense for my property to
be just a regular ivar, without a getter and setter.  That is, my grid
object owns a cycler object, client code turns the cycler on and off,
adjusts its speed and so on.  My code might be easier to maintain if
the grid exposed an interface to do all that.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, May 6, 2015 at 2:21 PM, John McCall rjmcc...@apple.com wrote:
 On May 6, 2015, at 1:57 PM, Michael David Crawford mdcrawf...@gmail.com 
 wrote:
 I've had problems in the past where I failed to understand the Cocoa
 ownership conventions, I'm willing to grant that could be the case.

 I know for sure that the analyzer enforces the naming conventions,
 that is, the exact same function names in C or C++ won't yield that
 same warnings as alloc, new or copy would in Objective-C.

 I'm reluctant to use ARC because in my honest opinion, ARC will get
 the leaks and most out of the crashes out of skanky code.  If you
 don't use ARC, you get them out by fixing the skank:

  Dave, why do you add twelve extra bytes to all of Spellswell's 
 allocations?

  That was so Spellswell would stop crashing.  Facepalm.

 // LifeGrid.h
 @property (assign, nonatomic) GridCycler *cycler;

 // Lifegrid.m - init
 self.cycler = [[GridCycler alloc] initWithGrid: self];  // Potential
 leak of an object
 if ( nil == self.cycler ) goto cycler_failed;

 // dealloc
 [self.cycler release];

 Expanding the potential leak message yields:

 1. assuming 'self' is not nil

 2. method returns Objective-C object with +1 retain count

 3. Object leaked: allocated object is not references later in this
 execution path and has a retain count of +1.

 Isn't that what I want?  I should be taking ownership of it with
 alloc/initWithGrid.

 (initWithGrid doesn't do a cyclic retain.)

 cycler is really a strong property (because you release its value in 
 -dealloc), but you've declared it as assign, which means the synthesized 
 setter won't retain the new value or release the old value.  One way of 
 looking at this is that the setter takes its argument at +1 and has a 
 precondition that the property is currently set to nil.  Another way of 
 looking at it is that the setter is buggy.

 You should probably make the property readonly and just directly assign to 
 the ivar in -init.

 John.

___

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: static analyzers says I'm leaking, I _think_ I'm not

2015-05-06 Thread Michael David Crawford
This is 6.2.  I speculated a different diagnostic was a bug; were it
correct, I would have seen that same diagnostic on some other code.

I'll file a radar with a minimal test case if you'd like me to.

I'll download 6.3.1 right now.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, May 6, 2015 at 2:12 PM, Greg Parker gpar...@apple.com wrote:

 On May 6, 2015, at 1:57 PM, Michael David Crawford mdcrawf...@gmail.com 
 wrote:

 // LifeGrid.h
 @property (assign, nonatomic) GridCycler *cycler;

 // Lifegrid.m - init
 self.cycler = [[GridCycler alloc] initWithGrid: self];  // Potential
 leak of an object
 if ( nil == self.cycler ) goto cycler_failed;

 // dealloc
 [self.cycler release];

 Expanding the potential leak message yields:

 1. assuming 'self' is not nil

 2. method returns Objective-C object with +1 retain count

 3. Object leaked: allocated object is not references later in this
 execution path and has a retain count of +1.

 Isn't that what I want?  I should be taking ownership of it with
 alloc/initWithGrid.

 (initWithGrid doesn't do a cyclic retain.)

 Which version of Xcode are you using? The static analyzer in Xcode 6.3 has 
 several bugs in retain count analysis and not all of them are fixed in Xcode 
 6.3.1.


 --
 Greg Parker gpar...@apple.com Runtime Wrangler


___

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

malloc(0) returns a pointer, not NULL

2015-05-05 Thread Michael David Crawford
This came as news to me.

The C spec says this is implementation-definited; malloc(0 may return
either NULL or it may return a pointer that can subsequently be passed
to free().

In the case of the bug I'm looking at just now, it's an error in my
code, so I now have:

assert( 0 != bytes );
ptr = malloc( bytes );

Just thought you'd like to know,

Mike
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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

-[NSMutableSet randomObject]

2010-05-25 Thread Michael A. Crawford
I'd like to extend Apple implementation of NSMutableSet to include a 
randomObject method.  The purpose of this method is self-explanatory and its 
potential use is I'm sure obvious to most of you.

For my first idea I thought about simply adding a category to NSMutableSet but 
any obvious implementation of -randomObject would require accessing existing 
instance variables or adding my own in order to implement the random access I 
would need to for the set.  I also don't know how objects are stored 
internally.  Is it an array?  Is it a key/value pair? I don't know.  How am I 
going to correlate the random numbers I generate with the objects in the set?

Next, I thought about using inheritance with NSMutableArray.  I even wrote some 
code:

+ (void)initialize
{
if ( self == [MCRandomlyAccessedArray class] )
{
srandom(time(NULL));
}
}

- (id)randomObject
{
// If the array is empty, throw an exception.  The caller should know 
better.
// If there is only one, return object zero every time.
// If there are only two, alternate with every access.
// If there are three or more, randomize but never provide the same object
// twice in a row.
if ( [self count] )
{
NSUInteger index = 0;

if ( [self count]  1 )
{
if ( 2 == [self count] )
{
index = (++lastObjectIndex % 2);
}
else
{
do
{
index = (random() % [self count]);
} while (index == lastObjectIndex);
}
lastObjectIndex = index;
}
return [self objectAtIndex:index];
}
else
{
[[NSException exceptionWithName:NSRangeException
 reason:@Array is empty
   userInfo:nil] raise];
}
return nil; // unreachable
}

Come to find out at runtime that this won't work either because NSMutableArray 
is abstract!

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[NSMutableArray addObject:]: method only defined for abstract 
class.  Define -[MCRandomlyAccessedArray addObject:]!'

This would seem to indicate that I need to write a lot more code in order to 
have a complete implementation.  I'm not in the mood to re-invent the wheel.  
I'm not lazy, I just have a lot of other code that needs to be written, which 
pertains to the big picture.

Next, I thought maybe I could simply wrap-up an NSMutableArray in my own class 
and let it do most of the heavy lifting when it comes to all of those existing 
methods.  The only problem is that I'm no expert on how to duplicate all of the 
class and instance init methods and memory management code.

So, that brings me to you lovely people.  What do you recommend?  Do I bite the 
bullet and re-implement NSMutableArray?  If so, where can I find guidance on 
this?  I love the containers provided by Apple.  They simply work and I don't 
have to think about them.  So much so, that I don't really know how they work.  
My expertise is/was in C/C++ and STL.

Is there fourth alternative or something I missed in my brief examination as 
described above?

Thanks.

-Michael
___

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: -[NSMutableSet randomObject]

2010-05-25 Thread Michael A. Crawford
Hey, not bad.  Does the -allObjects method always return the same sequence?  
Did you just cobble this up or is this running in a system somewhere?  It 
doesn't do everything I want but it is definitely the better part of the 80/20 
rule.

-Michael

On May 25, 2010, at 12:52 PM, Dave DeLong wrote:

 What about something like:
 
 @implementation NSSet (Random)
 
 - (id) randomObject {
  NSArray * allObjects = [self allObjects];
  if ([allObjects count] == 0) { @throw ...; }
  return [allObjects objectAtIndex:(arc4random() % [allObjects count])];
 }
 
 @end
 
 On May 25, 2010, at 10:49 AM, Michael A. Crawford wrote:
 
 I'd like to extend Apple implementation of NSMutableSet to include a 
 randomObject method.  The purpose of this method is self-explanatory and its 
 potential use is I'm sure obvious to most of you.
 
 For my first idea I thought about simply adding a category to NSMutableSet 
 but any obvious implementation of -randomObject would require accessing 
 existing instance variables or adding my own in order to implement the 
 random access I would need to for the set.  I also don't know how objects 
 are stored internally.  Is it an array?  Is it a key/value pair? I don't 
 know.  How am I going to correlate the random numbers I generate with the 
 objects in the set?
 
 Next, I thought about using inheritance with NSMutableArray.  I even wrote 
 some code:
 
 + (void)initialize
 {
   if ( self == [MCRandomlyAccessedArray class] )
   {
   srandom(time(NULL));
   }
 }
 
 - (id)randomObject
 {
   // If the array is empty, throw an exception.  The caller should know 
 better.
   // If there is only one, return object zero every time.
   // If there are only two, alternate with every access.
   // If there are three or more, randomize but never provide the same object
   // twice in a row.
   if ( [self count] )
   {
   NSUInteger index = 0;
 
   if ( [self count]  1 )
   {
   if ( 2 == [self count] )
   {
   index = (++lastObjectIndex % 2);
   }
   else
   {
   do
   {
   index = (random() % [self count]);
   } while (index == lastObjectIndex);
   }
   lastObjectIndex = index;
   }
   return [self objectAtIndex:index];
   }
   else
   {
   [[NSException exceptionWithName:NSRangeException
reason:@Array is empty
  userInfo:nil] raise];
   }
   return nil; // unreachable
 }
 
 Come to find out at runtime that this won't work either because 
 NSMutableArray is abstract!
 
 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
 reason: '*** -[NSMutableArray addObject:]: method only defined for abstract 
 class.  Define -[MCRandomlyAccessedArray addObject:]!'
 
 This would seem to indicate that I need to write a lot more code in order to 
 have a complete implementation.  I'm not in the mood to re-invent the wheel. 
  I'm not lazy, I just have a lot of other code that needs to be written, 
 which pertains to the big picture.
 
 Next, I thought maybe I could simply wrap-up an NSMutableArray in my own 
 class and let it do most of the heavy lifting when it comes to all of those 
 existing methods.  The only problem is that I'm no expert on how to 
 duplicate all of the class and instance init methods and memory management 
 code.
 
 So, that brings me to you lovely people.  What do you recommend?  Do I bite 
 the bullet and re-implement NSMutableArray?  If so, where can I find 
 guidance on this?  I love the containers provided by Apple.  They simply 
 work and I don't have to think about them.  So much so, that I don't really 
 know how they work.  My expertise is/was in C/C++ and STL.
 
 Is there fourth alternative or something I missed in my brief examination as 
 described above?
 
 Thanks.
 
 -Michael
 ___
 
 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/michaelacrawford%40me.com
 
 This email sent to michaelacrawf...@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

Are there any tools or techniques for detecting / debugging retain-cycles?

2010-05-05 Thread Michael A. Crawford
-Michael
___

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


Is there a better way to delete all objects in a MOC persistent store?

2010-04-30 Thread Michael A. Crawford
Or, am I forced to iterate through the results of a fetch calling deleteObject 
for each object found?

-Michael
___

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: iPhone Programming For OS X Coders?

2010-04-19 Thread Michael A. Crawford
Sorry for chiming in late, Jens.  Been busy.

I like Cocoa Touch for iPhone OS 3 by  Jiva Devoe and The iPhone Developer's 
Cookbook by Erica Sadun.  Both focus specifically on UIKit elements with very 
little overlap to the desktop.  Exceptions are CoreData and 
NSURLConnect/NSURLRequest.  Still there are enough differences with CoreData 
and memory management that the overlap is warranted.

Both of these are excellent references and short tutorials for how to use 
views, controllers, navigation, touch-event processing, and UI* controls in 
iPhone OS.  No need to read through front to back, simply turn to the specific 
topic you are interested in implementing and you get pretty much what you need 
in just a page or two.

Of course you can save some cash by simply reading Apple's excellent on-line 
docs for UIKit and Cocoa-Touch.

-Michael

On Apr 7, 2010, at 12:49 AM, Kyle Sluder wrote:

 On Tue, Apr 6, 2010 at 9:42 PM, Philip Mobley p...@dreystone.com wrote:
 iPhone 3.2 SDK just added UIBezierPath, but the 3.2 OS will only run on iPad 
 right now.  Who knows if the iPhone will ever run 3.2 OS or if they will 
 just wait until 4.0.
 
 I imagine we'll find out on Thursday.
 
 --Kyle Sluder
 ___
 
 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/michaelacrawford%40me.com
 
 This email sent to michaelacrawf...@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/archive%40mail-archive.com

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


How do I compare two NSDates using NSPredicate Core Data

2010-04-04 Thread Michael A. Crawford
Thus far I've gotten away with using -predicateWithFormat and scalar values.  I 
now need to compare a couple of NSDate instances but am not sure how to code it 
up with NSPredicate.  Consider me a 'visual' learner.

-Michael
___

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


Need help with scrolling marquee

2010-03-11 Thread Michael A. Crawford
I'm trying to create an effect on the iPhone to scroll text across the view in 
a given location.  Not really sure how to go about it so I did some 
experimenting.  Af first I tried to animate the scroll using a timer.  That 
gave me inconsistent movement; the velocity of the scrolling text appeared to 
be non-constant.  Then I remembered that CoreAnimation is really supposed to 
take care of this kind of animation for you so I switch to trying to get it to 
manage the timing for me.  I must be doing it all wrong because I cannot 
control the velocity of the scrolling text.

I expect my whole approach is probably wrong and am hoping that one of you has 
a better approach or suggestions as to how to fix it.  I haven't found much in 
the way of CAScrollView documentation or examples to help.  I've included the 
code below.  Hopefully the length will not be an issue.

//
//  ScrollingMarqueeViewController.m
//  ScrollingMarquee
//
//  Created by Michael A. Crawford on 3/11/10.
//  Copyright Crawford Design Engineering, LLC 2010. All rights reserved.
//

#import QuartzCore/QuartzCore.h

#import ScrollingMarqueeViewController.h

@implementation ScrollingMarqueeViewController

@synthesize scrollLabel;

- (CALayer*)textLayer
{
scrollLabel.text = @this is a long line of text that should be too long 
for 
@the screen width of this label.;
return scrollLabel.layer;
}

- (CAScrollLayer*)scrollLayer
{
CAScrollLayer* layer = [CAScrollLayer layer];
[layer addSublayer:[self textLayer]];
return layer;
}

- (void)timerFireMethod:(NSTimer*)theTimer
{
#if 0
// Here I was using a periodic timer to animate the scroll.  I noticed that
// the animation wasn't smooth and then remembered that CA is supposed to do
// the animating for me.  So, I switched to trying the code below but that
// doesn't work either.  I'm really just grasping at straws here.
static CGPoint origin = {0.0f, 0.0f};
origin.x += 5.0f;
[scrollLayer scrollToPoint:origin];
#else
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationDuration:5.0];
[scrollLayer scrollToPoint:CGPointMake(320.0f, 0.0f)];
[UIView commitAnimations];
#endif
}

- (void)viewDidLoad
{
[super viewDidLoad];

// create the scroll layer and add it to our view
scrollLayer = [self scrollLayer];
[self.view.layer addSublayer:scrollLayer];

// make it the same size as our label
scrollLayer.bounds = scrollLabel.frame;

// position it in the middle of the view
scrollLayer.position = CGPointMake(320.0f * 0.5f, 480.0f * 0.5f);

// scroll the text horizontally
scrollLayer.scrollMode = kCAScrollHorizontally;

// use a timer to make the scroll happen
scrollTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
   target:self
 
selector:@selector(timerFireMethod:)
 userInfo:nil
  repeats:/*YES*/NO];
}

@end

___

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: Need help with scrolling marquee

2010-03-11 Thread Michael A. Crawford
Thanks, Graham, I realized the timer would have jitter.  When I realized what 
was going on and began to think about how to fix it, that is when I had one of 
those head-slap moments where I asked, Why am I not using CoreAnimation for 
this?

-Michael

On Mar 11, 2010, at 4:53 PM, Graham Cox wrote:

 
 On 12/03/2010, at 5:23 AM, Michael A. Crawford wrote:
 
 - (void)timerFireMethod:(NSTimer*)theTimer
 {
 #if 0
   // Here I was using a periodic timer to animate the scroll.  I noticed that
   // the animation wasn't smooth and then remembered that CA is supposed to 
 do
   // the animating for me.  So, I switched to trying the code below but that
   // doesn't work either.  I'm really just grasping at straws here.
   static CGPoint origin = {0.0f, 0.0f};
   origin.x += 5.0f;
   [scrollLayer scrollToPoint:origin];
 #else
 
 
 Hi Michael,
 
 This is a classic naive mistake. You're incrementing the position by a 
 fixed amount each time the timer fires. Problem is, you can't guarantee that 
 the timer will fire exactly at the time it should, so your scrolling speed is 
 at the mercy of how busy things are, so will speed up and slow down.
 
 Recall that speed is distance/time, so if you want a constant speed, you have 
 to work out how much distance the thing should have moved in the actual time 
 interval you got.
 
 Roughly (typed into mail):
 
 - (void)  timerFireMethod:(NSTimer*) theTimer
 {
NSTimeInterval elapsedTime = [NSDate timeIntervalSinceReferenceDate] - 
 m_startTime; // m_startTime ivar set when the animation began
CGFloat distance = m_speed * elapsedTime;  // m_speed is the scrolling 
 speed in points per second
 
[thing setPosition:distance];
 }
 
 With this approach, the exact timing intervals don't matter - the position 
 will be correct. If things get busy what will happen is that the jumps 
 between positions will get a bit larger.
 
 That said, Core Animation might do the job better, but I just wanted to point 
 out what the problem was with your original approach.
 
 --Graham
 
 

___

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: Need help with scrolling marquee

2010-03-11 Thread Michael A. Crawford
I played with the truncation property but to make that work you have to 
continually modify the length of the string.  I want to write the string to the 
buffer once and then have CA scroll it for me at a constant speed I can set.  
This is where I'm looking for assistance.

-Michael

On Mar 11, 2010, at 4:58 PM, Eric E. Dolecki wrote:

 Isn't there a truncation property that handles this for a UILabel?
 
 On Thu, Mar 11, 2010 at 4:53 PM, Graham Cox graham@bigpond.com wrote:
 
 On 12/03/2010, at 5:23 AM, Michael A. Crawford wrote:
 
  - (void)timerFireMethod:(NSTimer*)theTimer
  {
  #if 0
 // Here I was using a periodic timer to animate the scroll.  I noticed 
  that
 // the animation wasn't smooth and then remembered that CA is supposed 
  to do
 // the animating for me.  So, I switched to trying the code below but 
  that
 // doesn't work either.  I'm really just grasping at straws here.
 static CGPoint origin = {0.0f, 0.0f};
 origin.x += 5.0f;
 [scrollLayer scrollToPoint:origin];
  #else
 
 
 Hi Michael,
 
 This is a classic naive mistake. You're incrementing the position by a 
 fixed amount each time the timer fires. Problem is, you can't guarantee that 
 the timer will fire exactly at the time it should, so your scrolling speed is 
 at the mercy of how busy things are, so will speed up and slow down.
 
 Recall that speed is distance/time, so if you want a constant speed, you have 
 to work out how much distance the thing should have moved in the actual time 
 interval you got.
 
 Roughly (typed into mail):
 
 - (void)timerFireMethod:(NSTimer*) theTimer
 {
NSTimeInterval elapsedTime = [NSDate timeIntervalSinceReferenceDate] - 
 m_startTime; // m_startTime ivar set when the animation began
CGFloat distance = m_speed * elapsedTime;  // m_speed is the scrolling 
 speed in points per second
 
[thing setPosition:distance];
 }
 
 With this approach, the exact timing intervals don't matter - the position 
 will be correct. If things get busy what will happen is that the jumps 
 between positions will get a bit larger.
 
 That said, Core Animation might do the job better, but I just wanted to point 
 out what the problem was with your original approach.
 
 --Graham
 
 
 ___
 
 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/edolecki%40gmail.com
 
 This email sent to edole...@gmail.com
 
 
 
 -- 
 http://ericd.net
 Interactive design and development

___

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


Need to duplicate the look feel of the upper-left traffic-lights on a borderless window app

2010-02-24 Thread Michael A. Crawford
I'm creating an app where the client wants to have rounded corners and other 
oddities on the main window.  Therefore I'm thinking I need the main window to 
be borderless.  Unfortunately I also lose the standard look and behavior that 
the red-yellow-green gumdrop buttons, in the upper-left corner of every 
Mac-app, provide.

I typically refer to these as the horizontal traffic lights, for obvious 
reasons.  Early tests confirm that if I turn of the window border, I lose these 
elements.  So, I need to add them back in and am not sure where to start.

Anyone have any ideas or code that will help me duplicate this standard app 
interface and its behavior as part of my app's main window?

-Michael
___

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


Looking for info on anti-piracy and trial-mode techniques for my app . . .

2010-02-24 Thread Michael A. Crawford
I've purchased apps from other developers on this forum, which have mechanisms 
for limiting functionality until a valid registration code has been provided.  
I'd like to include this functionality in my own app but don't want to create 
it from scratch if I don't have to.  To that end, I'm looking for existing 
libraries, techniques, blogs, and/or suggestions.

Thanks.

-Michael
___

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: Looking for info on anti-piracy and trial-mode techniques for my app . . .

2010-02-24 Thread Michael A. Crawford
Thanks, Sherm.  I'm not a fan either.  This is a client request.

-Michael

On Feb 24, 2010, at 5:00 PM, Sherm Pendley wrote:

 On Wed, Feb 24, 2010 at 4:54 PM, Michael A. Crawford
 michaelacrawf...@me.com wrote:
 I've purchased apps from other developers on this forum, which have 
 mechanisms for limiting functionality until a valid registration code has 
 been provided.  I'd like to include this functionality in my own app but 
 don't want to create it from scratch if I don't have to.  To that end, I'm 
 looking for existing libraries, techniques, blogs, and/or suggestions.
 
 Not a big fan of such things myself, but to each his own... That said,
 I've heard good things about Aquatic Prime:
 
http://github.com/bdrister/AquaticPrime
 
 sherm--
 
 -- 
 Cocoa programming in Perl:
 http://www.camelbones.org

___

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: Looking for info on anti-piracy and trial-mode techniques for my app . . .

2010-02-24 Thread Michael A. Crawford
Thanks for the pointer to the more appropriate group.  I'll go check it out.

-Michael

On Feb 24, 2010, at 5:37 PM, jonat...@mugginsoft.com wrote:

 
 
 Not really a Cocoa question...  Don't know where else you'd ask it though.
 
 The macsb group has this topic discussed to death.
 
 http://tech.groups.yahoo.com/group/macsb/
 
 IMHO all code is mutable.
 
 Regards
 
 Jonathan Mitchell
 
 Developer
 http://www.mugginsoft.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/michaelacrawford%40me.com
 
 This email sent to michaelacrawf...@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/archive%40mail-archive.com

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


Re: Looking for info on anti-piracy and trial-mode techniques for my app . . .

2010-02-24 Thread Michael A. Crawford
Jeez, Paul, thanks for the thorough answer.  I'm not new to public/private key 
encryption or digital sigs, I was just hoping not to have to do it myself.  Due 
to the extra time involved.  Still, if this is what the client wants, I'm 
obliged to get it done.

Part of your response suggests that if there was an existing framework that was 
openly available, it wouldn't do me any good because the bad guys would have 
the source code.  I don't know if that is your thinking but this thought had 
occurred to me before I posted the question.  I firmly believe that security 
through obscurity is no security at all.

Well, if I proceed, I will definitely make use of all of your ideas.

-Michael

On Feb 24, 2010, at 5:23 PM, Paul Sanders wrote:

 I rolled my own.  I was not about to put all that effort into developing the 
 app and have someone steal my work from under my nose.
  
 For validating the license key, I would recommend some form of digital 
 signature rather than just a simple checksum.  I used a checksum first time 
 around and it was quickly hacked.  My current scheme also ties the key to the 
 machine it's installed on so that it can't be handed around, but it's 
 probably sufficient to prominently display the customer's name and email 
 address on startup and make it such that a key cannot be forged.
  
 The other thing you have to do is to find some way to stop the hackers from 
 patching your app to bypass the check.  Again, I use a DIY form of code 
 signature to protect the app as a whole and I then check that the signature 
 is valid from here, there and everywhere at run time to make it difficult for 
 the hackers to patch the code in just one place.  There are still probably 
 weak spots but my software is not exactly expensive so I think it's adequate.
  
 I originally used codesign to validate the integrity of the application but I 
 ran into some problems with it.  Something (I have never figured out quite 
 what) occasionally adds or changes a file in my bundle after it has been 
 installed, thus rendering the code signature invalid.  So I switched to my 
 own scheme where I calculate a digital signature for the critical files that 
 make up the app and store that in a separate file which I can check at 
 runtime.  Again, this signature cannot be forged.
  
 If you're hazy about the concepts behind public / private key encryption and 
 digital signatures, this might help (I have never been known for my modesty :)
  
 http://www.codeproject.com/KB/security/EZRSA.aspx
  
 As might be apparent, I have put quite a lot of work into this, but I don't 
 have anything in a form that can be packaged up and given away.  Nor do I 
 want to do that, in fact, but I hope this at least gives you some ideas.
  
 Not really a Cocoa question...  Don't know where else you'd ask it though.
  
 Paul Sanders.
 http://www.alpinesoft.co.uk
  
 - Original Message -
 From: Michael A. Crawford michaelacrawf...@me.com
 To: Cocoa-dev@lists.apple.com
 Sent: Wednesday, February 24, 2010 9:54 PM
 Subject: Looking for info on anti-piracy and trial-mode techniques for my app 
 . . .
 
 I've purchased apps from other developers on this forum, which have 
 mechanisms for limiting functionality until a valid registration code has 
 been provided.  I'd like to include this functionality in my own app but 
 don't want to create it from scratch if I don't have to.  To that end, I'm 
 looking for existing libraries, techniques, blogs, and/or suggestions.
 
 Thanks.
 
 -Michael

___

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


Copying CLHeading objects does not appear to work . . .

2010-02-11 Thread Michael A. Crawford
Here is the code (pertinent snippets)

@interface BlueSLRGPS ()
@property (copy) CLHeading* currentHeading;
@property (copy) CLLocation* currentLocation;
@property (retain) CLLocation* previousLocation;

- (NSString*)compassPointForHeading:(double)heading;

- (void)locationManager:(CLLocationManager*)manager
   didUpdateHeading:(CLHeading*)newHeading;

- (void)locationManager:(CLLocationManager*)manager
didUpdateToLocation:(CLLocation*)newLocation
   fromLocation:(CLLocation*)oldLocation;

- (void)locationManager:(CLLocationManager*)manager
   didFailWithError:(NSError*)error;
@end

@synthesize currentHeading;

- (void)locationManager:(CLLocationManager*)manager
   didUpdateHeading:(CLHeading*)newHeading
{
MCLog(@heading update isMainThread = %d, [NSThread isMainThread]);
MCLog(@Heading: %f, newHeading.magneticHeading);
self.currentHeading = newHeading;
[self.delegate headingUpdated];
}

Here is the result.

(gdb) p newHeading
$1 = (CLHeading *) 0x481ef50
(gdb) p currentHeading
$2 = (CLHeading *) 0x3c193c0
(gdb) po (CLHeading*)0x481ef50
magneticHeading 211.00 trueHeading 205.17 accuracy 35.00 x 2.625 y -6.875 z 
-18.250 @ 2010-02-11 11:18:29 AM
(gdb) po (CLHeading*)0x3c193c0
magneticHeading 0.00 trueHeading 0.00 accuracy 0.00 x 0.000 y 0.000 z 0.000 @ 
(null)

I didn't see anything in the docs about CLHeading objects not being copyable.  
Any ideas as to why the copy did not duplicate the current values?

-Michael

___

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: Copying CLHeading objects does not appear to work . . .

2010-02-11 Thread Michael A. Crawford
It the copy failing because these are read-only properties?

-Michael

On Feb 11, 2010, at 11:29 AM, Michael A. Crawford wrote:

 Here is the code (pertinent snippets)
 
 @interface BlueSLRGPS ()
 @property (copy) CLHeading* currentHeading;
 @property (copy) CLLocation* currentLocation;
 @property (retain) CLLocation* previousLocation;
 
 - (NSString*)compassPointForHeading:(double)heading;
 
 - (void)locationManager:(CLLocationManager*)manager
   didUpdateHeading:(CLHeading*)newHeading;
 
 - (void)locationManager:(CLLocationManager*)manager
   didUpdateToLocation:(CLLocation*)newLocation
  fromLocation:(CLLocation*)oldLocation;
 
 - (void)locationManager:(CLLocationManager*)manager
  didFailWithError:(NSError*)error;
 @end
 
 @synthesize currentHeading;
 
 - (void)locationManager:(CLLocationManager*)manager
   didUpdateHeading:(CLHeading*)newHeading
 {
MCLog(@heading update isMainThread = %d, [NSThread isMainThread]);
MCLog(@Heading: %f, newHeading.magneticHeading);
self.currentHeading = newHeading;
[self.delegate headingUpdated];
 }
 
 Here is the result.
 
 (gdb) p newHeading
 $1 = (CLHeading *) 0x481ef50
 (gdb) p currentHeading
 $2 = (CLHeading *) 0x3c193c0
 (gdb) po (CLHeading*)0x481ef50
 magneticHeading 211.00 trueHeading 205.17 accuracy 35.00 x 2.625 y -6.875 z 
 -18.250 @ 2010-02-11 11:18:29 AM
 (gdb) po (CLHeading*)0x3c193c0
 magneticHeading 0.00 trueHeading 0.00 accuracy 0.00 x 0.000 y 0.000 z 0.000 @ 
 (null)
 
 I didn't see anything in the docs about CLHeading objects not being copyable. 
  Any ideas as to why the copy did not duplicate the current values?
 
 -Michael
 
 ___
 
 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/michaelacrawford%40me.com
 
 This email sent to michaelacrawf...@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/archive%40mail-archive.com

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


How can I populate certain table-columns with image cells while using NSArrayController?

2010-01-15 Thread Michael A. Crawford
Consider an NSTableView instance populated with data from an NSArrayController, 
which is bound to a content array containing instances of class foo.  All of 
class foo's properties return BOOL and NSString values.  The two BOOL values 
need to be shown in the table using icon images.

Should the images be properties of class foo, which are bound by the 
array-controller, in order for them to show up in the table?

Normally, when not using NSArrayController, I would make my controller the 
data-source for the table.  When the 
-[tableView:objectValueForTableColumn:row:] method is called for the BOOL 
columns, I would return an NSImageCell.  I was assuming that I cannot do this 
while using bindings and the NSArrayController.  However, when I coded it up, I 
got the callbacks even though the table was bound to the array-controller

Is this the correct way to do this?  I'm worried that using both the DataSource 
callbacks and bindings to an array-controller might not be what Apple had in 
mind and will lead to unforeseen issues.

Is there a better way?

-Michael
___

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 can I populate certain table-columns with image cells while using NSArrayController?

2010-01-15 Thread Michael A. Crawford
Thank you for the article.

-Michael

On Jan 15, 2010, at 12:54 PM, Arun wrote:

 You can find a beautiful article on the same @ 
 http://www.martinkahr.com/2007/05/04/nscell-image-and-text-sample/
 
 HTH
 -Arun KA
 
 On Fri, Jan 15, 2010 at 11:20 PM, Michael A. Crawford 
 michaelacrawf...@me.com wrote:
 Consider an NSTableView instance populated with data from an 
 NSArrayController, which is bound to a content array containing instances of 
 class foo.  All of class foo's properties return BOOL and NSString values.  
 The two BOOL values need to be shown in the table using icon images.
 
 Should the images be properties of class foo, which are bound by the 
 array-controller, in order for them to show up in the table?
 
 Normally, when not using NSArrayController, I would make my controller the 
 data-source for the table.  When the 
 -[tableView:objectValueForTableColumn:row:] method is called for the BOOL 
 columns, I would return an NSImageCell.  I was assuming that I cannot do this 
 while using bindings and the NSArrayController.  However, when I coded it up, 
 I got the callbacks even though the table was bound to the array-controller
 
 Is this the correct way to do this?  I'm worried that using both the 
 DataSource callbacks and bindings to an array-controller might not be what 
 Apple had in mind and will lead to unforeseen issues.
 
 Is there a better way?
 
 -Michael
 ___
 
 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/arun.ka%40gmail.com
 
 This email sent to arun...@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


Need some help with custom views . . .

2010-01-10 Thread Michael A. Crawford
I'm trying to create come custom views with attributes exhibited in this screen 
shot snippet:

files.me.com/michaelacrawford/iy4bhj

I'm looking for suggestions on how I might accomplish some of these effects.  
Here are some ideas I've come up with on my own, some of which I have already 
tried and failed with.  I'd like feedback as to whether or not you think my 
approach will work.

First of all, I'm pretty sure I will need layer back views in order to get the 
clipping (or lack thereof) I want, as well as the shadow effect for the buttons.

For the rounded corners on the app window, I was thinking of creating a 
borderless window and then using cornerRadius property of the layer-backed 
content-view of my main window.

This will require me to provide a replacement for the traffic-light buttons 
that are usually in the upper-left corner along with their standard 
window-manager behaviors, since borderless windows do not sport these elements.

In experiments I've performed thus far, the custom bitmap that provides the 
hatch pattern along the bottom of the view obscures the little diagonal lines 
indicating that the window can be resized by click-dragging the lower-right 
corner.  I will have to draw those lines myself.

As for the hatch pattern, an alternative to using the bitmap image would be for 
me to draw the hatch pattern along with the colors myself.  This way, as the 
main window is resized, the pattern is redrawn as needed.  Currently, I'm using 
NSDrawThreePartImage to get the repeating patter to stretch when the main 
windows is resized.

My first experiment with the big round button has failed in that it is being 
clipped both on the top and the bottom.  On the bottom it is being clipped by 
the app window.  I wasn't too worried about that because I have not yet written 
the code for the borderless window.  The top of the button crosses over the 
upper border of the super-view and is being clipped.  This surprised me as I 
have layer backed views turned on for the button, its super-view, and the view 
containing the button and its super-view.

For the custom views involved I'm setting the masksToBounds property to NO.  
What else do I need to do in order to display clipping by the super-view's 
bounding rectangle?

-Michael
___

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


Looking tutorials or blogs on NSOutlineView NSTreeController . . .

2010-01-06 Thread Michael A. Crawford
Never used this view/control before.  I'm looking for resources to help me 
shorten the curve, especially when used with the NSTreeController.  I'm also 
considering switching my model to CoreData.  Currently I have some code working 
that uses neither CoreData nor NSTreeController and I wondering if I should 
stick with it or switch.

I have Googled but I'm not getting good hits on tutorials or extended 
discussions on how to use these tools.  Perhaps some of you have authored 
books, articles, or pages that are just what I'm looking for.  Or, you at least 
know of some good resources I can consult.

I basically want to duplicate the outline-view interface and behavior for 
something like iTunes.  Groups or collections selected on the left, content 
available in tables in the remainder of the view to the right.

Thanks.

-Michael
___

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: Looking tutorials or blogs on NSOutlineView NSTreeController . . .

2010-01-06 Thread Michael A. Crawford
Thanks for the pointers (Ken  Rob).

-Michael

On Jan 6, 2010, at 5:52 PM, Michael A. Crawford wrote:

 Never used this view/control before.  I'm looking for resources to help me 
 shorten the curve, especially when used with the NSTreeController.  I'm also 
 considering switching my model to CoreData.  Currently I have some code 
 working that uses neither CoreData nor NSTreeController and I wondering if I 
 should stick with it or switch.
 
 I have Googled but I'm not getting good hits on tutorials or extended 
 discussions on how to use these tools.  Perhaps some of you have authored 
 books, articles, or pages that are just what I'm looking for.  Or, you at 
 least know of some good resources I can consult.
 
 I basically want to duplicate the outline-view interface and behavior for 
 something like iTunes.  Groups or collections selected on the left, content 
 available in tables in the remainder of the view to the right.
 
 Thanks.
 
 -Michael
 ___
 
 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/michaelacrawford%40me.com
 
 This email sent to michaelacrawf...@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/archive%40mail-archive.com

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


NIB/XIB created objects, should they be released in -[dealloc]?

2009-11-23 Thread Michael A. Crawford
I wouldn't have though so.  I would assume that since I did not allocate them 
directly, I don't need to clean them up.  I've just inspected some code that 
declares properties that are marked as outlets and whose member variables are 
allocated in the NIB file.  When the class' dealloc method is called, it calls 
release for said properties.

I would assume this is bad form.  But I would like to know if I'm mistaken and 
if this is valid.

@interface ViewController : UIViewController
{
MKMapView* mapView;
}
@property (nonatomic, retain) IBOutlet MKMapView* mapView;
@end

@implementation ViewController

@synthesize mapView;

- (void)dealloc
{
[mapView release], mapView = nil;
[super dealloc];
}
@end

-Michael

___

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


Looking for Sample code: WWDC2007 - Session 201 - Building Animated Cocoa User Interfaces

2009-09-27 Thread Michael A. Crawford
I believe the demos were called CocoaShuffle and Layer-Backed OpenGL  
View.  Can these be downloaded somewhere?


-Michael


___

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: Not receiving mouseDown/Up events in borderless window . . . (Solved!)

2009-09-17 Thread Michael A. Crawford
Apparently on Leopard (and presumably, early versions of Mac OS X) you  
have to handle the mouseDown event in order to receive a mouseUp  
event.  Initially, I only overrode mouseUp, thinking that I didn't  
want to react to the event until the user releases the mouse button  
inside the NSRect of interest.  This little obscure fact didn't appear  
in any of the texts or web pages I had scanned.  I only guessed at the  
solution when I overrode and observed the behavior of - (void) 
sendEvent:(NSEvent*)event on both Leopard and Snow Leopard.  On Snow  
Leopard, calling -[super sendEvent:event] was quickly followed by a  
call to -[mouseUp:event]. On Leopard it is not.


-Michael

On Sep 14, 2009, at 2:47 PM, Michael A. Crawford wrote:

Ok.  I went back and did some experimenting and it doesn't look  
good.  First of all the ignoresMouseEvents property was already set  
to NO.  Assuming I had some issue with intercepting mouse clicks at  
the NSWindow level when an NSView was present, I decided to  
implement support for event handling in my NSView derived class.   
Again the code works but only on Snow Leopard.  On 10.5 I'm just not  
seeing those mouse clicks.


When I say 'not seeing' I'm talking about empirical evidence.  My  
software doesn't respond by closing the windows or doing anything  
else I've programmed it to do when the mouse is clicked in one of my  
views.  My tester is reporting the same problem when he runs the  
code on his 10.5 system.


I'm building this code on 10.6 with Xcode 3.2.  This is my  
development machine, which I foolishly upgraded.  I no longer have a  
Leopard development system running Xcode 3.1.  How can I see what is  
going on on my Leopard test system?  I'm building using the 10.5 SDK  
since I want my app to run on both 10.5 and 10.6 as a 32-bit app.   
With a debug build, is there anyway to see debug console output on  
my test machine running the binary I build using Xcode 3.2?


Obviously this is my problem.  If it were the case than anyone  
processing events in windows and views on 10.5 using a binary built  
on 10.6 with Xcode 3.2, I would have heard about it.


In case you are curious, here is the experimental code.

@class CDImageView;

@protocol CDImageViewDelegate
- (void)mouseUp:(NSEvent*)event onImageView:(CDImageView*)imageView;
@end

@interface CDImageView : NSImageView
{
   idCDImageViewDelegate delegate;
}

@property (nonatomic, assign) idCDImageViewDelegate delegate;

@end

@implementation CDImageView

@synthesize delegate;

- (void)mouseUp:(NSEvent*)event
{
   [self.delegate mouseUp:event onImageView:self];
}

@end

-Michael

On Sep 12, 2009, at 10:36 PM, Ken Thomases wrote:


On Sep 12, 2009, at 9:12 PM, Michael A. Crawford wrote:

I have created a borderless window that is used to display a  
custom graphic, which need to respond to the enter key or a mouse  
click by closing itself.  Seems straightforward enough.  It works  
great on Snow Leopard (10.6) but I do not get the mouse events on  
Leopard (10.5).  Hitting the enter key works on both.


Anyone seen this behavior before?  I've included the code so you  
could see if I've left something out.


I think you need to setIgnoresMouseEvents:NO.  I believe that  
windows which are transparent below a certain threshold ignore  
mouse events by default.


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:
http://lists.apple.com/mailman/options/cocoa-dev/michaelacrawford%40me.com

This email sent to michaelacrawf...@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/archive%40mail-archive.com

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


Re: Not receiving mouseDown/Up events in borderless window . . .

2009-09-14 Thread Michael A. Crawford
Ok.  I went back and did some experimenting and it doesn't look good.   
First of all the ignoresMouseEvents property was already set to NO.   
Assuming I had some issue with intercepting mouse clicks at the  
NSWindow level when an NSView was present, I decided to implement  
support for event handling in my NSView derived class.  Again the code  
works but only on Snow Leopard.  On 10.5 I'm just not seeing those  
mouse clicks.


When I say 'not seeing' I'm talking about empirical evidence.  My  
software doesn't respond by closing the windows or doing anything else  
I've programmed it to do when the mouse is clicked in one of my  
views.  My tester is reporting the same problem when he runs the code  
on his 10.5 system.


I'm building this code on 10.6 with Xcode 3.2.  This is my development  
machine, which I foolishly upgraded.  I no longer have a Leopard  
development system running Xcode 3.1.  How can I see what is going on  
on my Leopard test system?  I'm building using the 10.5 SDK since I  
want my app to run on both 10.5 and 10.6 as a 32-bit app.  With a  
debug build, is there anyway to see debug console output on my test  
machine running the binary I build using Xcode 3.2?


Obviously this is my problem.  If it were the case than anyone  
processing events in windows and views on 10.5 using a binary built on  
10.6 with Xcode 3.2, I would have heard about it.


In case you are curious, here is the experimental code.

@class CDImageView;

@protocol CDImageViewDelegate
- (void)mouseUp:(NSEvent*)event onImageView:(CDImageView*)imageView;
@end

@interface CDImageView : NSImageView
{
idCDImageViewDelegate delegate;
}

@property (nonatomic, assign) idCDImageViewDelegate delegate;

@end

@implementation CDImageView

@synthesize delegate;

- (void)mouseUp:(NSEvent*)event
{
[self.delegate mouseUp:event onImageView:self];
}

@end

-Michael

On Sep 12, 2009, at 10:36 PM, Ken Thomases wrote:


On Sep 12, 2009, at 9:12 PM, Michael A. Crawford wrote:

I have created a borderless window that is used to display a custom  
graphic, which need to respond to the enter key or a mouse click by  
closing itself.  Seems straightforward enough.  It works great on  
Snow Leopard (10.6) but I do not get the mouse events on Leopard  
(10.5).  Hitting the enter key works on both.


Anyone seen this behavior before?  I've included the code so you  
could see if I've left something out.


I think you need to setIgnoresMouseEvents:NO.  I believe that  
windows which are transparent below a certain threshold ignore mouse  
events by default.


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

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


Not receiving mouseDown/Up events in borderless window . . .

2009-09-12 Thread Michael A. Crawford
I have created a borderless window that is used to display a custom  
graphic, which need to respond to the enter key or a mouse click by  
closing itself.  Seems straightforward enough.  It works great on Snow  
Leopard (10.6) but I do not get the mouse events on Leopard (10.5).   
Hitting the enter key works on both.


Anyone seen this behavior before?  I've included the code so you could  
see if I've left something out.


#import Carbon/Carbon.h

#import CDExportCompleteWindow.h


@implementation CDExportCompleteWindow

// We override this method simply for the sake of making the window  
borderless

// with a clear background.
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)windowStyle
  backing:(NSBackingStoreType)bufferingType
defer:(BOOL)deferCreation
{
windowStyle = NSBorderlessWindowMask;

self = [super initWithContentRect:contentRect
styleMask:windowStyle
  backing:bufferingType
defer:deferCreation];

if ( self )
{
[self setLevel:NSFloatingWindowLevel];
[self center];
[self setOpaque:NO];
[self setBackgroundColor:[NSColor clearColor]];
}

return self;
}

- (BOOL)canBecomeKeyWindow
{
return YES;
}

- (void)keyDown:(NSEvent*)event
{
MCLog(@keyDown:%@, event);

if ( kVK_Return == event.keyCode )
{
[self close];
}
}

- (void)mouseUp:(NSEvent*)event
{
MCLog(@mouseUp:%@, event);

if ( NSPointInRect(event.locationInWindow, NSMakeRect(411, 3, 81,  
29)) )

{
[self close];
}
}

@end

-Michael




___

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: Not receiving mouseDown/Up events in borderless window . . .

2009-09-12 Thread Michael A. Crawford
Since the window is transparent and the view is not, maybe the view is  
actually getting the mouse event?  Maybe.  But why does it work on  
Snow Leopard?  I will test your theory out and get back to you.  I'm  
not even sure the content-view is a responder but I'll check that out  
too.


-Michael

On Sep 12, 2009, at 10:36 PM, Ken Thomases wrote:


On Sep 12, 2009, at 9:12 PM, Michael A. Crawford wrote:

I have created a borderless window that is used to display a custom  
graphic, which need to respond to the enter key or a mouse click by  
closing itself.  Seems straightforward enough.  It works great on  
Snow Leopard (10.6) but I do not get the mouse events on Leopard  
(10.5).  Hitting the enter key works on both.


Anyone seen this behavior before?  I've included the code so you  
could see if I've left something out.


I think you need to setIgnoresMouseEvents:NO.  I believe that  
windows which are transparent below a certain threshold ignore mouse  
events by default.


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

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


  1   2   >