lalicode

The code of Lali

Blog — lalicode

Thoughts on Express.js and Heroku

Nov. 13, 2016

I spent this weekend learning more about two very popular web development tools, Express and Heroku. The project I was working on was an image API using Express hosted on Heroku.



Here are my thoughts.

Express.js

I used Express.js with socket.io before to create chat rooms for an android app. I was amazed at how the whole back end was written in about 20 lines of code. In this project wanted a super simple web framework for the API so I went for Node.

Pros:

  • Setting up the web server is super easy! You can get everything running in very few lines of code
    
    var express = require('express');
    var app = express();
    
    ...
    
    var server = app.listen(8080, function () {
    
      var host = server.address().address
      var port = server.address().port
    
      console.log("Listening at http://%s:%s", host, port)
    
    })
  • Express.js has these things called middleware functions that can interact with requests, responses, and other middleware functions. The built in one for METHOD (GET, PUT, POST, DELETE) make writing REST APIs super easy.
  • It uses the Node.js Javascript environment, which is asynchronous. People love this because it can handle requests in parallel.
  • The simplicity allows writing small web applications a breeze.
  • It has a terrific package management system, npm.

Cons:

  • The Express generator is not newbie friendly. For those who do not know, the generator is used to create a skeleton for you application. It came with a HTML templating language called Jade (now Pub), which felt really unnecessary. I want to deploy a web application quickly not learn a new templating language!
  • It's not fully featured. You will need to use something like a MEAN stack, depending on your needs.
  • Node.js is not good for CPU intensive tasks

Heroku

I deployed my project on Heroku. The setup was okay, but could have been smoother. I forgot to provide a package.json file, which ended up causing deployment to not recognize the app as a Node.js. The bad thing is that Heroku did not tell me that and I had to look up the error on my own. They need more useful error messages.


Since my code was no longer in development, I had to change it to use Heroku's ports:


var server = app.listen(process.env.PORT, function () {

  var host = server.address().address
  var port = server.address().port

  console.log("Express server listening on port %d in %s mode", this.address().port, app.settings.env);

})

Everything went pretty well after those two changes. Heroku provides nice usage graphs. It was easy to pick up and I got to deploy my application really quickly without having to do any Linux level configurations. You can also set your code to deploy on new pushes which is convenient. What I'm surprised to see was that you can deploy code from Dropbox. Git > Dropbox.


What I really appreciate is the fact that I didn't have to pay anything or sign up with my billing info to get hands-on experience with this service. I'm looking at you AWS.


You can try out the API by visiting https://memedb.herokuapp.com/emotes/Kappa. You can try it out with Kappa and 4head!

lali's Survivor Rankings

Sept. 21, 2016


What is Survivor?

Survivor is an American game show where ~20 people are placed in a remote location with meager supplies and separated into several tribes. As the name of the show suggests, the players in the game have to survive for 39 days in brutal place we programmers call "outside." Every few days they participate in Immunity Challenges where the losing tribe has to go to Tribal Council to vote off one person on their tribe. They also participate in reward challenges, which give an advantage to a team in the form of utilities (e.g. fishing gear, tarp) and comfort (e.g. pillows, fruits). Outwit, outlast, and outplay are the pillars which determine who becomes the Sole Survivor and takes home the one million dollar prize.

Why I like Survivor

Connection with the real world

Whether it is getting a job, owning property, or finding a mate, we are all competing in a cooperative environment to get the things we want. Survivor is a social sandbox where our competitive drive for a similar psycho-biological reward is experimented on. You see how far people go to just to advance themselves and to put themselves in a position of power. Some competitors have sacrificed their own integrity to get further while others have found that their integrity cost them one million dollars. You also get to see some people do terrible (and absolutely incredible) acts towards one another, which really makes you reflect on what really makes us human.

Survivor is a social sandbox where our competitive drive for a similar psycho-biological reward is experimented on.

Complexity

Survivor requires you to think about the decisions the players have made and the decisions that they can make. Each decision always has its pros and cons and it's fun trying to figure out the best decision for the players you are rooting for!

Self-reflection

Watching the players reflect on their own lives back home makes me reflect on my own. This is especially true when when the contestants' family/friends visit them. That is my favorite part of a Survivor season because it really makes me appreciate family.

The characters are often very animated and memorable.

Good entertainment

The drama, humor, romance, and injuries that come with playing the game really makes Survivor a full-fledged television show. The format of the game forces drama to happen because everyone is scrambling to reduce their chances of getting voted out. However, there are times when a single tribe is dominating too much and the show just becomes really painful to watch. To fix this the producers shuffle the teams (that's when you know they screwed up!). One season even had three shuffles!


The characters are often very animated and memorable. My favorite is Coach, who calls himself "The Dragonslayer". That alone says a lot about him as a character.

The difficulty of the game

We often forget how hard the game is because only so much can be shown in a 40 min episode. The players undergo dehydration, malnourishment, sleeplessness, and have to withstand the wrath of mother nature. They not only have to worry about surviving, they also have to worry about winning challenges (which can be very physical) and playing the social game. The amount of physical and mental resilience the players have to stay in the game is pretty crazy.

Tips for those who want to watch Survivor

  • If you have never seen Survivor before you should start with Season 1. There's more to this game than I mentioned and experiencing those parts in the game for the first time was mind blowing.

  • Most of the seasons are available on Amazon Video.

  • Try to watch in order to avoid spoilers for previous seasons, particularly during the reunion show.

Without further ado, here is my ranking of the Survivor Seasons. Thanks to Steven Aoki for his rankings for which I have based my viewing order of Survivor on. You can see his here.

lali's Survivor Season Rankings

I favor seasons with interesting contestants (the weirder the better!). I also like seasons with a decent amount of strategical and outlandish moves. I will be updating this page as I watch more seasons.


Currently watching:

None at the moment.


  1. Survivor: Heroes vs. Villians (Season 20)

    Ten of the greatest heroes and ten of the greatest villains. I think I would have appreciated this season better if I watched the seasons all the players were in. Crazy, never before seen strategical moves. All the players were playing their game 100%. Players got super physical, resulting in multiple injuries. Ending really makes you appreciate the purpose of the jury. It helps keeps the players from emotionally slaughtering each other.

  2. Survivor: Cook Islands (Season 13)

    Yul and Ozzy are some of the best players in Survivor history. Ozzy is physically gifted and Yul played the social game systematically and cleanly. Jonathan Penner switching sides was massive. Cao Boi was hilarious!

  3. Survivor: Gabon (Season 17)

    Was a mess at first with all the team shuffling. Fake idol was hilarious. Lots of feels when family visited and Matty Proposed. A very deserving winner. Great characters like Crystal and Ken the pro-gamer.

  4. Survivor: Millennials vs Gen X (Season 33)

    Felt like it was scripted, but it wasn't! Jay is super chill and he relationship with Adam was a love-hate understanding of each other. Dave is one funny dude. The rock draw was crazy!

  5. Survivor: Fiji (Season 14)

    Dreamz and Yau Man's deal. The bullying between Anthony and the big guys. This one was a doozy.

  6. Survivor: Tocantins (Season 18)

    Great characters such as JT, Tyson, Taj, and of course, Coach. I love Coach and his warrior mentality.

  7. Survivor: Samoa (Season 19)

    Russell played the living hell out of the game by finding all those immunity idols by himself. His confidence in himself is astounding. The other Russell played his heart out and it was a shame that he had to leave. Shambo was really interesting as well.

  8. Survivor: Borneo (Season 1)

    The one that started it all. Greg and Colleen's relationship was pretty cute. There really was an air of amazement watching season 1 as my first season. I never knew that the tribes would merge as one and neither did the players. The game completely changed because of that aspect. Gervase and Rudy are memorable as well. I can't believe the winner won because he guessed a juror's number correctly.

  9. Survivor: Philippines (Season 25)

    The emotional struggles that Lisa went through concerning her stardom had a lot of feels. Malcolm is cool dude and really reminded me of Ozzy. The sex therapist played the game very interestingly and managed to make it work. Jonathan Penner, Russell, and Scupin came back this season. Sucks that Russell had such a bad tribe this time.

  10. Survivor: China (Season 15)

    James is a lovable character. Got really pissed when Denise didn't bring Peih-Gee along for rewards. Not a lot of strategy this season. Chicken was one of the most frustrating players since he just stood around and didn't contribute to any discussions. Hilarious reunion show and a deserving winner.

  11. Survivor: Cagayan - Brawn vs. Brains vs. Beauty (Season 28)

    The Brains tribe sucked so badly its ridiculous. I don't recall there being a Rite of Passage for this season which sucks. Highly strategical game with less animated characters. Winner was thinking about the game nonstop, super dedicated to winning the game.

Additional Resources

Food Review: Asian Snacks

June 22, 2016


It's important to try new things every now and then to escape from the mundane. So I went to Davis's Ho Ho (好好) Market and got a bunch of snacks!


Hung Fook Tong Longan With Honey Drink


Fun Fact: Longan is very similar to Lychee except for the color (brown vs. red), texture of their skin (smooth vs. bumpy), and subtleties in flavor. The honey in this drink was overpowering for the first few sips but the longan flavor peeked through afterwards. The flavor tasted fairly accurate and the drink was refreshing in the 100F Davis weather. The only thing I didn't like was how overpowering the honey was for the first few sips.

Cost: $1.39
Rating: 9/10


Hi Tempura Spicy Tempura Seaweed


Hi Tempura is a fried version of Tao Kae Noi Crispy Seaweed. The flavor of this tempura seaweed was strange at first but I learned to really like it. It's actually surprisingly spicy. The bag says it serves 8 people but there's really only enough to satisfy the snack cravings for one person. Overall, this is certainly one of the good savory snacks.

Cost: $2.19
Rating: 8/10


Lotte Chocolate Pie


This one is really cool! The box has squirrels everywhere which is legit. When I flipped the box to look at the back I was flabbergasted when I saw that there were Microwave instructions. I poured a bunch of the pastries on to a plate and microwaved it for 35 seconds. The pastries came out warm and the chocolate was slightly melted. It was a unique experience indeeed. The pastries tasted alright and the portions are perfect for sharing or for saving. What I didn't like was the firmness of the pastry shell. I think it would be better if the shell was less thick and if there was more chocolate.

Cost: $2.29
Rating: 6/10


Bourbon White Rollita


The moment I opened the package my nostrils were overwhelmed by a strong sweet scent. The White Rollita is simply a biscuit covered in white chocolate. The biscuits are alright and the white chocolate was pretty good too. However, the flavor really went dramatically downhill after I ate more than one. By the time I had four, the chocolate had the same texture and aftertaste as a crayon.

Cost: $1.99
Rating: 4/10