MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Refactor_C++_code_to_eliminate_useless_return_statements_after_error()",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "338": {
                "pageid": 338,
                "ns": 0,
                "title": "Recap of the hierarchy of each plot element",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "Octave aims at being compatible with Matlab as much as possible, so the graphics part is very similar too to Matlab. In Octave the first choice to make is the {{Codeline|graphics_toolkit ()}}. There are currently (sep. 2015) 3 available plotting back-ends (graphics toolkits):\n* 'qt' (the default since Octave 4.0) and 'fltk' both rely on the same OpenGl based rendering engine.\n* 'gnuplot' toolkit uses the [http://www.gnuplot.info Gnuplot] software package.\nYou might want to try to test all of them for your plotting aims to see which solves your problem. Some graphics problems (wrong font, missing sub/superscript, wrong line style, etc) relate specifically to one graphics_toolkit in Octave, so you might want to try the other one. In general OpenGl based toolkits are much faster than 'gnuplot'. On the other hand, as 'gnuplot' is more mature, the printed outputs (in raster or vector formats) are much more good looking and generally suitable for publication. \n\nA plot is composed of various objects (figure window, axes, lines, images ...) which all feature a set of useful properties as we will see below. The graphics objects are organized according to the following hierarchy:\n\n* root: the base object. Mainly features properties related to screen description.  \n* figure: represents a figure windows. Figures are children of the root object. \n* axes: represents a set of x, y (,z) axes. Axes are children of figure objects.\n* line: represents curves. Lines are children of axes (or hggroup, see below) objects. This is typically what is used by the basic {{Codeline|plot (...)}} function to draw curves.\n* patch: represents unstructured surface. Patches are children of axes (or hggroup, see below) objects. Patches are used when one wants to draw 2 dimensional unstructured surfaces and have fine control over their color. \n* image: represents a  2D set of pixels. Images are children of axes (or hggroup, see below) objects. \n* surface: represents structured surfaces. Surfaces are children of axes (or hggroup, see below) objects. Structured meshes made of quads are generally represented using surfaces.\n* text: represents a text label. Texts are children of axes (or hggroup, see below) objects. \n* hggroup: convenience object to group graphics objects. Among others useful properties, the 'visible' property of and hggroup acts on the visibility of all its children objects (line, text, ...)\n\nThe law level functions that are used to create the above objects have the same name as the object. They all return a unique handle (a variable of type double) that can be further used to change the object properties using {{Codeline|set (h, POPERTY, VALUE)}}.\n\n\nIn general one would use higher level function such as in the example below::\n{{Code||<syntaxhighlight lang=\"octave\" style=\"font-size:13px\">\n graphics_toolkit (\"qt\");\n x = 0:0.1:3;\n y = sin (x);\n p = plot (x, y, \"b\");\n</syntaxhighlight>}}\n\n\nThis should get you a plot of a part of a sine wave. Octave has used all standard properties like line widths, fonts, etc, except for the line color which was forced to be blue (via the {{Codeline|'b'}}).\n\nBefore going into the hierarchy and how to change things, let's make things more complicated:\n\n graphics_toolkit (\"gnuplot\");\n figure (1)\n x = 0:0.1:3;\n y = sin (x);\n p = plot (x, y, \"b\");\n figure (2)\n subplot (2, 1, 1);\n r = plot (x, y.^2, \"og\");\n subplot (2, 1, 2);\n q = plot (x, x.^2, \"k\");\n\n* You now have 2 windows that popped up on your screen: figure 1 and figure 2. Their handle is the integer figure number (1 and 2 here)\n* figure 2 has two axes objects inside. In order to have access to those axes properties one could have stored its handle, returned by the subplot function, e.g. {{Codeline|<nowiki>hax = subplot (2,1,1)</nowiki>}} \n* the actual curves {{Codeline|<nowiki>y = sin (x) .^2</nowiki>}} and {{Codeline|<nowiki>y = x.^2</nowiki>}} are line objects that can be tuned using their repsective handles {{Codeline|p}} and {{Codeline|r}}.\n\nSo let's say you want to change the line thickness of the curve in figure 1:\n figure (1)\n set (p, \"linewidth\", 3)\n\nYou can get the color of the two other plots by referring to their handles:\n get (q, \"color\")\n get (r, \"color\")\nWhich will give you the RGB code for black (0,0,0) and green (0,1,0).\n\nHave a look at all the properties of line objects:\n get (q)\n\nSome of those properties are read-only, while others have a limited set of allowed values. You may also want to look at modifiable properties and their allowed values:\n set (q)\n\nAnd {{Codeline|set}} anything that is not to your taste to something else (for what's available see the [http://www.gnu.org/software/octave/doc/interpreter/ manual]).\n set (p, \"marker\", \"*\")\n\nAdding {{Codeline|text()}} inside an {{Codeline|axes()}} object is done by\n text (2, 0.8, \"HERE\");\n... but it now is inserted in figure 1, which ''might NOT be what you anticipated''.\n \nAll low and high level plotting functions draw by default on the 'currentfigure' in the 'currentaxes' for which the handles can be retrieved using:\n hfig = gcf (); # returns a handle to the current figure\n hax = gca ();  # returns a handle to the current axes\n\nIn order to change the current figure/axes and draw in figure 2 you may either make them current using the the figure {{Codeline|figure (NFIG)}} function: \n figure (2) # figure 2 is now the current, let's check\n get (0, \"currentfigure\")\n haxes = get (gcf (),\"children\") # retrieve all axes handles\n set (gcf (), \"currentaxes\", haxes(2)) # set the second axes current\n text (1.0, 0.5, \"THIS IS WHAT I WANTED\")\n\n... or explicitly specify the parent object in which you would like to draw the text:\n haxes = get (2, \"children\") # retrieve all axes handles\n text (1.0, 0.5, \"THIS IS WHAT I WANTED\", \"parent\", haxes (2))\n\n[[Category:Tutorials]]"
                    }
                ]
            },
            "740": {
                "pageid": 740,
                "ns": 0,
                "title": "Refactor C++ code that uses print usage() to resemble m-files",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "== Introduction ==\n\nThe C++ error handling mechanism in core Octave has been changed to use exceptions.  Previously, calling print_usage() or error() in C++ would always return execution to the calling function.  This made it necessary to explicitly use the return keyword to exit a function, or arrange for an if/else tree in the original function so that normal function execution would not continue in the case of an error.  With exceptions, the C++ code may now be written in a manner that closely resembles Octave's own m-file language.\n\nThe principal work for this sprint topic is to convert the C++ code to the new syntax.  In general, this means moving the input validation to the start of the function and logically negating the conditional used to test for an error condition.  For a single condition, the condition itself should be reversed rather than just adding the negation operator '!' to the start of the conditional.  For a test with multiple conditions, use DeMorgan's Law ([https://en.wikipedia.org/wiki/Demorgans_law Demorgan's Law]).  In brief, you will need to negate each individual conditional and then change all && to || or vice versa.\n\n==== Example 1 : Single Conditional (rows() from data.cc) ====\n{|\n!Before !! After\n|-\n|<pre>\n  octave_value retval;\n\n  if (args.length () == 1)\n    retval = args(0).rows ();\n  else\n    print_usage ();\n\n  return retval;\n</pre>\n|<pre>\n  octave_value retval;\n\n  if (args.length () != 1)\n    print_usage ();\n\n  retval = args(0).rows ();\n\n  return retval;\n</pre>\n|}\n\n==== Example 2 : Multiple Conditional (fopen() from file-io.cc) ====\n{|\n!Before !! After\n|-\n|<pre>\n  if (nargin > 0 && nargin < 4)\n    {\n      octave_value mode = (nargin == 2 || nargin == 3)\n                          ? args(1) : octave_value (\"r\");\n\n      octave_value arch = (nargin == 3)\n                          ? args(2) : octave_value (\"native\");\n\n      int fid = -1;\n\n      octave_stream os = do_stream_open (args(0), mode, arch, \"fopen\", fid);\n\n      if (os)\n        {\n          retval(1) = \"\";\n          retval(0) = octave_stream_list::insert (os);\n        }\n      else\n        {\n          int error_number = 0;\n\n          retval(1) = os.error (false, error_number);\n          retval(0) = -1.0;\n        }\n    }\n  else\n    print_usage ();\n</pre>\n|<pre>\n  if (nargin < 1 || nargin > 4)\n    print_usage ();\n\n  octave_value mode = (nargin == 2 || nargin == 3)\n                      ? args(1) : octave_value (\"r\");\n\n  octave_value arch = (nargin == 3)\n                      ? args(2) : octave_value (\"native\");\n\n  int fid = -1;\n\n  octave_stream os = do_stream_open (args(0), mode, arch, \"fopen\", fid);\n\n  if (os)\n    {\n      retval(1) = \"\";\n      retval(0) = octave_stream_list::insert (os);\n    }\n  else\n    {\n      int error_number = 0;\n\n      retval(1) = os.error (false, error_number);\n      retval(0) = -1.0;\n    }\n</pre>\n|}\n\n==== Example 3 : Redundant return statement ==== \n\n{|\n!Before !! After\n|-\n|<pre>\n  octave_value_list retval;\n\n  int nargin = args.length ();\n\n  // verify arguments\n  if (nargin != 2 && nargin != 4)\n    {\n      print_usage ();\n      return retval;\n    }\n</pre>\n|<pre>\n  octave_value_list retval;\n\n  int nargin = args.length ();\n\n  // verify arguments\n  if (nargin != 2 && nargin != 4)\n    print_usage ();\n</pre>\n|}\n\n== Detailed Instructions ==\n\nThe list of files which contain an instance of print_usage() is shown in the Files section of this page.  The actual instances, including line numbers, are shown in the Instances section.  To avoid duplication, sign up for a particular file by editing the Files section of this wiki page and replacing '???' with your name.  When you have edited a file you should verify that everything is okay by executing\n\n<pre>\nmake all\n./run-octave\ntest FILENAME\n</pre>\n\nWhen that passes, let a Maintainer know so that we can check in the changes.  Also, add the wiki tags <pre><strike> ... </strike></pre> to the Files section to cross the file off the list.  In addition, increment the number of files that were fixed by +1.\n\n== Files ==\n\nStart of Sprint\n\nTotal: 7\n\nFixed: 7\n\n{| class=\"wikitable\"\n!Owner !! File\n\n|-\n| <strike> Yu Liu </strike> || <strike> corefcn/syscalls.cc </strike>\n|-\n| <strike> Rik </strike> || <strike> corefcn/data.cc </strike>\n|-\n| <strike> mtmx </strike> || <strike> corefcn/file-io.cc </strike>\n|-\n| <strike> mtmx </strike> || <strike> dldfcn/chol.cc </strike>\n|-\n| <strike> mtmx </strike> || <strike> dldfcn/qr.cc </strike>\n|-\n| <strike> Andy </strike> || <strike> dldfcn/audiodevinfo.cc </strike>\n|-\n| <strike> mtmx </strike> || <strike> octave.cc </strike>\n|-\n\n|}\n\n== Instances ==\n\nStart of Sprint\n\nTotal: 83\n\nFixed: 7\n\n<pre>\ncorefcn/syscalls.cc:643:    print_usage ();\ncorefcn/syscalls.cc:662:    print_usage ();\ncorefcn/syscalls.cc:708:    print_usage ();\ncorefcn/syscalls.cc:735:    print_usage ();\ncorefcn/syscalls.cc:816:    print_usage ();\ncorefcn/syscalls.cc:882:    print_usage ();\ncorefcn/syscalls.cc:1005:    print_usage ();\ncorefcn/syscalls.cc:1028:    print_usage ();\ncorefcn/syscalls.cc:1051:    print_usage ();\ncorefcn/syscalls.cc:1074:    print_usage ();\ncorefcn/syscalls.cc:1097:    print_usage ();\ncorefcn/syscalls.cc:1120:    print_usage ();\ncorefcn/syscalls.cc:1143:    print_usage ();\ncorefcn/syscalls.cc:1166:    print_usage ();\ncorefcn/syscalls.cc:1182:    print_usage ();\ncorefcn/syscalls.cc:1231:    print_usage ();\ncorefcn/syscalls.cc:1266:    print_usage ();\ncorefcn/syscalls.cc:1347:    print_usage ();\ncorefcn/syscalls.cc:1369:    print_usage ();\ncorefcn/syscalls.cc:1413:    print_usage ();\ncorefcn/syscalls.cc:1437:    print_usage ();\ncorefcn/syscalls.cc:1463:    print_usage ();\ncorefcn/syscalls.cc:1488:    print_usage ();\ncorefcn/syscalls.cc:1512:    print_usage ();\ncorefcn/syscalls.cc:1534:    print_usage ();\ncorefcn/syscalls.cc:1562:    print_usage ();\ncorefcn/syscalls.cc:1577:    print_usage ();\n*corefcn/data.cc:2414:    print_usage ();\n*corefcn/data.cc:2584:    print_usage ();\n*corefcn/data.cc:2737:    print_usage ();\n*corefcn/data.cc:2823:    print_usage ();\n*corefcn/data.cc:7805:    print_usage ();\n*corefcn/data.cc:7823:    print_usage ();\n*corefcn/data.cc:7926:    print_usage ();\ncorefcn/file-io.cc:684:    print_usage ();\ndldfcn/chol.cc:695:    print_usage ();\ndldfcn/chol.cc:881:    print_usage ();\ndldfcn/chol.cc:1110:    print_usage ();\ndldfcn/chol.cc:1249:    print_usage ();\ndldfcn/qr.cc:1069:    print_usage ();\ndldfcn/qr.cc:1271:    print_usage ();\n/* These should possibly be using error rather than print_usage.\n   They are internal functions and print_usage() will print nothing valuable */ \ndldfcn/audiodevinfo.cc:2010:    print_usage ();\ndldfcn/audiodevinfo.cc:2038:        print_usage ();\ndldfcn/audiodevinfo.cc:2067:        print_usage ();\ndldfcn/audiodevinfo.cc:2096:        print_usage ();\ndldfcn/audiodevinfo.cc:2125:        print_usage ();\ndldfcn/audiodevinfo.cc:2154:        print_usage ();\ndldfcn/audiodevinfo.cc:2183:        print_usage ();\ndldfcn/audiodevinfo.cc:2212:        print_usage ();\ndldfcn/audiodevinfo.cc:2241:        print_usage ();\ndldfcn/audiodevinfo.cc:2270:        print_usage ();\ndldfcn/audiodevinfo.cc:2299:        print_usage ();\ndldfcn/audiodevinfo.cc:2326:    print_usage ();\ndldfcn/audiodevinfo.cc:2353:      print_usage ();\ndldfcn/audiodevinfo.cc:2389:        print_usage ();\ndldfcn/audiodevinfo.cc:2418:        print_usage ();\ndldfcn/audiodevinfo.cc:2447:        print_usage ();\ndldfcn/audiodevinfo.cc:2476:        print_usage ();\ndldfcn/audiodevinfo.cc:2503:    print_usage ();\ndldfcn/audiodevinfo.cc:2531:    print_usage ();\ndldfcn/audiodevinfo.cc:2536:    print_usage ();\ndldfcn/audiodevinfo.cc:2610:        print_usage ();\ndldfcn/audiodevinfo.cc:2639:        print_usage ();\ndldfcn/audiodevinfo.cc:2668:        print_usage ();\ndldfcn/audiodevinfo.cc:2697:        print_usage ();\ndldfcn/audiodevinfo.cc:2726:        print_usage ();\ndldfcn/audiodevinfo.cc:2755:        print_usage ();\ndldfcn/audiodevinfo.cc:2784:        print_usage ();\ndldfcn/audiodevinfo.cc:2813:        print_usage ();\ndldfcn/audiodevinfo.cc:2842:        print_usage ();\ndldfcn/audiodevinfo.cc:2871:        print_usage ();\ndldfcn/audiodevinfo.cc:2900:    print_usage ();\ndldfcn/audiodevinfo.cc:2965:        print_usage ();\ndldfcn/audiodevinfo.cc:3030:        print_usage ();\ndldfcn/audiodevinfo.cc:3059:        print_usage ();\ndldfcn/audiodevinfo.cc:3088:        print_usage ();\ndldfcn/audiodevinfo.cc:3117:        print_usage ();\ndldfcn/audiodevinfo.cc:3146:        print_usage ();\noctave.cc:240:    print_usage ();\noctave.cc:1022:    print_usage ();\noctave.cc:1057:    print_usage ();\noctave.cc:1084:    print_usage ();\noctave.cc:1107:    print_usage ();\n</pre>"
                    }
                ]
            }
        }
    }
}