{"id":51693,"date":"2021-02-17T03:01:38","date_gmt":"2021-02-16T17:01:38","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=51693"},"modified":"2021-02-17T20:53:27","modified_gmt":"2021-02-17T10:53:27","slug":"php-anagram-levels-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-anagram-levels-tutorial\/","title":{"rendered":"PHP Anagram Levels Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams.php\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Anagram Levels Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams_level.jpg\" title=\"PHP Anagram Levels Tutorial\"  \/><\/a><p class=\"wp-caption-text\">PHP Anagram Levels Tutorial<\/p><\/div>\n<p>We improve yesterday&#8217;s <a title='PHP Anagrams Tutorial' href='#phpat'>PHP Anagrams Tutorial<\/a> with a <i>level of difficulty<\/i> extension of functionality today.  We control difficulty via the length of selected anagram words, assuming shorter words will be easier to solve.  With those shorter anagrams, and for longer ones, there could be more than one English word answer, and so we cater for that now via &#8220;the broad brush logic&#8221; &#8230;<\/p>\n<ul>\n<li>web application initially selects a word within that level of difficulty&#8217;s word length range &#8230;<\/li>\n<li>web application scrambles that default answer&#8217;s letters and presents it &#8230;<\/li>\n<li>if the answer is the default word the user scores one and no need for step below, but the user may also answer with a word that is indeed an anagram of initial word but is not default word, in which case &#8230;<\/li>\n<li>we check back with the \/usr\/share\/dict\/words PHP helper to see whether this user answer is a valid word and recheck that there is a one to one correspondence of letters with that initial word, and if so, the user scores one for this non-default (but correct) answer<\/li>\n<\/ul>\n<p>PHP arguments have two parts of the form &#8230;<\/p>\n<p><code><br \/>\nname=value<br \/>\n<\/code><\/p>\n<p> &#8230; and today&#8217;s work lends itself, as far as we are concerned, to allowing the user to specify relevant &#8220;level of difficulty&#8221; arguments via either methodology of the sets of two rows in table below &#8230;<\/p>\n<table>\n<tr>\n<th>Level of Difficulty<\/th>\n<th>name<\/th>\n<th>=<\/th>\n<th>value<\/th>\n<\/tr>\n<tr>\n<td>Easiest<\/td>\n<td>level<\/td>\n<td>=<\/td>\n<td>easiest<\/td>\n<\/tr>\n<tr>\n<td>Easiest<\/td>\n<td>easiest<\/td>\n<td>=<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Easy<\/td>\n<td>level<\/td>\n<td>=<\/td>\n<td>easy<\/td>\n<\/tr>\n<tr>\n<td>Easy<\/td>\n<td>easy<\/td>\n<td>=<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Hard<\/td>\n<td>level<\/td>\n<td>=<\/td>\n<td>hard<\/td>\n<\/tr>\n<tr>\n<td>Hard<\/td>\n<td>hard<\/td>\n<td>=<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Difficult<\/td>\n<td>level<\/td>\n<td>=<\/td>\n<td>difficult<\/td>\n<\/tr>\n<tr>\n<td>Difficult<\/td>\n<td>difficult<\/td>\n<td>=<\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<p> &#8230; as per, the PHP &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\n  $eleven=\"11\";<br \/>\n  $thirteen=\"13\";<br \/>\n<br \/>\n if (isset($_GET['level'])) {<br \/>\n<br \/> <br \/>\n if ($_GET['level'] == 'easiest') {<br \/>\n  $eleven=\"3\";<br \/>\n  $thirteen=\"5\";<br \/>\n } else if ($_GET['level'] == 'easy') {<br \/>\n  $eleven=\"5\";<br \/>\n  $thirteen=\"8\";<br \/>\n } else if ($_GET['level'] == 'hard') {<br \/>\n  $eleven=\"8\";<br \/>\n  $thirteen=\"11\";<br \/>\n } else if ($_GET['level'] == 'difficult') {<br \/>\n  $eleven=\"11\";<br \/>\n  $thirteen=\"13\";<br \/>\n } else {<br \/>\n  $eleven=\"11\";<br \/>\n  $thirteen=\"13\";<br \/>\n }<br \/>\n<br \/> <br \/>\n } else if (isset($_GET['easiest'])) {<br \/>\n  $eleven=\"3\";<br \/>\n  $thirteen=\"5\";<br \/>\n } else if (isset($_GET['easy'])) {<br \/>\n  $eleven=\"5\";<br \/>\n  $thirteen=\"8\";<br \/>\n } else if (isset($_GET['hard'])) {<br \/>\n  $eleven=\"8\";<br \/>\n  $thirteen=\"11\";<br \/>\n } else if (isset($_GET['difficult'])) {<br \/>\n  $eleven=\"11\";<br \/>\n  $thirteen=\"13\";<br \/>\n } else {<br \/>\n  $eleven=\"11\";<br \/>\n  $thirteen=\"13\";<br \/>\n }<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p>Feel free to try <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams.php-GETME\" title=\"anagrams.php\">today&#8217;s changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams.php-GETME\" title=\"anagrams.php\">PHP anagrams.php<\/a> second draft <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams.php\" title=\"Click picture\">live run<\/a> am sure you&#8217;ll agree with me we could think, into the future, of &#8230;<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-anagram-levels-tutorial\/'>PHP Anagram Levels Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpat'>Previous relevant <a target=_blank title='PHP Anagrams Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-anagrams-tutorial\/'>PHP Anagrams Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams.php\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Anagrams Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams.jpg\" title=\"PHP Anagrams Tutorial\"  \/><\/a><p class=\"wp-caption-text\">PHP Anagrams Tutorial<\/p><\/div>\n<p>We like the design and basis of the <a title='NetBeans Java Swing Anagrams Tutorial' href='#nbjsat'>NetBeans Java Swing Anagrams Tutorial<\/a>&#8216;s Anagram program.  So, today, we&#8217;re developing a PHP version of that 10 to 12 letter word Anagram word game.<\/p>\n<p>As per all the inhouse PHP word games we can think of, the Linux (or macOS) &#8220;\/usr\/share\/dict\/words&#8221; inbuilt dictionary can come in handy here for the picking of words to ask the user about after presenting them with a Scrambled Word presentation to work off.<\/p>\n<p>As you try today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams.php_GETME\" title=\"anagrams.php\">PHP anagrams.php<\/a> first draft <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/anagrams.php\" title=\"Click picture\">live run<\/a> am sure you&#8217;ll agree with me we could think, into the future, of &#8230;<\/p>\n<ul>\n<li>degrees of difficulty &#8230; at the moment we think it is too hard &#8230;<\/li>\n<li>languages other than English &#8230; needs thought and consideration<\/li>\n<\/ul>\n<p> &#8230; and though it needs further thought, we&#8217;ve tinkered away at the first thought above, by trying to ensure our &#8220;\/usr\/share\/dict\/words&#8221; word gets a guernsey with our favourite free online dictionary, <a href=\"https:\/\/www.thefreedictionary.com\">The Free Dictionary<\/a>, thanks.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-anagrams-tutorial\/PHP Anagrams Tutorial<\/a>.<\/p-->\n<hr>\n<p id='nbjsat'>Previous relevant <a target=_blank title='NetBeans Java Swing Anagrams Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/netbeans-java-swing-anagrams-tutorial\/'>NetBeans Java Swing Anagrams Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"NetBeans JavaFX Swing Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/Anagrams-12of.jpg\" title=\"NetBeans Java Swing Anagrams Tutorial\"  \/><\/a><p class=\"wp-caption-text\">NetBeans Java Swing Anagrams Tutorial<\/p><\/div>\n<p>The last time we talked about the NetBeans <a target=_blank title='Integrated Development Environment information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment'>IDE<\/a> in relationship to Java and Swing we dealt with <a target=_blank title='NetBeans JavaFX Swing Primer Tutorial' href='#njspt'>NetBeans JavaFX Swing Primer Tutorial<\/a> as shown below.<\/p>\n<p>Today we use a sample NetBeans project and add a little functionality to create a desktop Java Swing application for a word game about &#8220;anagrams&#8221; &#8230; jumbled letters you can turn into an English word &#8230; English is the language of the Java WordList used &#8230; hence the &#8220;English&#8221; qualification &#8230; Bachelor of Javlish &#8230; chortle, chortle.<\/p>\n<p>Word games like this can be used by <a target=_blank title='ESL information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/English_as_a_second_or_foreign_language'>ESL<\/a> teachers for the teaching of vocabulary, an important part of improving in any language.<\/p>\n<p>The extra bit of functionality we add to the sample data is that we optionally allow you to enter up to five letters that should happen in the word chosen (if this is possible within 14000 choices) to &#8220;tie it down&#8221; so to speak.<\/p>\n<p>As per &#8220;quite often&#8221; the usual Java Swing GUI suspects come into play &#8230; <a target=_blank title='JFrame info' href='https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/javax\/swing\/JFrame.html'>JFrame<\/a>, <a target=_blank title='JLabel info' href='https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/javax\/swing\/JLabel.html'>JLabel<\/a>, <a target=_blank title='JTextField info' href='https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/javax\/swing\/JTextField.html'>JTextField<\/a> &#8230; but this time, also, a <a target=_blank title='JUnit info' href='http:\/\/www.oracle.com\/technetwork\/articles\/server-side-unit-tests-096611.html'>JUnit<\/a> test class (the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/\" title=\"click picture\">tutorial<\/a> goes into the install of the plugin required for this, if not already installed).   Are you on your <a target=_blank title='?' href='http:\/\/www.docstoc.com\/docs\/145748071\/PRE-BALLET-_ages-4_-5_-and-6_-4-year-olds-have-a-short-attention'>toes<\/a> yet?<\/p>\n<blockquote><p>\nPort de bras: 1<sup>st<\/sup>, 5<sup>th<\/sup>, and open to 2<sup>nd<\/sup> (1<sup>st<\/sup> port de bra)\n<\/p><\/blockquote>\n<p>So below we have some code that hopefully interests you &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/Anagrams.java-GETME\" title=\"Anagrams.java\">Anagrams.java<\/a> changed from the New Project snapshot code as per <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/Anagrams.java-GETME\" title=\"Anagrams.java\">this link<\/a> &#8230; all the files below were as per New Project snapshot &#8230;<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/About.java-GETME\" title=\"About.java\">About.java<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/WordLibraryTest.java-GETME\" title=\"WordLibraryTest.java\">WordLibraryTest.java<\/a> (JUnit test class)<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/build.xml-GETME\" title=\"build.xml\">build.xml<\/a><\/li>\n<p><!--li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Anagram\/built-jar.properties-GETME\" title=\"built-jar.properties\">built-jar.properties<\/a><\/li-->\n<\/ul>\n<p> &#8230; hope to see you again next time &#8230; desktop? web? &#8230; web? desktop? &#8230; deb? wesktop?<\/p>\n<hr \/>\n<p id='njspt'>Previous relevant <a target=_blank title='NetBeans JavaFX Swing Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=12957'>NetBeans JavaFX Swing Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/JavaFX\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"NetBeans JavaFX Swing Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Java\/JavaFX\/JavaFX-95of.jpg\" title=\"NetBeans JavaFX Swing Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">NetBeans JavaFX Swing Primer Tutorial<\/p><\/div>\n<p>The last time we talked about the NetBeans <a target=_blank title='Integrated Development Environment information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment'>IDE<\/a> it was with <a target=_blank title='C, C++ NetBeans, gdbserver Debugging Primer Tutorial' href='#ccngdpt'>C, C++ NetBeans, gdbserver Debugging Primer Tutorial<\/a> as shown below, and quite some time back.   NetBeans for Mac has moved onto <a target=_blank title='NetBeans download' href='https:\/\/netbeans.org\/downloads\/index.html'>version 8.0.2<\/a> and today, wanted to show you a bit about the look of that and create a very simple <a target=_blank title='JavaFX information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/JavaFX'>JavaFX<\/a> application that is like a desktop JApplet.   You&#8217;ll have heard me a bit sad about the difficulty with Applet usage these days where we did the tutorial called <a target=_blank title='Java Swing Line Graph Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=10592'>Java Swing Line Graph Primer Tutorial<\/a> and those sentiments are still true, but JavaFX is not just about JApplets, but is a lot about desktop GUI ideas, and lots of things you use for a <a target=_blank title='JApplet thoughts' href='http:\/\/stackoverflow.com\/questions\/3497889\/difference-between-jpanel-jframe-jcomponent-and-japplet'>JApplet<\/a> can be applied today, because we are creating a NetBeans JavaFX <a target=_blank title='Java Swing information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Swing_(Java)'>Swing<\/a> project, and this Swing functionality will also get you a long way down the track to writing Java desktop GUI applications.<\/p>\n<p>Today we also show how a Button can be placed in front of another Button, especially when you use the <a target=_blank title='frame.pack() inherited from window.pack() ... info' href='http:\/\/docs.oracle.com\/javase\/6\/docs\/api\/java\/awt\/Window.html#pack%28%29'>&#8220;frame.pack()&#8221;<\/a> method, and how both Buttons still function.  We also use a <a target=_blank title='StackPane object' href='http:\/\/docs.oracle.com\/javase\/8\/javafx\/api\/javafx\/scene\/layout\/StackPane.html'>StackPane<\/a> today, to which we &#8220;add&#8221; the two Buttons and a Text object, and today we also use a JFrame object, as we often do with Java Swing work.<\/p>\n<p>NetBeans 8.0.2 looks good and co-exists fine with Xcode (we have 6.1.1), which may be an important consideration for you.<\/p>\n<p>A full NetBeans install will allow you to organize PHP projects, which is quite a good feature, if you feel like your PHP needs reining in &#8230; woahhhhhhhhh!<\/p>\n<p>So, what are the thoughts about &#8220;getting into Java&#8221; these days?  Personally, would like to keep in touch with any language that can go across so many platforms, and that I feel (if installed) you could write a quick and functional command line piece of code that has that simple classic arrangement &#8230;<\/p>\n<ul>\n<li>javac pieceOfCode.java<\/li>\n<li>java pieceOfCode<\/li>\n<\/ul>\n<p>&#8230; only this simple for the simplest (non-package) scenarios &#8230; and, as such, doesn&#8217;t have to have complex <a target=_blank title='Make (file) information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Make_%28software%29'>&#8220;make&#8221;<\/a> files.  So, for me, Java will probably always be a consideration, let alone to do with its role in Android mobile development, and will leave you with a recap of today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/JavaFX\/\" title='Click picture'>tutorial<\/a> and some thoughts that Google puts to the top for such a discussion, for your perusal &#8230;<\/p>\n<ul>\n<li><a target=_blank title='programming languages - Will Java still be relevant in 5 years?' href='http:\/\/programmers.stackexchange.com\/questions\/262\/will-java-still-be-relevant-in-5-years'>programming languages &#8211; Will Java still be relevant in 5 years?<\/a><\/li>\n<li><a target=_blank title='Java: Still the Most Popular Programming Language ...' href='http:\/\/adtmag.com\/articles\/2013\/08\/15\/java-most-popular-2013.aspx'>Java: Still the Most Popular Programming Language &#8230;<\/a><\/li>\n<li><a target=_blank title='Picking A Programming Language? Python And Java Still Top' href='http:\/\/www.lifehacker.com.au\/2014\/02\/picking-a-programming-language-python-and-java-still-top-the-charts\/'>Picking A Programming Language? Python And Java Still Top<\/a><\/li>\n<\/ul>\n<p>&#8230; and here is a useful tutorial for today&#8217;s discussion &#8230; see you soon, hopefully &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Integrating JavaFX into Swing Applications ... involving Oracle' href='http:\/\/docs.oracle.com\/javafx\/2\/swing\/swing-fx-interoperability.htm'>Integrating JavaFX into Swing Applications<\/a><\/li>\n<\/ul>\n<p>&#8230; and lastly, here is this tutorial&#8217;s Java downloadable programming source code you could call <a target=_blank title='JavaFX_Swing_Application.java' href=\"http:\/\/www.rjmprogramming.com.au\/Java\/JavaFX\/JavaFX_Swing_Application.java_GETME\">JavaFX_Swing_Application.java<\/a> &#8230; am really going now.<\/p>\n<hr \/>\n<p id='ccngdpt'>Previous relevant <a target=_blank title='C, C++ NetBeans, gdbserver Debugging Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=6158'>C, C++ NetBeans, gdbserver Debugging Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/gdbserver\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"C, C++ NetBeans, gdbserver Debugging Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/gdbserver\/NetBeans_gdbserver-163of.jpg\" title=\"C, C++ NetBeans, gdbserver Debugging Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">C, C++ NetBeans, gdbserver Debugging Primer Tutorial<\/p><\/div>\n<p>Today&#8217;s tutorial is about debugging C (and C++ can be done too) using the gdbserver plugin in the NetBeans IDE, and its progression brought into play issues regarding the upgrade of Xcode 4 to Xcode 5 (and Mac OS 10.7.5 to Mac OS X Mavericks 10.9.1) made here (to facilitate IOS 7 development in Xcode), and the whole scenario has come about as a consequence of <a target=_blank title='Xcode and its Command Line Tools Primer Tutorial' href='#xxaicltpt'>Xcode and its Command Line Tools Primer Tutorial<\/a> in the sense that the installation of Xcode Command Line Tools (in earlier Xcode versions &#8230; think maybe less than 4 &#8230; &#8220;out of the box&#8221; it lived with C and C++&#8217;s great gcc compiler &#8230; have talked about this before &#8230; <a target=_blank title='rave' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4844#hfafodm'>raved<\/a> perhaps??!!! &#8230; anyway &#8230; that went away with the later versions &#8230; but you can get it back) <i>&#8220;closes the circle&#8221;<\/i> on the separation of C and C++, at least as far as NetBeans is concerned, so that we can use the installed Xcode Command Line Tool gcc compiler for C work and use the GNU compiler for C++ in NetBeans &#8230; cute, huh?<\/p>\n<p>The bottom line is, when you upgrade from Xcode 4 to Xcode 5 the command line functionality will disappear, but you can resurrect it, and we bring your attention back to the <a target=_blank title='Xcode and its Command Line Tools Primer Tutorial' href='#xxaicltpt'>tutorial<\/a> below and that great link <a target=_blank title='Xcode command line tools link' href='http:\/\/stackoverflow.com\/questions\/9329243\/xcode-4-4-and-later-install-command-line-tools'>here<\/a>.<\/p>\n<p>So all this just gets us back to square one with NetBeans, and the first slides of the tutorial may seem a bit irrelevant to gdbserver, but they are showing the restoration of the relationship Xcode and NetBeans can have if the Xcode command line functionality is intact (but read more about this in the <a target=_blank title='Xcode and its Command Line Tools Primer Tutorial' href='#xxaicltpt'>tutorial<\/a> below).   By the way this broken record is available on iTunes (chortle, chortle).<\/p>\n<p>Okay, back with debugging for C (and C++ also) in NetBeans using gdbserver.   We, in this tutorial, only show (a very simple example of) local debugging, but what about remote debugging (read more <a target=_blank title='gdbserver remotely on NetBeans' href='http:\/\/netbeans-org.1045718.n5.nabble.com\/Is-it-possible-to-use-gdb-gdbserver-for-remote-debugging-C-C-programs-in-netbeans-td2923778.html'>here<\/a> &#8230; you might need to research further?) &#8230; so thanks to Egor Ushakov for this great plugin.<\/p>\n<p>Debugging in gdbserver or gdb (or most debuggers) uses terminology like breakpoint (place where you stop), watch (find the values in variables and structures), step into (progress forward one line of code), step over (step over some code), continue (let debugger run the code to the next breakpoint) and restart (start the debugging session again).   So the sensible first thing before you start a debugging session is to imagine the best place to position that first breakpoint (but bear in mind the program may have other ideas, and that you should be ready for the program to actually lob on a number of different possible places, (especially) if your debug place of interest is well into the execution sequence of your program).   Why only worry about the first breakpoint &#8230; well, that&#8217;s true &#8230; set the others if you can &#8230; but sometimes you can only do this on getting to that first break, and either\/both possibilities of use are okay with gdbserver or gdb or any other debugger I&#8217;ve ever seen.   You can leave the decision for what you watch to that first breakpoint time, as you wish, also.   Anyway, enjoy the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/gdbserver\/\" title='Click picture'>tutorial<\/a>.<\/p>\n<hr \/>\n<p id='xxaicltpt'>Previous relevant <a target=_blank title='Xcode and its Command Line Tools Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=5530'>Xcode and its Command Line Tools Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/Xcode_command_line_tools.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Xcode and its Command Line Tools Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Xcode\/Xcode_command_line_tools.jpg\" title=\"Xcode and its Command Line Tools Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Xcode and its Command Line Tools Primer Tutorial<\/p><\/div>\n<p>Xcode is a great GUI IDE application that comes with Macs &#8220;out of the box&#8221; (quite often).  In the earlier versions &#8230; think maybe less than 4 &#8230; &#8220;out of the box&#8221; it lived with C and C++&#8217;s great gcc compiler &#8230; have talked about this before &#8230; <a target=_blank title='rave' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4844#hfafodm'>raved<\/a> perhaps??!!! &#8230; anyway &#8230; that went away with the later versions &#8230; but you can get it back.   Why bother?   If you like to look around and do those great command line offerings like Tcl\/Tk or just plain simple C (like we do in this tutorial), as well as leaving your Xcode GUI C++ and Objective-C iOS mobile development intact, then think you should install Xcode Command Line Tools, like, yesterday, if you haven&#8217;t already.<\/p>\n<p>Remember at the end of the month to say &#8220;hares&#8221; as your last word and &#8220;rabbits&#8221; as the first word of the next month.<\/p>\n<p>Do we need to explain?<\/p>\n<p>Butterflies in Brazil and all &#8230; why buck what the whole world&#8217;s doing? &#8230; chortle, chortle.<\/p>\n<p>Anyway, this action opens a pandora&#8217;s box of possibilities with your Mac, and hope if you are in this position &#8230; you can test if you are by attempting to go <i>gcc<\/i> at the Mac Terminal bash command line &#8230; how&#8217;s the coffee? (if PM, how&#8217;s the daquiri?)<\/p>\n<p>To get started, visit this stupendous <a target=_blank title='Xcode command line tools link' href='http:\/\/stackoverflow.com\/questions\/9329243\/xcode-4-4-and-later-install-command-line-tools'>link<\/a>.   Then get into Xcode and go to Xcode->Preferences&#8230;->Downloads (and hopefully you see the Command Line Tools install button to press &#8230; press with both hands, either hand, while doing a triple pike, but &#8230; just &#8230; do &#8230; it!)<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d5519' onclick='var dv=document.getElementById(\"d5519\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?cat=15\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d5519' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d6158' onclick='var dv=document.getElementById(\"d6158\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=debugging\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d6158' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d12957' onclick='var dv=document.getElementById(\"d12957\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=NetBeans\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d12957' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d13824' onclick='var dv=document.getElementById(\"d13824\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=NetBeans\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d13824' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d51689' onclick='var dv=document.getElementById(\"d51689\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/game\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d51689' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d51693' onclick='var dv=document.getElementById(\"d51693\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/arguments\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d51693' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We improve yesterday&#8217;s PHP Anagrams Tutorial with a level of difficulty extension of functionality today. We control difficulty via the length of selected anagram words, assuming shorter words will be easier to solve. With those shorter anagrams, and for longer &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-anagram-levels-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[73,1835,326,3024,388,429,476,2431,707,885,932,997,1319,1452,1453],"class_list":["post-51693","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-anagram","tag-arguments","tag-dictionary","tag-difficulty","tag-english","tag-file_get_contents","tag-game","tag-letter","tag-linux","tag-operating-system-2","tag-php","tag-programming","tag-tutorial","tag-word","tag-word-game"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51693"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=51693"}],"version-history":[{"count":4,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51693\/revisions"}],"predecessor-version":[{"id":51703,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51693\/revisions\/51703"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=51693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=51693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=51693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}