mac

Fix Incorrect Mac Dock Icon Badge Count

Posted on Updated on

Fairly often, my Mac OS X 10.8 Mountain Lion “Messages” app shows the wrong number of unread messages.

Sometimes I can make the badge update after double-clicking every contact in my buddy list. With a big list, that is not a practical solution.

Instead, I’ve found that these steps seem to work:

  1. Quit the problem app
  2. Open Applications/Utilities/Terminal and run the following command:
    killall Dock
  3. Launch the problem app
Advertisements

Mac JDeveloper – Show in Finder

Posted on

Ever wanted to easily reveal a file that you’re working on in JDeveloper in the Mac OS X Finder?

Here’s how to set up a toolbar button and context menu item to do just that:

  1. Go to Tools – External Tools
  2. Click New…
  3. Choose these settings:
    Type = External Program
    Executable = open
    Arguments = -R ${file.path}
    Caption = Show in Finder
    Add Item to Menus = Tools Menu, Window Context Menu, Source Editor Context Menu
    Add Buttons to Toolbars = Main Toolbar
    Log Output to Messages Log = unchecked
    Enabled = When a file is selected or open in the editor

Once you’ve created that tool, simply right-click a file in the application navigator, right-click an editor, or use the toolbar button to switch to have JDeveloper automatically switch over to the Finder and open a window with that file selected.

Browsers and the HTML accessKey

Posted on Updated on

Background

As browsers evolve, changes have been made with how the HTML “accessKey” attribute works. There are differences across platforms for the same browser version as well as differences across browser versions on the same platform.  There are even some cases where the exact same browser treats accessKey differently for button elements vs. anchor elements!  This post shows some examples of how to invoke the accessKey and what the behavior is.

Sample button and anchor HTML using the “accessKey” attribute

<html>
<body>
<button onclick="javascript:alert('hi button with onclick')"
        accessKey="r">Button t<u style="color:red">r</u>y me</button>
<a href="javascript:;" onclick="alert('hi anchor with onclick');return false;"
        accessKey="o">Anchor with <b style="color:red">o</b>nclick</a>
</body>
</html>

How different browsers handle the above accessKey letters for button and anchor elements

Browser Operating System Key Combination Button Behavior Anchor Behavior
Chrome 7.0.517.41 Linux Alt + letter Clicks the button (3) Clicks the anchor (3)
Chrome 7.0.517.41 Mac OS X Control + Option + letter Clicks the button (3) Clicks the anchor (3)
Chrome 7.0.517.41 Windows Alt + letter Clicks the button (3) Clicks the anchor (3)
Firefox 1.5 Windows Alt + letter Clicks the button (1) Unknown
Firefox 2 Linux Alt + Shift + letter Clicks the button (1) Clicks the anchor
Firefox 2 Mac OS X Control + letter Clicks the button (1) Clicks the anchor
Firefox 2 Windows Alt + Shift + letter Clicks the button (1) Unknown
Firefox 3 Linux Alt + Shift + letter Clicks the button (1) Clicks the anchor
Firefox 3 Mac OS X Control + letter Clicks the button (1) Clicks the anchor
Firefox 3 Windows Alt + Shift + letter Clicks the button (1) Clicks the anchor
Internet Explorer 6 Windows Alt + letter Sets focus on the button (2) Unknown
Internet Explorer 7 Windows Alt + letter Sets focus on the button (2) Sets focus on the anchor (2)
Internet Explorer 8 Windows Alt + letter Clicks the button (3) Sets focus on the anchor (2)
Internet Explorer 9 (beta) Windows Alt + letter Clicks the button (3) Sets focus on the anchor (2)
Safari 3.1.2 Mac OS X Control + Option + letter Clicks the button (3) Clicks the anchor (3)
Safari 3.1.2 Windows Alt + letter Clicks the button (3) Clicks the anchor (3)
Safari 5.0.2 Mac OS X Control + Option + letter Clicks the button (3) Clicks the anchor (3)
Safari 5.0.2 Windows Alt + letter Clicks the button (3) Clicks the anchor (3)

 

  • Red = Different behavior for buttons and anchors
  • Comment 1 = To just set focus on the button/anchor, change your about:config setting for the “accessibility.accesskeycausesactivation” user preference.
  • Comment 2 = Press Enter to click the button/anchor
  • Comment 3 = There appears to be no built-in mechanism to just set focus on the button/anchor.  The component handling the click event would be responsible for setting focus while handling the click.

NFS Network URLs on a Mac

Posted on Updated on

In Mac OS X, if someone gives you a Linux path that looks like:

/net/server/path/to/some/folder/

you can load that folder by swapping out “/net/” with “nfs://” and using a feature of the Mac OS X Finder.  In the Finder, go to:

Go - Connect to server...

And then specify the server address of:

nfs://server/path/to/some/folder/

If you are allowed to connect, a drive will be mounted on your desktop.

On a related note.  If you are using Firefox and come across one of these “nfs://” URLs, Firefox may not automatically mount the drive for you or even prompt you for an application to handle that URL.  Instead, you will need to tell Firefox that you want the Finder to handle those kinds of URLs.

I have tested these instructions on Firefox 3.6:

  1. In Firefox’s address bar, go to:
    about:config
  2. If you have never been there before, it might warn you about editing these settings.
  3. Once you get past the warning and can see a table listing all of your browser settings, right-click anywhere in that table and choose:
    New - Boolean
  4. For the name, specify:
    network.protocol-handler.expose.nfs
  5. For the value, specify:
    false

The next time you try to click one of those links, Firefox will prompt you for a program to handle it and then that program will launch the appropriate network drive.  At least on a Mac, you will need to choose:

/System/Library/CoreServices/Finder.app

Additional information on protocol handling in Firefox can be found at:

http://kb.mozillazine.org/Register_protocol