2nd last end-of-semester post

Again, way too long since anything was posted so this place is presumably dead. Too lazy and also I don’t want to write stuff that are too personal that it invites criticism of me as a person. Nevertheless, another end-of-semester post/rant again. Should have been the last but I chose not to graduate early so it ended up being 2nd last. If I’m too lazy to write the last then this will be the last >.*

I’ll start with modules and why I took them.

CS3219 (software engineering module): I need this to clear my specialization. I didn’t like that there is no absolute correct answer to what principles and stuff to apply for any situation. Plus, good design may sometimes conflict with my preferred goal of squeezing every ounce of performance.

CS4224 Distributed Databases: Clear database specialization. Seems useful to know how database systems work in distributed environment. Project was tough but at least theories could be applied as considerations when designing and using the databases.

CS4234 Optimization Algorithms: Should have been a piece of cake but turns out it wasn’t. Only thing I am proud of is slavaging some marks in finals through pure luck.

MA2214 Combinatorics and Graphs: Clear math and science requirement. Supposed to be easy with CS1231 knowledge but lecturer likes to set questions that need (critical, higher order, whatever you name it) thinking.

LAJ2203 Japanese IV: Breadth module. Nearly failed my placement test to get into this module since Japanese III is not an option due to timetable issues. Interesting with opportunities to interact with Japanese students.

With these, I qualify for graduation but I still have a few interesting modules I want to take so I ended up dragging into a normal 4-year.

Not much time to dabble with my favourite task of server setup and provisioning since projects are mainly focussed on application layer and such setups are implicitly required to figure out by oneself to get environment working. Super low incentive to do it well given time constraints. Towards end of semester, was choking on 3 parallel projects. Not motivated to do revision during reading week and ended up binge watching Gintama. Exams of course became hard.

Took part in buddy programme with Japanese exchange student and went on a few outings with them. It was nice interacting with them even though I still struggled with Japanese when trying to say what I want to say.

Also went for career fair for working in Japan. Totally flopped and there goes my dream of living in Japan. Both companies I interned with gave me job offers though. Spent a long and antagonizing time making hard decision on which offer to accept. Since the companies are Japanese ones, there is still hope of going to Japan for a few years 🙂

Hoping my upcoming Japan trip would be fun. Was planning to chill by myself or with a friend but now that my parents are tagging along, it becomes stressful 😦 Still, I look forward to meeting Japanese friends there.

Holiday Post

It has been more than a month into the holidays and 4 weeks since the start of internship. It has been quite ok, normal experience so far. Nothing down, but nothing that exciting to talk about. The weekly game demos gave me some better idea of the kind of games that are out there. I have also learnt a little bit of new stuff during work: Docker configuration and web sockets. I have also came across a few Web application technology combinations, though some of them I can’t really say whether it is for the better or worse. I just hope to be able to put what I have picked up so far to good use in subsequent work.

Work-related stuff aside, I still feel very empty: waking up and ending work too tired to want to do anything. Somehow, every holiday,I end up isolated from everyone else. It happens too naturally that it is kind of scary… Life becomes a while(1){ work; sleep; } loop. Makes me wonder what kind of future there is for me. It didn’t help that things have been going downhill for me: grades that seemed pretty bad compared to past performances. and bugs that take hours or even days of brute force because I don’t understand how the framework works well enough and such.

While work is pretty much ok, I sure hope life will brighten up soon. Need to know what I can do to turn things around. First things first, catch more zzz so I don’t go around in zombie mode anymore. Hopefully the next post will be of a better mood. Until next time…

期末試験から

While the title is in Japanese, the post will not be in Japanese… So exams finally ended for me yesterday after 2 weeks of revision. Went to watch 「暗殺教室II」to end off everything. While there were some pleasant things this semester, things didn’t go as I hoped for those that mattered a bit more. I shall not mention to keep this short. Moving on to the modules I have taken this semester, keeping them to a few sentences…

LAJ2201 Japanese 2 (Grade A-): Classes and the learning process were fun and interesting, much unlike what I have been going through the past 5 semesters. Guaranteed A? Remains to be seen, since competition is known to be quite strong.

GEK2003 Government and Politics of Singapore (Grade B+): I don’t like writing essays but this module(or the lecturer) made Singapore’s politics interesting it made me more interested to watch(reading still turns me off) the news. Interesting lectures that drive home very important points, though I couldn’t really remember the facts.

SSA2220 Global Economic Dimensions of Singapore (Grade B): Can’t really seem to connect what was covered in lectures with Singapore’s current economy. The topic on money and currency was especially tough for me. At least the exams seem doable.

CS3223 Database Systems Implementation (Grade A+): My favourite CS module for the semester. Learning about the underlying implementations in order to learn how to optimize databases in the future. Exams were tough and tedious, one careless mistake, I think the bell curve will push you to the left…

CS3226 Web Programming (Grade B+): I wonder if I made the wrong choice to take this module. I was wrong to come in with the thought that it should be a farmable A given that I survived CS3216 and acquired the implementation techniques for web application. Turns out for the project it is not just about skills. One needs a good app idea that is not too hard to implement and can catch the attention of many people you know(typically NUS students but of course with exceptions) to do well for the project. Being not a creative person nor an app person, ending up leading the project was a disaster. Based on project score and the presence of strong bell curve, I doubt my grade can make it above a B+. Very hurtful to my ego and I am still sore about it. If I knew I would get a poor grade, I should have taken Parallel and Distributed Algorithms(which I couldn’t due to timetable clash), despite the potentially poor grade, at least I could have learnt something new.

Main takeaway for me was that I am really not an app person(I don’t use many apps in the first place). Not knowing what makes an app appealing to the masses, best development not security practices made things hard in the first place. Developing and optimizing systems seems more interesting than trying hard to appeal to people. Japanese was fun so I hope to take more Japanese classes in my remaining year. Now then, there are a few things I wish to learn/do, but then which one to start with?

Brave Frontier Grahdens and Owen Trial

It took me about 2 weeks to finally clear this trial. Have been trying many times when it just came out, looking at forum threads and videos to get the strategy and thresholds. While the guides are VERY important, they are still useless if you do not have the team to implement it. Most involve meta units like Charla and Isterio, which I do not have the fortune of drawing them. Since Omni-Evolution just came out a few days ago, I managed to get Selena to OE form and also got a 7* Owen friend, I decided to give it a try again. The following just describes what happened on my successful run, please READ the guide or watch the video before attempting or you will waste energy just like me.

Team(all not max Imped, max level and SBB unless stated otherwise)

  • Dolk(Leader, Buffer Jewel, Vorpal Chainblades): Mitigator, Atk->Def, negate elemental weakness LS, stat boost LS.
  • Fadahl(Buffer Jewel, Fallacy Orb): Status UBB, Injury and probable Atk down SBB. Use Isterio if you have.
  • Krantz(Existence Jewel, Impiety Orb): Mitigator, Burst heal, Light/Dark element attack.
  • Selena OE level 89(Lexida, Infidelity Orb): Superb HoT and BB per turn. Quite tanky despite the level.
  • Reeze(Reeze’s Armor, Heresy Orb): Cleanse/Negate ailments, Rec->Def SBB, probable Sick/Paralysis BB.
  • Owen 7*(Friend, Occult Treasure, Medblare): 50% all-stat boost LS, Injury BB, all-stat boost SBB.

Items: Only fujins and revives.

Comment on team: This team has a hard time maintaining BBs when against 1 enemy. Problem is even worse in stage 2. Reason for choices, offense-focussed team will get destroyed by Febros and Grahdens in stage 2. Damage too low, cannot prevent fodders from doing UBB. Get as many all-stat boost LS as possible. Have as many stackable Def buff BBs as possible, Owen’s Reeze’s and Dolk’s Def buffs stack. Status infliction(Sick, Injury, Paralysis) is needed to stop major nukes/BB drains. This team’s status infliction rate is not that awesome, so some luck is needed.

Stage 1: Owen

HP > 80%
Do not fujin/revive! This part is piece of cake. Keep up BB spam and Def buffs.

50% < HP < 80% “Duran, come out!”
Tankable. Kill latest right after he goes Overdrive.

30% < HP < 50% “Lilith, come with me!”
Use Reeze’s BB to keep Lilith paralyzed as much as possible. She hits hard, even with Injury and Atk-down. Kill her latest right after she goes Overdrive.

HP < 30% “Reviora… crush them!”
Painful. Since no STBB in the team, had to tank Reviora UBB and Owen’s 15% threshold.

Stage 2: Grahdens(3BB per turn max or get wrecked…)

Turn 2: Use status UBB and Reeze’s BB. Apocalypse Zero only cancellable by status ailments.

60% < HP < 80% “Febros, come along.”
Worst part of the stage. Keep as many Def buffs up as possible. Febros AoE every 2 turns and is painful with Grahdens’ follow-up attacks. Focus on Febros but don’t kill it too quickly. Leave it at around 10-15% HP when pushing Grahdens past 50% HP. Here is where you will end up using most of your revives.

50% < HP < 60% “Reud, I call you here”
Not painful at all. Easily inflicted with various status ailments. Push Grahdens past 50% HP and Febros near death ASAP. Febros killed Dolk here, so had to revive it.

HP < 50% “Your strength… give it to me…”
Grahdens will nuke 2 turns later. Kill Febros in the next 2 turns to prevent this. Spam BB/SBB as long as can kill Febros. If cannot do so, will get AoE, BB drain and permanent LS lock. Use more than 4 BBs to convert into 3-turn LS lock ASAP.

HP < 30% “Give me a hand, Drevas?”
Keep status null up and maintain tempo. No big deal here.

Stage 3: Owen + Grahdens

BB/SBB spam until Grahdens HP < 40%. Focus on Grahdens, keep Owen’s HP above 50%.
Every 4 turns: Make Grahdens Sick or get BB drained(Svate Rauben). Use Reeze BB from turns 2-4 to play safe.
Every 6 turns: Owen has damage reflect. Tankable with Selena’s HoT.
Never use items unless “Owen is in deep meditation”.

Grahdens HP < 70% “Grahdens is deep in concentration”
Do more than 50k damage or get LS locked permanently. BB spam is enough.

Grahdens/Owen HP < 50%
“Ho ho! I never imaged such strength. Very well, no more need to hold back, is there? I’ll unleash my full power. Show me your best move!”
0: “Hey Owen, it’s time for you-know-what!”, “Hmm…very well! Back me up then.”
1: “Spirits who find solitude in darkness”, “O burning spirit, in your body of steel.”
2: “Spirit of steel!”, “Wicked spirits of all creation!”
3. “Take this!”, “Now! Let’s finish this!”
4: “Underworld Wyrm Volzeanos” -> Game Over…
Can use items until the combo is cancelled. OD+Fujin Fadahl, UBB+BB spam, Reeze BB. Aim to deal 50k damage and a status ailment(Paralyse?) in 1-2 turns. Further down it will be hard to cancel the combo after 4 turns. Try to trigger this on the 1st turn of the 4-turn cycle, in case you unfortunately get hit by Svate Rauben and lack the BB gauges. The 1st turn is the best chance to deal enough damage. Subsequently, both will have 80% mitigation. You are safe when Grahdens says “Even more impressive than I thought” and Owen says “Grahdens! What are you doing?!”. From here on, Grahdens HP is most likely below 40%, BB limit is at most half the number of surviving units. If you have 5 units left, use at most 2 BB/SBBs.

Grahdens HP < 40%: Same as 70% threshold.

15% < Grahdens HP < 40%
Build up OD gauge as quickly as possible. Here I have no unit who can boost OD gauge on BB. Grahdens’ HP falls pretty fast here. So if you need more time to build up OD gauge, use fewer BBs but keep Def and Injury buffs up. Normal attacks build up OD gauge quickly. Alternatively, focus on Owen instead but keep his HP high.

Grahdens HP < 15% Overdrive
OD Dolk(3-turn 75% mitigation). Selena’s BB fill buff and BC drops should quickly fill UBB gauge. If Owen is in deep meditation, pop a fujin. UBB in the next 2 turns. Subsequently, kill Grahdens.

15% < Owen HP
Continuing using at most 3 BB/SBBs till the end. Damage gets more painful. Thankfully I was able to alternate between Def buff and Injury debuff. Fadahl almost died here… Make sure OD gauge is full before Owen’s HP goes below 15%. Use more normal attacks if necessary but keep Def and Injury up.

Owen HP < 15% Overdrive
OD Dolk again. Can OD 1 turn earlier if you can measure the 15% mark. Use UBB within 2 turns from here. Survive Whelm Ars Magna and go on to kill Owen.

Items used: 4 fujins, 1 revive

Plan your team properly. It is tough packing tons of utility into 6 units. Hope this helps if you don’t have the ideal units to clear this trial.

Nginx Setup for PHP with pretty Web API URL Support

Been trying to do this a few months ago for hosting a school project. It failed badly and I had to fallback to using Apache, which is easier to set up. Not that I have anything against Apache(used it for my Orbital project a few years back), just a change in preferences. This time, similar situation but maybe due to better understanding of the web server configurations(only slightly), I finally got it working after spending a few hours over a span of a few days.

There are MANY guides out there online on this topic already. I scoured through and tried a number of them, but all I got were 403, 500 and 502. Towards the end, I realised that if you get error 500, you already got the PHP code executed. It means your PHP code ran into runtime errors, which you should look for it in you Nginx error log. I will go through briefly the steps and finally provide a skeleton of a virtual host configuration that worked for me.

A few notes before I start, the paths to the configuration files vary slightly between Linux distros(I am using Arch on Raspberry Pi) but I will try to describe as distro-independent as possible.

First off, update the system, package manager and whatever you need. Then, install nginx and the PHP FastCGI package. For Ubuntu, it is
php5-fpm and for Arch it is php-fpm. This step is the easiest of them all. Digital Ocean has guides for Ubuntu and CentOS for such tasks and Arch wiki is pretty good in explaining how to do stuffs, especially what packages to install. You should have no problem with this at all.

Once the installation is done, you might want to make some tweaks in configuration for Nginx and PHP FPM. By default, the user is nginx or http in the configuration files. You can either change the user option in both configuration files(not a good practice? I still do it anyway for convenience) or apply the correct permissions to every folder along the way from the root to the target directory. For example, if your site’s document root is /a/b/c/d, you might want to do chmod 711 for directories a to d. Then, make sure the files to be served or run has read permission for others like nginx or http. If you choose to go the path of changing user and group parameters. go to the line with user in nginx.conf
and change it to your own username. For PHP FPM configuration file, go to the section starting with [www], change the value of user
and listen.owner to your own username. Note that this part is aimed at solving error 403.

The next step is to configure where should FastCGI listen for requests to PHP files. There are 2 options: through 127.0.0.1:9000
or UNIX socket. If using the former, do make sure that port 9000 is accessible from outside. Open the PHP FPM configuration file, go to the section starting with [www] , you will see 2 lines defining the parameter listen. One of them will be commented out with a semi-colon. Make sure the one you want is uncommented and vice versa. If using Unix socket, remember the fullpath of the Unix socket. Save and close the file. Note that you need to open as root for this and the previous part.

The last part can be very frustrating, the server block configurations. Wrong configurations can get you 502 Bad Gateway. On some systems, there are folders sites-available and sites-enabled. Otherwise, it is good practice to create these as subdirectories to the nginx directory. sites-available is where you will write your virtual host configurations and sites-enabled contains symlinks to the files in sites-available. Thus, you can turn on/off web applications by creating/removing symlinks. Make sure the line include sites-enabled/*.conf; exists in nginx.conf. The following configurations works for me, read the comments.


server {
  listen 80;  # port number
  server_name www.example.com;  #Web URL
  root /a/b/c/d; # Full path to project directory

  # The pretty URLs, pretty much like Apache's mod_rewrite
  # Refer to Nginx's rewrite syntax
  # Eg. rewrite ^/api/abc /a.php last;
  rewrite ^/api/abc /a.php last;

  # location regex string, read up online
  # I only used simple string matching
  location / { # The home page
    index index.html; # The home page file
  }

  # FastCGI config for requests for PHP files
  location ~ \.php$ {
    # Unix socket. This is for Arch.
    # Replace with the full path from earlier on.
    fastcgi_pass unix:/run/php-fpm/php-fpm.sock;

    # Uncomment this if not using Unix socket
    # fastcgi_pass 127.0.0.1:9000;

    include fastcgi.conf; # Path to fastcgi config file relative to nginx.conf
  }
}

Create the symlink to this file in sites-enabled. Restart PHP-FPM and Nginx and it should work. Hope this post has been helpful in setting up your LEMP.