Implementing Tic-Tac-Toe with Web Standard Technologies.
In the previous post we have mentioned a tutorial on how to implement the game tic-tac-toe using front-end technologies. Well, guess what? It is finished and you can download it for free!
Head to this link to download your free copy and start building now!
I do have plans for a second edition, it won't change dramatically. Still, I do have in mind formatting the inline code within the paragraphs with some coloring. Of course this will be in relation to the time constraints I am currently living with.
Yes! There is commercial video prepared to announce this tutorial. Enjoy it!
Deploying a website to the Oracle Cloud Infrastructure (OCI) using the free layer.
With Nginx acting as our web server we deploy a website to the OCI in the free layer they provide.
Again, I've followed the video format to present the content. There is also a follow up on adding SSL support for the website. Enjoy it.
Next, I am going to prepare a tutorial on how to implement the game tic-tac-toe using front-end technologies.
Stay tuned!
Deploying an Elixir/Phoenix Application to Gigalixir.
This entry is mostly to present the video related to the topic, which is all about deploying an Elixir/Phoenix application that uses SQLite to Gigalixir, as I've said in a previous post, this time I have adventured with the video format.
Here's the video, and here's the document tutorial in text format for your convenience. The authentication system provided by Phoenix is also being showcased.
Hope you guys like the stuff presented here and keep coming for more, because... Next in line is Scala, but first I think I am going to upload a video on how to deploy a website to Oracle Cloud Infrastructure since it has been quite a while since I have recorded the related screencast. So, keep an eye to the YouTube channel too.
Have a good one fellows.
SML Detour.
Well, I am revisiting some topics on Discrete Mathematics, and I am using this book for that purpose. It connects ideas from the Discrete Math area to the Functional Programming paradigm, while I am focusing on the Math part right now, sometimes I like to give a try to some proposed programming exercise in the book. If somehow you end on this situation, I have prepared a little detour to the SML programming language, which is targeted to people whom already know how to program. The book itself teaches how to program in case you are unfamiliar with the topic.
Using Linux? You fire the SML Interpreter with the sml command. I suppose you will familiarize yourself with the language using the REPL but code can also be stored in files using the .sml file extension and can be loaded into the interpreter session by means of specifying the file name at launch time, like $sml your_code.sml. The dollar sign $ belongs to the terminal prompt. The interpreter prompt is a dash, -.
The operator precedence respects the basic rules you already know, the tilde character, ~ is used as a negative sign. In the next line you can appreciate the need for semicolon.
- 67 + 4 * ~1; which results in val it = 63 : int. You can see the result type, the name it is how SML refers to the last result, you can reuse it in further computations for this session. Don't forget you can name your own variables.
You can't mix data types, there are helper functions to aid you with the task of operating on different data types, e.g. - 5.1 * real(1);. Resulting in val it = 5.1 : real. From here you can deduce that SML has type inference.
What about strings? A single character is preppended by the pound sign #, like this - #"q";. Yes, double quotes are still needed even for a single character. Resulting in a char data type, look: val it = #"q" : char.
Oh! Strings, right. You don't use the pound sign at the beginning, the double quotes remains the same, - "hello";. Giving you the next result: val it = "hello" : string. Yes, it is possible to define one character strings. String concatenation is achieved with the help of this ^ operator, there are of course several functions you expect to be there in order to interact with strings. Try it!
Your beloved tuples are present. You can access the components with #n, where n is the nth component you want to access. Here's an example: - (20, 99, ("Math", 3.9));. Resulting in val it = (20,99,("Math",3.9)) : int * int * (string * real). Pay special attention on how the data type is encoded for tuples. Now, let's suppose you want to grab "Math" from the tuple. Here's how you do it: - #1(#3(it));. Being the result as follows val it = "Math" : string. Get it?
hd, tl, ::, @, functions are for head, tail, cons, concatenation, respectively. Tail of what? You got it right, - [#"L", #"i", #"s", #"t", #"s", #"!"];. Lists! The recent computation ends being val it = [#"L",#"i",#"s",#"t",#"s",#"!"] : char list. You can have a list of lists, for example: - [[1, 2], [3, 4]]; which results in val it = [[1,2],[3,4]] : int list list. What about empty lists? You may ask, well, let's see it with our own eyes. - [];. Resulting in val it = [] : 'a list. As you can see there are parametric data types.
Last but not least, it is possible for you to declare your own types, you know the drill in and out, look for syntax! (Which reminds me another blog entry I have in mind).
(* See you next time with a Phoenix deployment, I'll adventure with video format to present the material. Stay tuned *). What's this construct being used for in SML?
HTDP.
OK, so you have an Open Indiana installation up and running, let's install Racket over it.
Let's first install gcc just in case you don't have it already.
In your terminal elevate your privileges by typing su.
perform an update with pkg update.
Time to restart your computer, once you are done with the process of restarting your computer open your terminal.
su again.
Install gcc with the next command: pkg install gcc-11.
With gcc --version you can verify your installation.
Now open your favorite web browser and download Racket, your version may be different that the one presented in the next steps.
By means of gunzipping (Extracting the files) the file you will be able to interact with the content of the downloaded file, so execute the next command: gunzip racket-8.10-src-builtpkgs.tgz.
If the above doesn't work for you, then use tar, like gunzip racket-8.10-src-builtpkgs.tgz.
Create the target installation folder: mkdir -p /opt/racket.
Now move to the source folder within the downloaded and extracted folder with cd racket-8.10/src.
It is a good practice to create a build folder just in case we mess something around we would be able to delete the folder and start over again, with that in mind, execute mkdir build && cd $_ .
Since we are inside the build folder, we are going to use configure in the parent folder, with ../configure --prefix=/opt/racket. Please note we are using our target installation folder in the --prefix parameter.
It may be the case you encounter the following # WARNING: term.h: present but cannot be compiled in the output from the configuration step above, it doesn't get in the way. It is time for us to actually install the Software.
Without leaving the terminal, please execute gmake.
Now gmake install.
And we are done! Let's exit the super user privileges with exit.
Is up to you to add Racket to the environment variables. In the meantime we are going to run Racket from the place where it was installed.
Fire Dr. Racket with /opt/racket/bin/drracket. and enjoy your session.