2718.us blog » cocoa http://2718.us/blog Miscellaneous Technological Geekery Tue, 18 May 2010 02:42:55 +0000 en hourly 1 http://wordpress.org/?v=3.0.4 A WebView Subclass with Isolated Cookie Storage http://2718.us/blog/2010/03/11/a-webview-subclass-with-isolated-cookie-storage/ http://2718.us/blog/2010/03/11/a-webview-subclass-with-isolated-cookie-storage/#comments Thu, 11 Mar 2010 07:38:14 +0000 2718.us http://2718.us/blog/?p=227 Following the advice of Kevin Ballard on StackOverflow, I created IGIsolatedCookieWebView, a subclass of WebView that does not access or affect the system-wide shared cookie storage (shared among all WebKit apps).  Each instance of IGIsolatedCookieWebView has its own cookie storage so that, for example, multiple instances of IGIsolatedCookieWebView within the same application can be logged in to the same web site with different credentials.  IGIsolatedCookieWebView should be usable in place of WebView, except that IGIsolatedCookieWebView uses the resource load delegate, so that can’t be used by the application.  IGIsolatedCookieWebView is published under a 3-clause BSD an MIT license.

]]>
http://2718.us/blog/2010/03/11/a-webview-subclass-with-isolated-cookie-storage/feed/ 0
A Drag-Resizable Subclass of NSComboBox http://2718.us/blog/2010/03/10/a-drag-resizable-subclass-of-nscombobox/ http://2718.us/blog/2010/03/10/a-drag-resizable-subclass-of-nscombobox/#comments Wed, 10 Mar 2010 09:57:02 +0000 2718.us http://2718.us/blog/?p=223 IGResizableComboBox is a drag-resizable subclass of NSComboBox—that is, IGResizableComboBox should be usable in place of NSComboBox and it adds a small bar at the bottom of the pop-up list that can be dragged to resize the pop-up list.  IGResizableComboBox is published under a 3-clause BSD an MIT license.

It still has some quirks:

  • behavior is strange when the pop-up is above the combo box (whereas it is usually below) [fixed; when the pop-up is above the combo box, the drag-handle is at the top and the top edge moves while the bottom edge stays fixed at the combo box]
  • the formula for resetting the number of visible items after dragging occurs is not quite right [fixed; dragging now snaps to whole-item positions]
]]>
http://2718.us/blog/2010/03/10/a-drag-resizable-subclass-of-nscombobox/feed/ 0
NSTextView [Mis]Spelling Underlines Misplaced http://2718.us/blog/2009/07/25/nstextview-misspelling-underlines-misplaced/ http://2718.us/blog/2009/07/25/nstextview-misspelling-underlines-misplaced/#comments Sat, 25 Jul 2009 21:47:15 +0000 2718.us http://2718.us/blog/?p=163 I’ve just spent a total of about 2 hours taking apart and rebuilding an interface window because those little red dotted underlines on misspelled words  in an NSTextView were appearing about a line and a half too high and about 4em to the right.  Net result?  It seems that if core animation is enabled for the content view of a window, which is also the parent view of the NSTextView, spelling underlining becomes very broken.  Adding a custom view inside the content view and enabling core animation for that custom view (and putting the objects that needed their parent to have core animation enabled inside that custom view) seems to have solved the issue.

]]>
http://2718.us/blog/2009/07/25/nstextview-misspelling-underlines-misplaced/feed/ 0
NSDocument beginSheet on a New Document http://2718.us/blog/2009/07/17/nsdocument-beginsheet-on-a-new-document/ http://2718.us/blog/2009/07/17/nsdocument-beginsheet-on-a-new-document/#comments Sat, 18 Jul 2009 02:49:43 +0000 2718.us http://2718.us/blog/?p=161 This took over an hour for me to hash out, in part because there are a few mailing list archives and whatnot that I came across while looking into this issue that led me down the wrong path.  I have an NSDocument subclass for which I want a sheet to display modal to the window on initialization of the window.  It seemed that no matter what I did to try to get it to work, what would happen was the sheet would show up detached from the document, then the document would show up on top of it.

… because I had “Visible At Launch” checked for the NSPanel that is my sheet in Interface Builder.  Unchecking that fixed everything, no RunLoop or otherwise delayed-running machinations needed.

]]>
http://2718.us/blog/2009/07/17/nsdocument-beginsheet-on-a-new-document/feed/ 0
asLJ: a Mac OS X 10.5+ LiveJournal Client http://2718.us/blog/2009/02/09/aslj/ http://2718.us/blog/2009/02/09/aslj/#comments Mon, 09 Feb 2009 08:24:18 +0000 2718.us http://2718.us/blog/?p=121 asLJ is a new client for Macs running Leopard that easily handles multiple accounts on LiveJournal and other LJ-based sites and facilitates cross-posting across accounts. Release notes and download link are in [info]aslj_client. The community for users is [info]aslj_users.

(As it is very LJ-centric, most of the information about it will be over at LJ, in the two places linked above, but there is a page for it here, as well.)

]]>
http://2718.us/blog/2009/02/09/aslj/feed/ 0
NCIDStatusBarMenu v0.1a Release Notes http://2718.us/blog/2007/10/14/ncidstatusbarmenu-v01a-release-notes/ http://2718.us/blog/2007/10/14/ncidstatusbarmenu-v01a-release-notes/#comments Mon, 15 Oct 2007 03:07:40 +0000 2718.us http://2718.us/blog/?p=49 Initial Release Notes for the first release of NCIDStatusBarMenu (copied into the blog)

  • This is the first thing I’ve ever written with Objective-C/Cocoa and the first OS X-native GUI app I’ve ever written. This is also the first release. There are probably bugs.
  • The preferences have no default settings yet.
  • The program won’t create the log file if it doesn’t exist.
  • If you don’t have Growl, you will be prompted to install it at some point. Install it.
  • The lookups to whocalled.us may make use of /usr/bin/curl, but I think that’s in the base install of OS X 10.4+
  • Requires OS X 10.4+
]]>
http://2718.us/blog/2007/10/14/ncidstatusbarmenu-v01a-release-notes/feed/ 0
Why NCIDStatusBarMenu? http://2718.us/blog/2007/10/14/why-ncidstatusbarmenu/ http://2718.us/blog/2007/10/14/why-ncidstatusbarmenu/#comments Sun, 14 Oct 2007 18:58:53 +0000 2718.us http://2718.us/blog/?p=51 I got tired of hunting for one of my cordless phones to check the caller ID every time someone was calling and figured that since I’m sitting at a computer 90% of the time, there had to be a way to get the caller ID on there. The big problems for me were that my primary machine no longer has a modem and that my primary machine isn’t the only one I use. I tried some of the existing OS X programs and some of them looked good, but none quite did what I wanted.

When I learned about Network Caller ID (NCID), I knew it was exactly what I wanted. I’ve got an old, but caller-ID capable, modem in an old OpenBSD box and it grabs all the caller ID data and serves it up. The only thing left is to get that data to each machine.

I was very disappointed in the choices in NCID clients for OS X. I settled on using David LaPorte’s shell scripts that hook into the command-line tool for Growl notification. This worked pretty well. Annoyingly for me, I get calls about every half-hour during the day, six days a week, mostly from “Toll-Free” or “Out-of-Area” and my annoyance with not knowing who’s calling had led me to whocalled.us. I was able to use Maxim Samo’s junk_lookup.agi script to help me modify David LaPorte’s scripts so that now all my incoming calls were looked up on whocalled.us. This worked reasonably well.

I now had an AppleScript app on my desktop that ran the shellscript that started the command-line NCID client that triggered a shell script that used curl and some other voodoo to query whocalled.us and reprocess all that info into a log and into the command-line interface for Growl. If I were busy all the time, I wouldn’t have given this a second thought, since it worked. But what I really wanted was a single program with a nice little menu thing up by the clock that controlled it. So I learned some Objective-C and some Cocoa and here’s the result.

]]>
http://2718.us/blog/2007/10/14/why-ncidstatusbarmenu/feed/ 0