Another mode of improvement on top of yesterday’s PHP Anagram Levels Tutorial, as flagged, is to add a new select (ie. dropdown) element with language codes, in order to facilitate …
- still pick an English word at the level of difficulty selected … but …
- if user has selected a non-English language code (in that new dropdown) … then …
- if under the usage quota for that day, the excellent My Memory language Translation functionality is quizzed for a translation … that is …
- as per usual, scrambled, not stirred … and …
- as per usual, the user is asked to unscramble this Anagram … to …
- as per usual, increment the user’s game score
This is an initial draft involving language, and the unicode work is under scrutiny as time goes on.
To try today’s changed PHP anagrams.php third draft live run, feel free!
Previous relevant PHP Anagram Levels Tutorial is shown below.
We improve yesterday’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 ones, there could be more than one English word answer, and so we cater for that now via “the broad brush logic” …
- web application initially selects a word within that level of difficulty’s word length range …
- web application scrambles that default answer’s letters and presents it …
- 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 …
- 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
PHP arguments have two parts of the form …
name=value
… and today’s work lends itself, as far as we are concerned, to allowing the user to specify relevant “level of difficulty” arguments via either methodology of the sets of two rows in table below …
Level of Difficulty | name | = | value |
---|---|---|---|
Easiest | level | = | easiest |
Easiest | easiest | = | |
Easy | level | = | easy |
Easy | easy | = | |
Hard | level | = | hard |
Hard | hard | = | |
Difficult | level | = | difficult |
Difficult | difficult | = |
… as per, the PHP …
<?php
$eleven="11";
$thirteen="13";
if (isset($_GET['level'])) {
if ($_GET['level'] == 'easiest') {
$eleven="3";
$thirteen="5";
} else if ($_GET['level'] == 'easy') {
$eleven="5";
$thirteen="8";
} else if ($_GET['level'] == 'hard') {
$eleven="8";
$thirteen="11";
} else if ($_GET['level'] == 'difficult') {
$eleven="11";
$thirteen="13";
} else {
$eleven="11";
$thirteen="13";
}
} else if (isset($_GET['easiest'])) {
$eleven="3";
$thirteen="5";
} else if (isset($_GET['easy'])) {
$eleven="5";
$thirteen="8";
} else if (isset($_GET['hard'])) {
$eleven="8";
$thirteen="11";
} else if (isset($_GET['difficult'])) {
$eleven="11";
$thirteen="13";
} else {
$eleven="11";
$thirteen="13";
}
?>
Feel free to try today’s changed PHP anagrams.php second draft live run am sure you’ll agree with me we could think, into the future, of …
Previous relevant PHP Anagrams Tutorial is shown below.
We like the design and basis of the NetBeans Java Swing Anagrams Tutorial‘s Anagram program. So, today, we’re developing a PHP version of that 10 to 12 letter word Anagram word game.
As per all the inhouse PHP word games we can think of, the Linux (or macOS) “/usr/share/dict/words” 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.
As you try today’s PHP anagrams.php first draft live run am sure you’ll agree with me we could think, into the future, of …
- degrees of difficulty … at the moment we think it is too hard …
- languages other than English … needs thought and consideration
… and though it needs further thought, we’ve tinkered away at the first thought above, by trying to ensure our “/usr/share/dict/words” word gets a guernsey with our favourite free online dictionary, The Free Dictionary, thanks.
Previous relevant NetBeans Java Swing Anagrams Tutorial is shown below.
The last time we talked about the NetBeans IDE in relationship to Java and Swing we dealt with NetBeans JavaFX Swing Primer Tutorial as shown below.
Today we use a sample NetBeans project and add a little functionality to create a desktop Java Swing application for a word game about “anagrams” … jumbled letters you can turn into an English word … English is the language of the Java WordList used … hence the “English” qualification … Bachelor of Javlish … chortle, chortle.
Word games like this can be used by ESL teachers for the teaching of vocabulary, an important part of improving in any language.
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 “tie it down” so to speak.
As per “quite often” the usual Java Swing GUI suspects come into play … JFrame, JLabel, JTextField … but this time, also, a JUnit test class (the tutorial goes into the install of the plugin required for this, if not already installed). Are you on your toes yet?
Port de bras: 1st, 5th, and open to 2nd (1st port de bra)
So below we have some code that hopefully interests you …
- Anagrams.java changed from the New Project snapshot code as per this link … all the files below were as per New Project snapshot …
- About.java
- WordLibraryTest.java (JUnit test class)
- build.xml
… hope to see you again next time … desktop? web? … web? desktop? … deb? wesktop?
Previous relevant NetBeans JavaFX Swing Primer Tutorial is shown below.
The last time we talked about the NetBeans IDE it was with C, C++ NetBeans, gdbserver Debugging Primer Tutorial as shown below, and quite some time back. NetBeans for Mac has moved onto version 8.0.2 and today, wanted to show you a bit about the look of that and create a very simple JavaFX application that is like a desktop JApplet. You’ll have heard me a bit sad about the difficulty with Applet usage these days where we did the tutorial called Java Swing Line Graph Primer Tutorial 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 JApplet can be applied today, because we are creating a NetBeans JavaFX Swing project, and this Swing functionality will also get you a long way down the track to writing Java desktop GUI applications.
Today we also show how a Button can be placed in front of another Button, especially when you use the “frame.pack()” method, and how both Buttons still function. We also use a StackPane today, to which we “add” the two Buttons and a Text object, and today we also use a JFrame object, as we often do with Java Swing work.
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.
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 … woahhhhhhhhh!
So, what are the thoughts about “getting into Java” 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 …
- javac pieceOfCode.java
- java pieceOfCode
… only this simple for the simplest (non-package) scenarios … and, as such, doesn’t have to have complex “make” 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’s tutorial and some thoughts that Google puts to the top for such a discussion, for your perusal …
- programming languages – Will Java still be relevant in 5 years?
- Java: Still the Most Popular Programming Language …
- Picking A Programming Language? Python And Java Still Top
… and here is a useful tutorial for today’s discussion … see you soon, hopefully …
… and lastly, here is this tutorial’s Java downloadable programming source code you could call JavaFX_Swing_Application.java … am really going now.
Previous relevant C, C++ NetBeans, gdbserver Debugging Primer Tutorial is shown below.
Today’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 Xcode and its Command Line Tools Primer Tutorial in the sense that the installation of Xcode Command Line Tools (in earlier Xcode versions … think maybe less than 4 … “out of the box” it lived with C and C++’s great gcc compiler … have talked about this before … raved perhaps??!!! … anyway … that went away with the later versions … but you can get it back) “closes the circle” 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 … cute, huh?
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 tutorial below and that great link here.
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 tutorial below). By the way this broken record is available on iTunes (chortle, chortle).
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 here … you might need to research further?) … so thanks to Egor Ushakov for this great plugin.
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 … well, that’s true … set the others if you can … 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’ve ever seen. You can leave the decision for what you watch to that first breakpoint time, as you wish, also. Anyway, enjoy the tutorial.
Previous relevant Xcode and its Command Line Tools Primer Tutorial is shown below.
Xcode is a great GUI IDE application that comes with Macs “out of the box” (quite often). In the earlier versions … think maybe less than 4 … “out of the box” it lived with C and C++’s great gcc compiler … have talked about this before … raved perhaps??!!! … anyway … that went away with the later versions … 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’t already.
Remember at the end of the month to say “hares” as your last word and “rabbits” as the first word of the next month.
Do we need to explain?
Butterflies in Brazil and all … why buck what the whole world’s doing? … chortle, chortle.
Anyway, this action opens a pandora’s box of possibilities with your Mac, and hope if you are in this position … you can test if you are by attempting to go gcc at the Mac Terminal bash command line … how’s the coffee? (if PM, how’s the daquiri?)
To get started, visit this stupendous link. Then get into Xcode and go to Xcode->Preferences…->Downloads (and hopefully you see the Command Line Tools install button to press … press with both hands, either hand, while doing a triple pike, but … just … do … it!)
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.