Time flies and it has been a month already since I started my internship at Aeste. In my blog last week, I mentioned about my first task, which is to add a template to replace the currently hard-coded registration slip using WTemplate. However, Dr Shawn suggested me to start with the email first because it is simpler as we only have to get the name of the registrant from the database. The task is similar, I just have to use WTemplate to replace the hard-coded email content. I started by looking at the WTemplate class reference to understand how it works. Like I mentioned before, I only have the class reference to refer to because there are not much tutorials on the internet. Honestly, I still have a lot more to understand on WTemplate itself and I am struggling because I am not familiar with the C++ syntax. Of course, it is not an excuse and I will have to work hard on it. Come on, you can do this! Right now, I am able to create a new WTemplate widget, set the template text by using the external file containing the email content we wanted, bind the required information and finally render the template into a string stream so that I can the pass the output as a string to the variable that is in charge of the email content. Basically, it s done but I still have to try to run the code to confirm that it is working. That’s where the problem came in.

I have a tough time figuring out how to test the application. Luckily, I have my colleague, Gabriel to ask from. He did the registration application during his internship. He told me that, there are two ways for me to test whether my code is working or not. The first way is to run the test script that he had created before or else I can set up a virtual store and try to make order from the store. The latter simulates the real flow of the actual application where I have to setup a store in WordPress using WooCommerce plugin and make order through it. Once the order is made, the registrant information will be sent to our registration application through webhook and save in a database. Once they have made payment, we will send them a confirmation email with the registration slip attached. So, I thought that it is a great way for me to test my code as I just have to make an order using my email address and if I received the confirmation letter in return then “Voila”, it is working! Things are not going my way, I setup the virtual store successfully, the information is passed to our system successfully, database is created perfectly fine, but when I change the status of the order to complete I get an error while sending the email. At that time, I am not sure whether it is because of my code that the application is not running as it should. So I go back to the original source code using git and try to run it again. Unfortunately, I received the same error. I couldn’t figure out what is the cause of the issue and I felt really helpless that time because I do not know what to do. I proceed with the another way of testing, I tried to run the test script with my new code and I do receive the confirmation email in return. So, to confirm that the application is using my template, I added some new line in the email content and try to run it again. Surprisingly, the email that I have received did not contain the new line that I have added. Arrgghhhh, what is happening?

On Saturday, I told Dr Shawn the problems that I am facing and I need some helps. For the test script issue, he said that is not possible, how can you receive an email that is not using the content that you have set. It is like telling someone that I have remove the wings of the airplane and it is still flying. I couldn’t agree anymore, it is not logic and there might be some issue happening some where. I showed him code and immediately he spotted an error, it is the location of my email content text file. He told me that, the file should be located at the directory where the application is running from. That’s the first issue and when I showed him my second problem which is with the virtual store, I told him that I have tried both using my new code and the original source code and both were not working. His first reaction was like ” what?!”, if your foundation is not working already of course the new things will not work as well lah! Then, he told me that, when I am doing anything, always make sure that you start from the bottom. Make sure the foundation is stable and working perfectly before you move on layer by layer. Afterward, he sat down and started looking at the error log messages. I am really impressed by how he figures out the causes of the issue layer by layer. Gabriel was with us also that time, and it was great working together and trying to solve the problem. I didn’t manage to help much or give any comments but I have learnt something from both of them. We are still having some problems with the virtual store right now so next week I want to make sure my new code is working by proving it through running the test script. This week is not a smooth journey, I have faced so many problems, but yeah, we learn new things from them. My goal next week is to make sure my code replacing the hard-coded email content is working perfectly fine!

Not forget to mention, Dr Shawn gave us a brief talk on Intellectual Property as well this week. Basically, it covers the differences between patent, copyright and also trademark. He also shared with the differences of open source software and free software. It was a fruitful session with a lots of new knowledge.

 


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.