My Blog

Spacemacs, i3, and Manjaro

Tags: spacemacs, manjaro, i3, thinkpad, post

Published on Sunday, May 20th, 2018

After I upgraded my computer to Ubuntu 18.04, I was fed up with how laggy things are, especially for Atom and Gnome Shell. Since all of my finals are over, I decided to try out new things.


PEG Madness

Tags: programming-languages, parser, pyret

Published on Sunday, October 8th, 2017

A part of my senior project is to create a framework to allow users to use their own grammar in Pyret. A good framework would need to prohibit ambiguous grammar that users might write.

One way to do this would be to require users to write a grammar that is accepted by LALR parser generator, since LALR parser generator will result in a conflict when the grammar is ambiguous. Note that the converse is not true: there could be conflict while the grammar is not ambiguous. This is exactly the situation that we are in because Pyret is currently using GLR parser generator which accept all context-free grammars. And Pyret does have some grammar that require unbounded and non-local lookahead, so LALR is not directly applicable.

There are two solutions that I am considering:

  • Rewrite Pyret grammar so that it can be accepted by LALR parser generator. This doesn’t seem applicable since Pyret is widely use by a lot of people
  • Use PEG

PEG at first glance seems really nice: linear time parsing, unambiguous by construction, and pretty expressive. However, I found that it could be very deceptive as well.


Deriving Y combinator

Tags: programming-languages, math

Published on Thursday, October 5th, 2017

Y combinator seems to be something mysterious. Several people have been trying to understand the intuition why it works. I have seen "A Lecture on the Why of Y" by Matthias Felleisen before, and while it does give me some insight, I still feel confused in some degree. That doesn’t prevent me from recommending this lecture to other people I talked to because it’s the best one I have seen so far.

Recently I thought about the fixed point combinator again and finally gained some good insight. I think it’s worth sharing here.


Counting Possible Passwords

Tags: dynamic-programming, programming

Published on Saturday, February 25th, 2017

Jack showed “the rules for password naming” in a website to me. Here’s an excerpt:

  1. The password must be exactly 8 characters long.
  2. It must contain at least one letter, one number, and one of the following special characters.
  3. The only special characters allowed are: @ # $
  4. A special chaacter must not be located in the first or last position.
  5. Two of the same characters sitting next to each other are considered to be a “set.” No “sets” are allowed. Example: rr, tt
  6. Avoid using names, such as your name, user ID, or the name of your company or employer.
  7. Other words that cannot be used are Texas, child, and the months of the year.
  8. A new password cannot be too similar to the previous password.

    • Example: previous password - abc#1234; unacceptable new password - acb$1243
    • Characters in the first, second, and third positions cannot be identical. (abc*****)
    • Characters in the second, third, and fourth positions cannot be identical. (*bc#****)
    • Characters in the sixth, seventh, and eighth positions cannot be identical. (*****234)
  9. A password can be changed voluntarily (no Help Desk assistance needed) once in a 15-day period. If needed, the Help Desk can reset the password at any time.
  10. The previous 8 passwords cannot be reused.

One way to create a password is creative spelling and substitution. Examples:

  1. phuny#2s
  2. fish#1ng
  3. t0pph@ts
  4. run$4you
  5. ba#3ries

I’m terrified.


On Induction

Tags: logic

Published on Wednesday, February 1st, 2017

In this post, I will write about three kinds of inductions: weak induction, strong induction, and structural induction. I in fact dislike these terms because, as I will show below, they are equivalent. Personally, when I think of induction, I will default to the structural induction. Last semester I took a logic class, and they introduce these terms, and also “formula induction”, “proof induction”, “term induction”, “sequence induction”, etc. I was like: *sigh* THEY ARE THE SAME WHY DO YOU NEED DIFFERENT NAMES.

Anyway, for the sake of this article, we will do use these terms for clarity and show the following.


Bulk Scraping

Tags: python, scraping

Published on Friday, January 6th, 2017

One of my friends who is a non-CS concentrator would like to scrape emails of all faculties listed in this website. Unfortunately, the emails are not on the page itself, but are on subpages. It would take forever to scrape the data by hand, so I helped. To do this, I need to send multiple requests to scrape each subpage. Naively, we would send a request, wait for a response, then repeat until we go over all list of faculties. This however would take a lot of time. We can do better by sending requests asynchronously. This is feasible because there is no dependency in the data.


Colorful Parentheses!

Tags: racket, blog

Published on Tuesday, January 3rd, 2017

I tried to learn continuations yesterday. This led me to a tutorial for composable continuations in schemewiki.org. It explains things nicely, but what really intrigues me is something completely different: the colorful syntax highlight for nested parentheses when hovering cursor over them.

This post, of course, explains how I managed to get it on my website!


Happy New Year

Tags: other

Published on Sunday, January 1st, 2017


Lemmo

Tags: dynamic-programming, competition, programming, lemmings

Published on Tuesday, December 27th, 2016

Wandering around in Wikipedia yesterday, I found this article: Lemmings. Though I never play this game before, I have played its open-source clone, Pingus, which is really enjoyable. This post is written to pay tribute to this wonderful game.


Huginn

Tags: huginn, rss, scraping

Published on Monday, December 26th, 2016

Yahoo! terminated Yahoo! Pipes on June 4, 2015. It breaks my heart to see another good service dying. However, I recently found another project which has an ability just like Yahoo! Pipes: Huginn


My New Website

Tags: website, blog, post

Published on Thursday, December 22nd, 2016

Ahem. This is my 7th attempt to write a blog... Hopefully it’s not gonna fail like last time!

In the previous attempts, I hosted my blog with blog sites such as Wordpress or Blogspot. For this time, as you can see, I host it in my own website (powered by Github Pages), so it will (hopefully) be different!

And, you see, the blog content is not that important. The most crucial thing is to get the technology right. What I’m using right now is called Pollen markup, which is pretty much a domain-specific language based on Racket’s @-syntax. Pollen sets up a server which recompiles files automatically whenever it detects file changes. The markup itself is very cool in a sense that you just write whatever you want to write with arbitrary made-up semantics tags, which is very pleasant to write using the said syntax. Then, you can go back and define and format what those tags are supposed to be. The programming part is equally pleasant because it has X-Expression which is a cool version of XML. Pollen supports outputting multiple targets: LaTeX, html, plain text, or whatever you want to output. Basically, you program the document, so you have an unlimited power to do whatever you want.


My New Laptop & Settings

Tags: ubuntu, thinkpad, post

Published on Thursday, December 22nd, 2016

I switched from Ubuntu to Macbook Pro since 2013 and was very happy with it. About 5 months ago, the screen was broken, so I planned to buy a new one. Knowing that the new version will have a major change, I was very excited and decided to wait until it’s released in order to buy it. To my disappointment, it incredibly sucks.

A lot of my friends suggested me to get a Thinkpad X1 Yoga which looks really cool. I waited until Thanksgiving to get a big discount. The laptop arrived in early December. The first thing I did is to install Ubuntu 16.10 because I hate Windows!

Following are my settings. I write these particularly for myself in the future so that when I need to set things up again, I won’t have to spend a lot of time figuring out what to do!


Yahoo! Pipes

Tags: yahoo-pipes, rss, scraping

Published on Sunday, May 11th, 2014

This post is migrated from my old blog.

I don’t know if RSS or Atom are still popular or not. I personally use them a lot. Here are some examples of the feeds that I subscribed.