8 Replies Latest reply: Nov 25, 2009 1:29 PM by etresoft
Jongware Level 2 Level 2 (265 points)
Is there a simple way to flush the cache of Dictionary.app?
While developing a new dictionary to add, I can (naturally) only test it by installing and starting Dictionary. However, if the new file contains some (any!) kind of error, Dict.app starts behaving erratically [*], and adjusting and reinstalling the new file does not fix it. I found a small clean all systems cache program, but it clears out way too much, and (even worse!) requires a system restart... I already knew restarting sometimes made dict.app come alive again -- there must be an easier way!
Is there?

[*] Symptoms include not removing labels for already removed dictionaries, finding an entry in the index but not showing the page itself, then gradually disintegrating entirely ... (In case this sounds familiar to anyone.)

Mac OS X (10.6.2)
  • K T Level 7 Level 7 (23,700 points)
    Hi Jongware & welcome to the discussions...

    Delete the following file?

    (yourUserNameHome)/Library/Caches/com.apple.Dictionary
  • etresoft Level 7 Level 7 (26,560 points)
    How are you building your dictionary files? Are you using the Dictionary Development kit? If you base it on XML and XSL and you have errors, it should blow up way before you get it to Dictionary.app.
  • Jongware Level 2 Level 2 (265 points)
    KT, thanks! That does sound like it ought to do the trick. I'll try it.

    Etresoft, yes, I created it from an XML file with a custom XSLT. Unfortunately, there are a few quirky things that don't appear to be caught by the Jing Schema test Apple recommends. A few of these appear to be:

    "$" is not allowed as an id label -- not flagged as an error
    ul not any containing li items -- not flagged as an error

    And a few variations of perfectly correct XML ([br>, self-closing tags), but: it might be that I simply could not get any of my changes to work because of a previous bad run -- that's why I guessed there had to be a cache somewhere.
    As Dictionary troubleshooting info appears to be somewhat scarce, I'll try a few things (including aforementioned cache cleaning) and report my findings.

    Message was edited by: Jongware
  • etresoft Level 7 Level 7 (26,560 points)
    Jongware wrote:
    Etresoft, yes, I created it from an XML file with a custom XSLT. Unfortunately, there are a few quirky things that don't appear to be caught by the Jing Schema test Apple recommends.


    I've never heard of the Jing Schema test.

    A few of these appear to be:

    "$" is not allowed as an id label -- not flagged as an error
    ul not any containing li items -- not flagged as an error


    I wouldn't expect $ to be acceptable as an id label. I try to keep my output clean so that I wouldn't have anything like empty ul tags.

    As Dictionary troubleshooting info appears to be somewhat scarce, I'll try a few things (including aforementioned cache cleaning) and report my findings.


    Try cleaning up the cache and see if it helps. I have some scripts I could give you. I have one XSL file that emits a big HTML file for testing.

    What is your dictionary content? I created one dictionary with classical Arabic script and Dictionary.app never complained. The Arabic gave 10.6 some problems but those were fixed in 10.6.2.
  • Jongware Level 2 Level 2 (265 points)
    {quote:title=etresoft wrote:}
    I've never heard of the Jing Schema test.
    ...
    I wouldn't expect $ to be acceptable as an id label. I try to keep my output clean so that I wouldn't have anything like empty ul tags.{quote}


    It's mentioned in the Programming Guide under Creating Dictionaries. This worked (well.. not quite) for me:
    java -jar ../../jing-20081028/bin/jing.jar ../documents/DictionarySchema/AppleDictionarySchema.rng [xml file here]


    It caught a few errors but not the ones I mentioned.
    And yes, I should have checked my XSLT sheet a bit more. This was just "testing the grounds" (and running aground )

    {quote:title=etresoft wrote:}
    What is your dictionary content? I created one dictionary with classical Arabic script and Dictionary.app never complained. The Arabic gave 10.6 some problems but those were fixed in 10.6.2.

    {quote}

    InDesign JavaScript Help -- with way more hyperlinks than the original
  • etresoft Level 7 Level 7 (26,560 points)
    Jongware wrote:
    It's mentioned in the Programming Guide under Creating Dictionaries. This worked (well.. not quite) for me:
    java -jar ../../jing-20081028/bin/jing.jar ../documents/DictionarySchema/AppleDictionarySchema.rng [xml file here]


    That's why I ignored it - Java!

    InDesign JavaScript Help -- with way more hyperlinks than the original


    I'm not sure Dictionary.app is really appropriate for this. Your HTML content looks really nice. It seems like Dictionary.app would be a step backwards. It might be better to have a service or program that provides a single-word index into your HTML. You could define a system-level hot key for lookup - or something specific to your favorite text editor.
  • Jongware Level 2 Level 2 (265 points)
    etresoft wrote:
    Jongware wrote:
    InDesign JavaScript Help -- with way more hyperlinks than the original


    I'm not sure Dictionary.app is really appropriate for this. Your HTML content looks really nice. It seems like Dictionary.app would be a step backwards. It might be better to have a service or program that provides a single-word index into your HTML. You could define a system-level hot key for lookup - or something specific to your favorite text editor.


    I have to agree on the different look-and-feel ... If you think the HTML looked good, well, the Windows CHM version looks the same but has a full index and a free text search option. The plain HTML version is okay, but you cannot search through all pages automatically, which is why I added a manually created contents and index. For plain HTML, putting everything into a single file is just not an option.
    Dict.app's system of "everything is clickable" works against a programmer, as it makes it hard to just select and copy something :-P On the bright side, though, everyone will be able to use my dictionary straight away, and it has the distinguished Mac dict look.

    I don't even have a favourite text editor at the mo' -- this is my 2nd week on a Mac! Any recommendations? TextWrangler is ... adequate ... but only barely, as it splutters and coughs when I edit the first line of an 8 meg document. (Now that's no problem at all with TextPad!)
  • etresoft Level 7 Level 7 (26,560 points)
    Jongware wrote:
    I have to agree on the different look-and-feel ... If you think the HTML looked good, well, the Windows CHM version looks the same but has a full index and a free text search option.


    There are a number of very nice CHM readers for the Mac too. Dictionary.app is just so specialized to dictionaries.

    The plain HTML version is okay, but you cannot search through all pages automatically, which is why I added a manually created contents and index. For plain HTML, putting everything into a single file is just not an option.


    You might look into using Apple's help system. It is similar to CHM in many respects. It also gives you full text search. Everything is based on HTML too. You could definitely put the content into an Apple Help system. You might event be able to hack-up InDesign some way to include your help in their menu structure somewhere.

    I've got an old "generic" starter project for Apple Help somewhere. It is based on my XSL system, but that should be pretty close to your dictionary sources.

    I don't even have a favourite text editor at the mo' -- this is my 2nd week on a Mac! Any recommendations? TextWrangler is ... adequate ... but only barely, as it splutters and coughs when I edit the first line of an 8 meg document. (Now that's no problem at all with TextPad!)


    I'm quite font of Xcode's editor. It has nice features, understands lots of languages, and doesn't get in my way. I turn off all the automatic formatting though. That's useless. I don't think it would handle a very large file any better though.

    I like to use nedit (via X11) to edit really big files or files on slow sshfs links. It doesn't have all the overhead of Xcode, etc.