Here is a summary of what happened this week. The task that I am working on right now is the generation of reports for the Competition. I have faced a lot of problems while doing this task and I will briefly explain them later. Before that, just to let you all know that, my lecturer from University of Malaya visited me on 8th August. The purpose of the visit is for them to check on what I am doing and also evaluate me. I am under the supervision of Dr. Edzrol and I am very glad that he loves what I am doing. He told me that, we have learnt all the physics in the classroom and it is very good that I am learning programming because he believes that in the future we need knowledge in both fields. He seems satisfied with what I am doing and hopefully the evaluation is in my favor!
Now, let’s start talking on the problems that I have faced while generating a report in PDF format for the Competition. First, I had a hard time figuring out how to use WTemplate for the design of the report because of the changing variables. For example, there are no fix number of participants in the events, therefore I could not designed them beforehand. What I have to do is that I have to customize a function in WTemplate so that it will determine how many rows are needed in each and every events. Very sad to say that, I haven’t figure this out. I was stuck for quite sometime and have decided to do it the manual way, the hard-coding way. I was pretty sure that, I could get it done by doing the hard-coding way, so I told myself that, let’s get it work first!
Even though I have a clear idea on how to do it the hard-coding way but I still have some problems with the database. One of the problems is that when I query a collection of pointers from the database, I could only use those pointers once. Again, I would like to thanks Wen Yan for his help. I seek for his help for this issue, then he told me that I could use std::map to overcome this problem. Basically, std::map is a sorted associative container that contains key-value pairs with unique keys. So, I could query from the database and take the information that I needed from the collection of pointers and assign them to a map. With his guidance, I can finally get the codes working the way I want them to be. However, another issue appeared, I have to get some information from another table. Again, Wen Yan helped me in this, he told me that, the previous intern has defined a collection of pointers to the another table as the member of the class that I am using. Therefore, I could easily get the information from another table. Now, I have all the information and I start designing the report. After everything is done, I have to test it. To do this, I have to add a new REST API endpoint so that when I send a CURL request to the specific endpoint I will receive a PDF report. Thankfully, everything is working now.
I showed Dr Shawn the reports that I have generated using the databases for 2018. He’s pretty satisfied with how they look but he suggested me to add lines between the rows so that it will be easier for the users to read. He told me that when we program something, we must always think of the users, make sure it is really user friendly. Besides, he also wants me to make sure that the report is not hard-coded. For example, he can easily make changes to the design of the report without touching the C++ code. Right now, I have hard-coded the report to do what I need them to do for the specific databases. However, there will be cases like the number of judges is different for some of the databases, therefore if I were to use the same codes, the report will be ruined!
I have three weeks left for this internship and 2 weeks to write codes and the last week to do the documentation of what I have done. Dr Shawn told me that I don’t have enough time to do the last task which is to verify whether the email is sent out or not. So, he wants me to get the report and the registration system done. For the registration system, I still have some bugs to fix and test and I will get them done by next week. Well, everything is working now, it’s just that they are hard-coded. The bad thing about hard-coding is that, the codes only run for one condition, if Dr Shawn wants to make some changes or the conditions changed, the codes might fail. So, my ultimate goal before leaving Aeste is make sure there’s no hard-coding inside my code! It’s really true when Dr Shawn said that, it’s very easy to hard-code everything to do what you want but it’s very hard to write the code to be simple and general and still gives you the same result. So, NO HARD-CODING!
0 Comments