Notes on codes, projects and everything
We were asked to develop a program that demonstrate Artificial Intelligence and apply what we had learned in class into the program. Then we came out with an idea to develop a program that is able to do tarot reading. At first the program did not have a GUI and is operated through Swi-Prolog interpreter but in the end we included a GUI-frontend for the program using XPCE.
First the program will require 3 random numbers from the user, then a random number will be generated as the seed. Then the card will be “shuffled” (in fact, we did some calculations to the user provided random numbers) and then determine the orientation of the card (normal and reversed). Then, we use the computed number to pick a tarot card and get the reading based on the orientation.
To shuffle the cards, we use a random number and place the random number into the formula such that $$c=x^y\text{ mod }23$$ where c is the corresponding card number, x is the user provided number and y is the system generated random number. Then the orientation of the card is determine by calculating the mod 2 of the random number.
To implement simple search strategy, we used a hash function to divide the total of 22 major arcana cards into 5 groups. Each group will have one individual database file storing the card characteristics and reading. Then, depending on the calculated number, the system will choose to query which database file to decrease the inclusion of database files. We may not be able to observe the performance enhancement as we only have 5 database files but it should be more obvious for system with more database files.
I am the developer for the GUI front-end. At first we planned to write the GUI using other languages/platforms but because of the time constraint we decided to give up on GUI front-end. However, I managed to pick up basic XPCE GUI construction just in time and made a GUI for the program. However, the GUI is not very friendly and is not able to display images. Because XPCE is a multi-platform supported toolkit therefore the appearance of the GUI is consistent in various supported operating system.
The program is reading input through prolog interpreter.
The program displays the result after computing the input.
The program is reading input through GUI
The program displays the result through the GUI
After reading through the documentation, I find that the role based ACL and work flow can be more tightly integrated. Therefore I made all the transaction into many FSMs and my work flow component now consists of one work flow library and one work flow management model. As I am going a more normalized design (I use denormalized design in work as it deals with a lot of documents, however for a small project like mine, a denormalized design should do well).
This is basically a small incremental update to my script published here. For some reason, the previous version of the script didn’t really work, so this release should fix the problem. Besides fixing the problem where the daemon did not actually launched at start up, I have added a settings applet for this script as well.
Javascript is getting so foreign to me these days, but mostly towards a better direction. So I recently got myself to learn react through work and the JSX extension makes web development bearable again. On the other hand, I picked up a little bit on Vue.js but really hated all the magic involved (No I don’t enjoy putting in code into quotes).
I was thinking whether it is possible to avoid exposing PDO and PDOStatement objects to the users of my database library (mainly just me). While I was working on my project I sort of notice that there is a almost fixed pattern whenever I work with the database. With this in mind, I added in some new functions to the library, and decided to make a quick release for this.
I am currently doing some organization to my blogs. Few weeks ago, after spending months struggling to work in Ubuntu 7.10, I learned about symbolic links. Then I thought this would be good for my project file management. Therefore I started to re-organize my project file structure to utilize symbolic links. One of the projects that uses symbolic link is the current wordpress theme.