<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Raynold Ng on Medium]]></title>
        <description><![CDATA[Stories by Raynold Ng on Medium]]></description>
        <link>https://medium.com/@raynold.ng24?source=rss-b8f07f459eb1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-mLj9uCCf4n_lz5y.</url>
            <title>Stories by Raynold Ng on Medium</title>
            <link>https://medium.com/@raynold.ng24?source=rss-b8f07f459eb1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 18:05:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raynold.ng24/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How 2 inexperienced freshmen built an automated timetable generator over a summer]]></title>
            <link>https://medium.com/@raynold.ng24/how-2-inexperienced-freshmen-built-an-automated-timetable-generator-over-a-summer-40d2a0755930?source=rss-b8f07f459eb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/40d2a0755930</guid>
            <category><![CDATA[constraint-solver]]></category>
            <category><![CDATA[nusmods]]></category>
            <category><![CDATA[react-redux]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Raynold Ng]]></dc:creator>
            <pubDate>Fri, 13 Oct 2017 10:10:00 GMT</pubDate>
            <atom:updated>2017-10-13T10:51:11.127Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the summer, <a href="https://medium.com/@bayweiheng">Wei Heng</a> and I developed NUSMods Planner, an augmented version of NUSMods that comes with an automatic timetable planner. After much shameless marketing, it received much fanfare and user traffic. According to Google Analytics, we have about 2,600 users. Not bad for our first software project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*qMgv3b4xZ53VuAJ9.png" /></figure><p><em>Snapshot of our Google Analytics Dashboard, taken in 27th September 2017</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*4pvEq6MpuTLwjlxF.png" /></figure><p><em>Screenshot of </em><a href="http://modsplanner.tk/"><em>NUSMods Planner</em></a><em>, observe how the generated timetable has no lessons on Tuesday</em></p><h3>How it all started</h3><p>The same way every hack does: Over a casual chat with Wei Heng, we discovered we both found manual timetable planning too much of a chore.</p><p>There happened to be a school program by Google SG (tears we didn&#39;t get the Google trip) called <a href="https://orbital.comp.nus.edu.sg/">Orbital</a> at that time, something like a summer-long hackathon, so “hey, why not”.</p><h3>Features</h3><p>Of course, our application would not have gotten so much attention if it merely prevented clashes given a fixed set of modules. Anyone can do that.</p><p>Features were actually implemented iteratively after various rounds of testing, by asking our peers what they would like to see in our app.</p><p>We had to make certain design decisions when considering whether to include X or Y in our final release, maintaining a balance between usability and usefulness. Allowing users overly fine-grained control usually meant more clutter in the UI, and we wanted a pleasant first-time user experience.</p><p>The final list of features are as follows (but why not check it out (at <a href="https://modsplanner.tk/">NUSMods Planner</a> yourself?):</p><ul><li>Optional Modules</li><li>Workload Specification</li><li>Locking lesson slots</li><li>Free Days</li><li>Lunch Hours</li><li>Blocking out too early/late slots</li><li>Website Tour</li></ul><h3>First attempt at a solution</h3><p><em>(the more technically inclined may check out our </em><a href="https://github.com/raynoldng/orbital-splashdown/blob/master/Splashdown_Technical_Report.pdf"><em>technical report</em></a><em>)</em></p><p>After some research, we realized that since timetable planning can be expressed as a constraint problem, we could use powerful constraint solvers to help us. We started by learning about smtlibv2, what it could and could not achieve, and how long it would take to do so.</p><p>Then began the experimentation. For this part, we used <a href="https://github.com/Z3Prover/z3">z3</a>, a solver developed by Microsoft Research, which had exposed python API. We initially modeled the problem as an assignment of slots to hours, then used the Distinct API call to make sure there were no clashes. Even with no optional modules and no other constraints, results were dismal. One call took &gt;3s on average, much slower than a naive recursive backtracking algorithm.</p><h3>What went wrong</h3><p>The reason for this was that Distinct internally actually creates n² (where n is the total number of hours across all lessons in the specified modules) variables a_i != a_j and adds their conjunction to the constraint. The number of clauses was thus polynomially bigger than what we expected. We didn’t want to give up on z3 and revert to the naive solution (recursive backtracking), since that would make supporting the features above impractical, so…</p><h3>Back to the drawing board</h3><p>We had the Eureka moment while getting a drink at a cafe (did I mention we both love food): Instead of mapping lessons to hours, we could map each hour to a lesson (since timetables in NUS are fortnight-periodic)! Of course, there was still work to be done to properly express this concept in terms of first-order logic (we used selector variables and multiple implications), but once we did this, the solving time drastically improved. This method also could be naturally scaled to support all our intended features.</p><h3>We have a working, efficient algorithm, now what?</h3><p>We met up with the NUSMods core team (Zhi An and Li Kai) for a demo, and they were impressed and agreed to be our mentors. They also tentatively agreed to code integration once we were done, subject to code quality. Over the course of the project, they provided invaluabe guidance and helped us navigate through their codebase, and we plan to finish codebase merging before their release of NUSMods V3 (link?).</p><h3>Modifying the NUSMods codebase</h3><p>Being total newbies to Web App development, this was a huge challenge, and in fact what we spent the most time on. We started by taking a <a href="https://learnxinyminutes.com/docs/javascript/">refresher course</a> in JavaScript, then familiarising ourselves with <a href="https://facebook.github.io/react/tutorial/tutorial.html">React</a> and <a href="https://egghead.io/courses/getting-started-with-redux">Redux</a></p><p>At first, we were confused as to why there was a need for so much boilerplate code, but as we implemented more and more features and bug-fixes, we were grateful that the codebase was so clean, structured and modular. Hot reloading and tools like <a href="https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en">Redux DevTools</a> also made previewing changes a lot faster and debugging a lot easier.</p><h3>Pushing Work to the Client</h3><p>Once we had written our timetable-generating scripts, we wrote a simple server app that would respond to queries by calling the scripts and then returning the results. We then deployed it on a Digital Ocean (DO) instance and benchmarked the response time using <a href="https://www.getpostman.com/">Postman</a>. To our horror, each query took the server <strong>at least</strong> 7 seconds to respond. Turns out our laptops were way more powerful than the DO instance (the cheapest option: 512 MB, we’re both poor kids).</p><p>Clearly, doing the solving at the server side would not be scalable — there was no way NUSMods Planner could support the same user traffic as NUSMods unless we had access to some computing cluster.</p><p>We tried to improve the running time of the solving algorithm by optimizing the problem representation. While we managed to slash the average solving time by half, scalability remained an issue. We had no choice but to push the solving workload to the client.</p><p>So we had to find some way to run a SMT solver in the web browser. We came across the project called <a href="http://jgalenson.github.io/research.js/">ResearchJS</a> that aims to share computer science research by compiling it to JavaScript. One of the shared research projects was <a href="https://jgalenson.github.io/research.js/demos/boolector.html">BoolectorJS</a>, a JavaScript version of <a href="http://fmv.jku.at/boolector/">Boolector</a> compiled with <a href="https://github.com/kripken/emscripten">Emscripten</a>. The client would now load the BoolectorJS scripts and invoke them to solve our queries.</p><p>Here we would like to formally thank the above open-source project contributors — our project would not have been possible without them.</p><p>After three months of hard work, this was how our full stack implementation looked like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W0JASEVYFfpfLS2D.png" /></figure><h3>Further Work</h3><p>Sadly our summer break was only 3 months; we were looking to add more features. One idea was to optimize the timetable based on some heuristic such as travelling distance or compactness of lessons. Solving optimization problems subject to constraints is an active research topic (see <a href="https://link.springer.com/chapter/10.1007/978-3-642-29700-7_23">here</a>) but sadly not supported by most SMT solvers (we know that <a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/nbjorner-nuz.pdf">z3 does</a>).</p><h3>Conclusion</h3><p>As SMT solvers get more powerful and efficient, we can see SMT solvers being used as a catch-all solution for constraint-based problems. We look forward to more active development in JavaScript based SMT solvers and their application in web applications.</p><p>Overall we individually spent 200+ hours… It was heartwarming to have peers thanking us directly or providing positive <a href="https://docs.google.com/forms/d/e/1FAIpQLScnDNgsB2K41EbWcDoMAyCmKRbwiB--Ih5t_E0r7Edf2VR_og/viewform">feedback</a> that they found the website useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40d2a0755930" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chattering in the Classroom]]></title>
            <link>https://medium.com/tinkertanker/my-summer-internship-at-tinker-tanker-745b4785c81a?source=rss-b8f07f459eb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/745b4785c81a</guid>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[un]]></category>
            <category><![CDATA[edtech]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Raynold Ng]]></dc:creator>
            <pubDate>Wed, 16 Aug 2017 23:50:35 GMT</pubDate>
            <atom:updated>2017-09-12T16:13:55.106Z</atom:updated>
            <content:encoded><![CDATA[<h4>Intern report: Building an in-class chat app for Tinkercademy</h4><p><a href="http://blog.tinkercademy.com/"><em>Editor’s Note</em></a><em>: Raynold interned with us for just over a month in June of 2017, and he made a great little app for our use in the classroom. It’s called </em><a href="http://chatter.tk.sg/"><em>TinkerChatter</em></a><em>, and it’s pretty great, even if we (the full-time staff) occasionally crash it and spend hours wondering how to bring it back online.</em></p><p>Hello! I am Raynold, and I was a Software Engineering Intern at Tinkertanker.</p><p>During my summer internship, I have been able to work on existing and new web applications as a full stack developer. I was tasked with creating a web chat application for Tinkercademy instructors to use during lessons for communication. They found their existing proprietary solutions (<em>Editor’s Note: a giant Slack chat</em>) to not meet their needs. So I re-purposed a program called <a href="https://sdelements.github.io/lets-chat/">Let’s Chat</a>, released under an MIT license and written on top of the <a href="http://node.js/">Node.js</a> platform, to create TinkerChatter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9OIJ8E96m5gefkyUd05RNQ.jpeg" /></figure><p>This internship was so much more than just a series of programming tasks. As the project owner, I went through all stages of product development: idea generation, discussion with end users, development, live demonstrations to troubleshooting and maintenance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojZ008KZhHApGVRqXnxCjA.jpeg" /><figcaption>It’s like Slack, but for the classroom</figcaption></figure><p>Before drafting the specification sheet for the project, I got to sit in on a lesson to learn more about the use cases of the chat application, and possible areas for improvement. Through the course of development, I would have regular meetings with the instructors to discuss planned features. I was also tasked with the deployment and maintenance of the web app. I learned valuable skills such as web server administration, version control, and user testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*-64Mu7uXsYAw8OuEhqH_WA.png" /><figcaption>Login page</figcaption></figure><p>Software development aside, this internship has been a priceless experience. Tinkertanker has an open office concept, making it easy to catch colleagues for quick discussions. I was surrounded by talented interns and full timers whom I often sought advice from whenever I got stuck. All of us were technology enthusiasts which made for exciting chatter during breaks or after work hours. Also, Tinkertanker has a very well stocked pantry, and I was very well-fed during my time there.</p><p>I enjoyed my internship in Tinkertanker. It felt very rewarding to push a product through all stages of product development and am glad to see that it provided great value to the company. The company is also involved in many other exciting projects, such as their <a href="https://tinkercademy.com/microbit">micro:bit classes and kits</a>, and their <a href="http://guestday.com/">GuestDay app</a>, which some of the other interns were working on.</p><p><em>Editor’s Note, because you can’t get rid of me: Raynold is a second-year Computing student at the National University of Singapore. He interned with us for just a few short weeks, because he had school commitments, but we really wish he could have stayed for longer. (And not just because we messed up the TinkerChatter server within a week of his leaving.) Raynold’s a quick learner, an independent and self-motivated coder, and a great guy to have around. Thanks for joining us, and for writing us this great little tool!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=745b4785c81a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tinkertanker/my-summer-internship-at-tinker-tanker-745b4785c81a">Chattering in the Classroom</a> was originally published in <a href="https://medium.com/tinkertanker">Tinkercademy Build Log</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>