## Tips and Tricks (local file)

If things go wrong:
  In the settings folder you find a grind.log file: it gives you a hint, what went wrong.
You need more?
  Go to the install directory, and execute (in a terminal window / cmd window) the following command:
  `java -jar ./MyGoGrinder.jar`
  Don't use the javaw.exe, as this doesn't send error messages to the console
Where is my tags pool gone?
  The tags for every single problem file is in it's associated .dat-file (problems/NAME.sgf -> stats/NAME.dat).
  All available tags are stored in the grind.dat. If this file is defect or deleted: in the selection window mark the topmost folder ("problems"), deactivate all filters: "Tags" -> "NONE", "Match" -> "All Tags (AND)" - in the section "Current selection" you should now read something like "# Selected: 762 of 762" (all problems selected) - the numbers depend on the size of your collection. Export your whole collection. Now, you re-import it: in the main window (solve problems), menu "Problems" -> "Import" - voila! Your tags pool is back!
  This method doesn't bring back the tags, which are not given to any problem.
  Much faster: if you previously exported your tags pool (selection window -> button "Export tags") - just re-import them; this brings also those tags back which are not given to a problem - but possibly not those with characters from foreign fonts.
Where is my settings folder
  The settingsfolder is "MyGoGrinderSettings" and as default resides in your $HOME folder (so e.g. `c:\Documents and Settings\MyName\MyGoGrinderSettings\`). If it is not there (things happen...) start your Grinder and in the help menu open "System Info". This lists all relevant information.
What exactly is SGF?
  SGF (for Smart Game Format) is the most common used file format for Go game files. It has been introduced ~1987 and is now (since 1997) in version 4. Usually a Go program, which understands SGF file format 4 ("FF[4]") knows also to handle the previous format versions (the differences are not big)
  The common view of a game file, how you would see it in a text editor, is:
  `(;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2]
  RU[Japanese]SZ[19]KM[5.00]TM[10800]OT[10x120 byo-yomi]
  PW[Old Master]PB[Grand Master]WR[6d]BR[5d]DT[1963-04-03]GC[exceptional!]
  EV[Garden Games]RE[W+1.00] ;B[od];W[qp];B[de];W[cp];B[qd])`
  About the structure of an SGF file:
  - An SGF file is a pure text file.
  - It begins always with "`(;`" and ends with "`)`".
  - From "`;`" to the next "`;`" or "`)`" or "`(;`" is a node.
  - A node consists of information, labels and (setup or moves) - o.k., o.k. - also moves etc. are information.
  - All information in a node is built from 1 or 2 uppercase letters, `[...]` and the values: `B[fd] C[Good!] RE[B+resign]`
  - Labels, setup and moves consist of coordinates: ab, de, fg, ...: `B[de]`, `AW[dd]`, `LB[ce:bad]` - here LaBel with additional information: characters "bad" on intersection "ce".
  - The smallest SGF (but with no sense) is `(;)` - just one empty node.
  - `(;...)` inside "`(;`" and "`)`" is a branch (variation) - you can also see the outer `(;...)` as a branch - the main branch.
  - A branch may consist of several nodes `(;...(;...;...;...)(;...;...(;...)(;...;...)))`.
  - The first node of the main branch is the root node: here is the information for the whole game: players, komi, board size, etc.
  - Some programs put more than one main branch into a file: `(;...)(;...)` - a collection file - but only few programs can handle these files. These different main branches in one file can have nearly completely different root information. Only FileFormat (mostly `FF[4]`) and GaMe (`GM[1]` = Go) need to be the same.
  Some identifiers:
  - `GM[1]` is game type (1 = Go game - yes there are more games, which use this file format);
  - `SZ[9]` - board size (default is 19);
  - `B[de]` - black move at line 4 from left, line 5 from above;
  - `C[White is dead]` - yes, a comment
  - `AB[de] AE[ef] AW[ge]` - AddBlack / AddEmpty / AddWhite (Switch color problems: this is, where GoGrinder and MyGoGrinder have the most problems with)
  More about the SGF format:
  - senseis.xmp.net: about SGF and
  - red-bean.com/sgf/ (all the technics around SGF)
How are the tags sorted?
  We are not talking about abc or 123 but ways to have an own sorting or grouping. This is not coded, but you can use special characters (e.g. "!") to have a tag (e.g. Ko) at the top of the list. So instead of Ko, give the tag !Ko or #Ko. Here are 2 screenshots, which show you the sorting of most of the special characters: [1] [2]
  Here is a (small) problem hidden: exporting / importing tags with Grinder versions before 2.3.0 didn't always handle tags with special characters from foreign languages e.g. German umlauts (ä, Ü) or Chinese characters (余) (depending on your system's language settings). On importing tags, they are now shown to you and you can change the decoding.
Portable use of MyGoGrinder
  If you want to use the Grinder from a USB stick ("portable"), start it with the command line switch `-portable` or `-p`
  The folders "problems", "stats", the settings files and the log files are now written in Grinder's program folder. Example: `java -jar mygogrinder.jar -portable`
  I don't recommend this at the moment: it is slow, as Grinder writes to file for every problem.
  You can have the same "portable" effect, if you create a file "PORTABLE" in Grinder's program folder.
Using system variables to configure MyGoGrinder
  You know of set PATH=...? You can set some system variables, which are processed by MyGoGrinder:
  (this needs to be done in the same script or on the same console, which starts MyGoGrinder) MYGG_SETTINGS - Use this to set a different settings folder (the folder needs to exist already).
  Example: `set MYGG_SETTINGS=c:\Go\Charly\MyGrinder`
  MYGG_DOCPATH - lets you set a folder for the html help files, if it differs from the standard "docs" in the Grinder program directory;
  Example: `set MYGG_DOCPATH=/usr/share/doc/mygogrinder`
  MYGG_LOG_LVL - log level is used for error messages, when parsing an SGF file is not successful.
  It can be set from 0 to 3; 1 is the default:
  - 0 = short - file name - with just "Defect: " or "Can't use: "
  - 1 = normal - file name, message
  - 2 = detail - file name, message, code example
  - 3 = debug - file name, message, code example, origin in the Java code (this is used, if MYGG_DBG2=true)
  Example: `set MYGG_LOG_LVL=2` gives you (beside the file name and the reason for failure) a piece of SGF code (mostly).
  MYGG_SGF_MAX_SZ - MyGoGrinder restricts the SGF file size to 100000 bytes (do you really want to use Kogo's joseki dictionary in MyGoGrinder?)
  MYGG_TEST - Set this to true, if you want to use Grinder with a test environment
  Example `set MYGG_TEST=true`
  MYGG_DBG2 - This is really for DeBuG: if set to true, it gives a stack trace for SGF errors and raises the log level to 3 (This option can now be accessed with a command line switch: -d2 / -debug2 or by changing the value in the settings file)
  Nota bene: setting system variables in Linux differs from that in Windows (what a surprise!):
  in Windows you use `set NAME=VALUE`
  and VALUE can have spaces in it without the need to use quotation marks:
  `set MYGG_SETT=c:\Documents and Settings\peter\My second Grinder settings`
  in Linux you use `NAME=VALUE`
  AND you need to make sure, that it is available to "child processes" (here the command "java... ")
  so you do: `export NAME=VALUE`
  AND VALUE must not have spaces in it OR needs to be enclosed in quotation marks
  `MYGG_SETT="/home/peter/My second Grinder profile"`
  While Windows allows spaces before and after the equal sign, Linux doesn't allow this.
Command Line Switches for MyGoGrinder
`-l/-language=xx`
  sets the language of Grinder's GUI. Valid values for xx are `cz, de, en, es, fr, pt, ru, zh` (Simplified Chinese?). Omitting the token resets the language to the system's default; Omitting the token and the "=" lets the program temporary start with the program's default (which is English). A grind.locale file with just a New Line in it in the settings folder lets the program always start with English (same as with "en" in it). The old switch defaultLanguage is still valid.
`-nosplash`
  starts the Grinder without a splash image.
`-p/-portable`
  starts Grinder in portable mode: you can use your Grinder from a thumb drive on different computers (Java needs to be installed). The settings are saved to and read from Grinder's program directory. You get the same effect, if Grinder finds a file "PORTABLE" in it's program directory.
`-strings`
  we need a folder with resource files (messages*.properties) from the .jar file. Then we will parse the files for missing translations in one of them (compared to the default file, which is "messages.properties").
`-sysinfo`
  shows your OS's info on the console and copies it to the clipboard.
`-validate`
  parses a folder (to be selected) for defect or unusable files.
`-? / -h / -help`
  they do what?
Change settings directly in the mygrinder.ini
  There are some settings, which can only be done by editing the mygrinder.ini in the settings folder:
  Set the size of the log files for getting a warning when one grows too big (default is ~1mby);
  set the size for the log messages buffer: when checking a complete directory for defect files, the log messages are collected and written, if they exceed 10000 bytes;
  of course: other settings can also be done manually here.
Change file decoding
  If the text of the comments of your problems looks like waste (e.g. È¡µÃÁªÂçµÄÎ¨Ò»ÏÂ·¨), the reason is mostly a wrong decoding. In Central Europe we use (on Windows machines) the character set "windows-1252" to display non-ASCII characters. But this way we cannot get the right characters for e.g. Chinese or Hebrew. Chinese characters are possibly coded with the local character set "big5" or "gb2312". SGF files have a marker inside to tell the sgf viewer the right decoding: e.g. CA[gb2312]. KGS took the right method: they always code the non-ASCII characters with UTF-8, which is international and can code nearly every character in the world. So Chinese can stand readable beside Hebrew and Russian. The files have the marker CA[UTF-8] and most current Go programs can display these files without error. Since version 2.3.0 MyGoGrinder utilizes the CA[] marker and displays these files correct. However many old sgf files don't use this marker (many files from flygo.net have no marker). If you want to get these files always displayed right, you can now switch the decoding for one file or a whole folder.
  In the "View" menu is the entry "Change text decoding". You get a window, which displays the current file with it's decoding. Here you can set, change and reset the decoding for the file and the current folder (without subfolders). The order of importance is:
  - most: set for file
  - then: set in file (e.g.\"CA[UTF-8]\" - I still don't write to your sgf files)
  - nearly least: set for folder
  - and least: default decoding (change this in the settings window)
  Grinder remembers the setting with a file NAME.char for a file NAME.sgf and DECODEWITH for the folder. Both these files are written in the stats folder. Default decoding: while Linux systems use UTF-8 for reading and writing text from/to file, Windows systems usually use a local decoding ("character set", e.g. "windows-1251"). And Java uses the same decoding! If you use MyGoGrinder in portable mode (from a thumb drive), you may want to have a fixed decoding. Set this in the settings window. Remark: the Windows notepad.exe can detect UTF-8 characters in a file and display it correct.
< -->

.