# Tag Archives: nus

## NUSSU Elections 2015 – Facts Consolidated

Disclaimer:

I am an outsider to the NUSSU Exco Elections 2015 (except for the fact that I am eligible to vote). I consolidated the information to serve as reference for anyone.

All information gathered from Facebook pages and NUSSU Website.

## General Information on NUSSU Elections 2015:

Exco Elections 2015

• NUSSU Website

NUSSU Elections: Who’s Running & Why You Should Care – The Ridge Magazine

## Contesting Teams (in alphabetical order):

A Union That Cares

Team U

## Incident 1 – August 23

• 20150823 EDC15 – Dispute Submission 1.jpg
• Summary Judgement of the Union Election Dispute Committee (“EDC”) – EDC 15/01

## Discussions about NUSSU Elections on NUS Whispers

Cover photo from http://www.cibsejournal.com/cibse-news/make-your-vote-count-in-cibse-elections/

## 2014/15 Sem 2 Module Review

Below is my module review for Academic Year 14/15 Semester 2, my second semester in year 2.

## CS3230 Design and Analysis of Algorithms

This module is one of the core modules for CS major. And it builds on top of CS2020 (or CS2010). Most of the algorithms covered in CS3230 are already taught in CS2020. The additional work is to “analyse” them or “design” some algorithm that fulfills certain requirements. In addition to giving algorithms, complete answers for this module require certain amount of proving, including correctness, termination, and analysis of running time. Apart from the usual graph algorithms, this module also touches on complexity classes (NP, NP-C, etc), amortized analysis on running time.

Overall the concept is not exactly new if you have some programming background, knowing what is NP and amortized analysis. Questions that involves proving can be challenging if you do not have a solid mathematics/discrete structure background.

Midterm, final, assignments and tutorial participation are counted towards the overall grade. If you can solve the assignments and tutorial questions independently, exams should not be a problem.

After thoughts: This is no surprise for me.

## CS2103T Software Engineering

Again this is one of the core modules for CS, and lots of people are taking this (including people from ISE and CEG). The concepts are useful and can be readily applied to software projects. The module covers all phases of software development cycle, including requirement analysis, design, implementation and testing. I learnt a lot of useful knowledge on how to do software engineering properly, such as the various patterns and testing techniques.

Project makes this module really hard. As our tutor put it, the project can be done easily in a few weeks by one person, but the team-based nature makes it hard. Coordination and communication within the team can cause a lot of delays and extra work. From a web and mobile developer background, I find it troublesome to “code from scratch” without using any frameworks. Our team generally completed the software but it was not polished enough due to the delays in development.

The final and the participation marks are not hard. You need to make sure you can understand the concepts taught and apply them to simple cases.

After thoughts: Well, I got a grade higher than I expected. I guess the lecturer was just scaring us when he said “we will not get the deserved grades unless we do well in finals.” after the product demo.

## CS2101 Effective Communication for Computing Professionals

This module is paired with CS2103T. It serves to enhance our ability to communicate with others as an IT professional. The whole module is graded based on continual assessments. It covers basic rules and principles in communication and writing, as well as some areas that are important for the IT field, such as interviews and software project presentation.

Consistent effort is needed for this module as you are constantly graded for various components. The components themselves are not very heavy. A lot of work is in the form of writing and talking, so it is more of an English module than a CS module.

After thoughts: B+ is a bit lower than my expectations. From the way the tutor communicated with us, I thought we were doing fine and deserve at least a A-. Everyone in my group seems to have gotten B+ or lower, so maybe it is just how this module is graded.

## CS3243 Introduction to Artificial Intelligence

This module is first AI module that I am taking. It covers some basic elements of searching techniques, logic and uncertainty. A lot of focus is on understanding the various algorithms, such as A*, RESOLUTION, UNIFICATION, MINI-MAX. It certainly taught me a lot of new concepts, though some of concepts (logic) seem to overlap with earlier modules like CS1231.

The project is about implementing a learning agent for Tetris. The concepts used for the implementation is not directly covered so the teams has to do research on their own. Luckily in our team we have someone who is good at researching. He did a lot of work in implementing the learning algorithm. The lecturer required the implementation to be explicitly designed for large amount of data but I don’t feel that we are good enough to show that. We were pretty satisfied with our result that can clear about 20k lines on average. So we did not really put in too much effort to optimizing the running time.

The final and the tutorial questions are similar in terms of the difficult level. Understanding the concepts, especially the mechanism of various algorithms is important in answering the questions.

After thoughts: The grade that I expected. I can say that I understood the concepts well but the midterm and the project was not well done so A- is pretty normal. It turned out we did not score very well for the performance of tetris agent, in fact, we got zero marks for some test cases. We were expecting at least a decent performance since we have a “good” average of more than 20k lines cleared. Maybe the requirement for this project was much higher than we expected.

## CS3882 Breakthrough Ideas for Digital Markets

This module is one of the less known and less popular modules, only about 10 students took it this semester. It focuses on generating ideas for digital products and transforming the idea into a prototype. A lot of interesting concepts were taught, like design thinking and patenting.

Half of the work for this module come from the individual reviews of the concepts taught and group effort on proposing and refining the idea. Then after deciding on the idea, the teams are required to develop a prototype and do a final presentation with demo. The prototype is mainly used to demonstrate the feasibility and the appeal of the idea, so only minimum amount of coding is needed to develop the MVP. Overall this module does not take up a lot of time. It is quite useful for people who are intended to do a start-up. The professors for this modules are very helpful and they have good experience in the IT industry.

After thoughts: A little higher than I thought, but no surprise. It was a very small class size and there had to be some people who score A. So even though our project was not fantastic, it proved to be better than our classmates.

## Card Safe – My Third Android App

Link to the Android app in Play Store: https://play.google.com/store/apps/details?id=thack.ac.cardsafe (still waiting for listing as of now)

This project started off with the idea that I can take advantage of the NFC functionality in Android to read data from NUS Matric Card and develop some app to facilitate processes like registration and collection in various events.

Unfortunately, I realized that the matric number sector in the card is key-protected I believe the staff would not let me have the read/write access to the data inside. So that means I can only get my hands on the ID of the card, which is given by the manufacturer, public and most importantly unique(although there may exist techniques to duplicate the cards with the same ID illegally).

I was thinking about the card’s unique ID and necessity for NUS students. Then I suddenly got this idea, why not save some information and use the card as a key to access it. I thought this would be quite useful and relatively easy to implement, so I started working on a prototype. Setting up database and the single activity with a single layout file was quite easy for me, especially just after I have worked on a bigger Android project. The only thing that is troublesome is the different tags in different cards and their different ways to access the card. I have tried ezlink cards and DBS Debit Card, however, I was not able to get something like a unique ID from either of them. In the end, I only managed to get the NUS matric card working.

After a few hours of coding and designing, the version 1.0 with basic functionalities like setting up new “safe”, retrieving content of the safe and modifying existing safe was finished and uploaded to Google Play Store around 3am. Hope it gets good feedback and proves to be a fun and useful app for people(mostly for NUS students now).

## Reflection on the development of Animol – an Android app for Chemistry

The summer, I took a job offer from a lecturer that taught me in the last semester. The task was to develop Animol – a “simple” Android app for a lecturer from Chemistry department. The main functions proposed were displaying videos and short info for different experiments, synchronising experiment data with the server, on which new experiments can be added. I was in charge of developing the Android app, there are two more students working on iOS and server respectively.

The app was release under NUS account, but is no longer visible in Play Store for some reason. There is a brief description about it on NUS website.

The initial UI proposed looked very simple, so I did not expecting to spend too much time on it. After all, accepting the offer would mean that I will be working on 2 programming projects this summer, the other one being the orbital. I thought that my experience in Android game development would make this an easy job. As it turned out, making a “normal” Android app is somehow harder than making a simple Android game.

I started working on the project in late May. To set up the basic structure of the app, I need to learn about ListView and ListAdapter, to be able to populate data into a list. This did not take very long. After reading a few tutorials, I managed to find a good template that includes a ListView and a ListAdapter for displaying a list of songs. After removing some extra items, the basic list layout was done. Along with the ListView I also learnt simple SQLite functions to insert and retrieve data from Android’s SQLiteDatabase.

From there I got the basic framework and started working on specific requirements of the project. The next big thing is the embedded YouTube video. This was relatively easy for me(as compared to my counterpart working on iOS version of the app) as Google provides a YouTube Android Player API. (It was only later that I found out the downsides of the API.)

As I expected, the part that took the most time is the layout/UI. I had one YouTubePlayerView, several ImageViews and  scrollable TextViews and the whole layout also needs to be scrollable. So I did some research and followed the recommended way: Wrap all the ImageViews and scrollable TextViews in a LinearLayout which is then wrapped in a ScrollView. I also need to add some codes in the Activity to prevent scrolling conflicts between the inner views and the ScrollView wrapper.

After several modifications according to the requirements, my UI for the app was accepted in the weekly meeting. Then we all started working on server communication, I had a few choices here. I can either use the DefaultHttpClient (inherited from HttpClient) from Apache for Android, or the AndroidHttpClient (deprecated). Since there were several templates for DefaultHttpClient, I just followed the templates and wrote a ServiceHandler Class(just a utility Class, not inherited from Service or Handler Class) that handles the http calls. Then, I can use AsyncTasks in my activities to call methods in ServiceHandler for server communications.

It was on 1 July that things that things got a bit messy. I got my new MacBook Air and decided to shift all programming related work there. It just so happened that Android Studio had update moments ago. So it was a cross-platform and cross-version migration of an Android Studio project. This caused me several problems:

First, the Gradle version needed to be updated for the new Android Studio version, however my project was already set up for the old Gradle version and there was no way to do a straight forward upgrade of my project. So I decided to create a fresh project and copy paste my old codes into it, saving time to research on solving the compatibility issues.

The other problem was that the new build versions (version 19 and 20) does not seem to have good support for the package com.android.support:appcompat-v7. So I decided to strip the support package and made my app only compatible with devices running SDK version 15 (Android 4.0.1) or above.

The last and the most annoying one is the rendering of the ActionBarView in Android Studio. For some strange reasons, after I migrated the project, all the views stopped showing previews in Android Studio, saying that there are some problems with the ActionBarView. It worked fine on phones but lack of preview made it extremely difficult for me to design the layout as required. So I raised the issue on stack overflow. It seemed that removing the appcompat package helped to some extent but the new views created still has errors in rendering. Hence, this problem is still not solved.

Having solved most issues with the migration, I then started on more sophisticated operations involving retrieving and processing data from server and updating local database accordingly, as well as sending app usage statistics(click counts for each experiments) back to the server. There was an interesting problem regarding the timing for server communication. Initially, my implementation was to fetch new experiments and send the counts when the user opens the app (via onCreate in the splash screen activity). However, the concern was that the Android user may not have the habit to close the apps and server communication won’t happen unless the user explicitly kills the app. Then I planned to change the implementation to sending the count  and fetching new data when the app is sent to the background, but the disappointing news is that this is very hard for Android to detect sending app to background unless I use some hacks(which may not work in a long term).

So to ensure that the count is sent to the server, I created a BaseActivity that extends Activity, in which onPause will trigger AsyncTask to send count and onResume will trigger AsyncTask to fetch new data. This implementation suited the purpose, but it cost too much network traffic. This is because when user navigates from activity A to activity B, onPause in A and onResume in B are both called, effectively meaning 2 http calls will be executed for each tap on the screen.

Hence, the final decision was to add an interval of 30 seconds between any two server communications. This means after the first server communication, a timestamp is saved to the SharedPreferencesSubsequent server communications will need to go trough a check on timestamp to see if 30 seconds has passed from the previous server communication. This way, we can be sure that when the user launches the app (or relaunch from background), new data will be fetched. And for each subsequent navigation, onPause will be called before onResume, ensuring that the count will be sent in the next server communication.

The next big thing is push notification. This function was not in the original plan, but we all agreed that this should be an important part of the app in the event that we want to notify the users of new experiments or announcements. As it turned out, Google was kind enough to provide a Google Cloud Messaging(GCM) service for Android. The implementation was quite straight forward, except for the fact that it requires Google Play Services, which could be a potential problem for phones purchased in other countries that do not have Google services pre-installed.

The last problem was to dynamically refresh the view when the database gets updated by background server communications. I did not researched into how I can get a result from AsyncTask in my activity and the Android app is structured such that the views are drawn in onCreate of the activity, via `setContentView(R.layout.activity_main);` .  So in order to refresh the view with updated data, I need to either redraw the whole view or detect the changes to database and update the corresponding view elements. And I can either do it in onResume or set up a listener for database activities. In the end, I took the easy way out and forced a re-draw of the views in onResume (with 2 seconds delay) for each successful fetching of new data in the background.

Overall, I would say that this an awesome experience for me. I learnt a lot of things, not only on Android development but also on server communication techniques involving http request/response and database operations with SQLite. I am looking forward to working on my next Android project, or even pick up an iOS one if I have the necessary resources.

## Back to Singapore, and moved into RVRC

So I am officially moving into RVRC as a peer mentor, and the first semester of my year 2 seems just around the corner sometime in early August. I have my projects to do, I mean serious work. Enough of playing already, I need to get the work done!