Saturday, April 23, 2016

Day at the MET

I went with my friend to the Metropolitan Museum of Art (MET) today and it was really cool. We made it a goal to see as much of the museum as possible. This was my first time to the museum and I was blown away by it's size. I lost count of the number of times we got lost wandering around in that place.

The first thing we went to see was Egyptian art. My friend is half Egyptian and has been to the museum twice. Both times he spent nearly all of his time looking at Egyptian art so needless to say he was quite familiar with that section. The Egyptians made a lot of items that were for the afterlife. For example, I learned that they put their kings in something called a Sarcophagus (which just looked like a really elaborate casket made of stone) and often filled it with food so that the dead would be able to eat in the afterlife.

Marble Sarcophagus (My friend got in trouble for touching it hahaha) 

Before the body is put in a Sarcophagus they removed the organs of the dead body and put it inside Canopic Jars. The Jars were sculpted and represented Egyptians gods. Their purpose was to protect and preserve the organs so that the dead could find them when they came back to life. I thought, wow, sucks for the archaeologists who were digging these up because I doubt any of the dead actually came back to life to reclaim their guts.

Canopic Jar

Many of these after-life items were put inside tombs. One really cool we saw was the Tomb of Perneb which is pretty close to the entrance of the Egyptian art section. When we were inside I overheard a mother telling her son who was about seven or eight to stop looking at the map and look at the tomb. The kid was like "Mommy look! We're here! We're here" while poking his finger at a spot on the map. He seemed to have no interest in the actual tomb itself. I could relate.

We walked to the American Wing in the American Art section on the right side of the Museum and did a little bit of "art interpretation". Basically, we would look at a piece of art and then express the first thoughts that came to our mind about the piece. This was a lot of fun - it really allowed us to connect with the art and get in touch with how we were reacting to art. It also made the pieces much more memorable. Unlike the Egyptian sculptures, American sculptures looked much more alive and dynamic (they were often sculptures of things in the middle of an action) compared to the Egyptian sculptures which all seemed to look the same (arms folded across the chest like mummies ...).

Egyptian statues. Standing upright. 
American Art. Motion! Action!

Death and The Sculptor. My friend interpreted this as the Angel telling the sculptor to let go and surrender to death. His actions are futile.

Afterwards I complained about being hungry and we ended up getting lunch at this great italian restaurant called Grazie on 26th East 84th street. I had a brunch item called Eggs Royale and roasted vegetable soup. The Eggs Royale is basically an eggs Benedict with Salmon. It was amazing.

We went back to the MET shortly after and checked out these things in order:

Greek and Roman Art

The moment we walked into this section I was like, "wow, lots of dudes with they dicks out". Correction: they had their testicles out the dicks were broken off. Lots of busts. The sculptures were very big and the faces were very, very realistic. Mostly sculptures of Greek heroes and gods such as Hercules, Zeus, and Athena (God of Wisdom).

Arts of Africa, Oceania, and the Americas

We were not too keen on this section. Lots of wooden carvings and totems. Oh, and this time there were definitely dudes with they dicks out. Humongous dicks that were dis-proportionally large. Don't ask why I keep focusing on the phallic parts of the art - it's their fault they made it so prominent.

Roof Garden

When I was looking at the map I saw "Roof Top Garden, Floor 5". We're close to the center of central park in Manhattan. This is a pretty tall museum. Roof top garden? The view must be incredible. Also, since it was so nice out, I knew we had to go to the garden.

It was gorgeous. I mean, neither of us had sun glasses and we were practically blinded by the sun but it was a beautiful sight. The moment we stepped out into the Garden we were facing downtown Manhattan - we saw the skyline from the north over the trees of central park. It was so beautiful! I'd love to go back there with my girlfriend sometime and take some pictures. Oh and by the way, there's also a house on the roof. 

We spent about three hours at this place and there's still so much we didn't see. I highly recommend this museum! If you do go, I recommend that you:

  • Eat at Grazie. They have great food. 
  • Wear sneakers because you'll be doing a lot of walking. 
  • Bring a small back of snacks because chances are you'll be there for a while (it's a big place).
  • Bring sunscreen and sunglasses so you can enjoy the rooftop views
  • Picnic stuff if you want to chill at central park afterwards or in between tours (if you have a ticket you can leave the museum and come back)
  • Bring a fully charged phone because you'll probably take lots of pictures (if you use your phone to take pictures) and have to look up a lot of things (what's vicera?)

Monday, April 18, 2016

Pragmatic Programmer Philosophy: Maintaining a Knowledge Portfolio

This is last part of my series of posts on the chapter of pragmatic programmer philosophy. It's also probably the most important chapter. As a programmer, you are what you can do. If you don't continuously improve your abilities, you're not very useful.

Andy and Dave use the investment portfolio as a metaphor for your knowledge and experience as a software developer. Instead of investing in financial assets, we're investing in knowledge of tools and processes to help us be more valuable as a programmer. Just like an investment portfolio, your knowledge portfolio as a programmer has a market value. In most cases, that market value is your salary.

The principles of growing an investment portfolio are pretty well known.

  • Invest regularly
  • Diversify asset types and risk
  • Buy low, sell high
  • Review and re-balance portfolio as necessary over time 
The same principles apply for growing your knowledge portfolio. Instead of investing regularly in and diversifying financial assets, you're doing the same with programming knowledge. 

The authors offer a set of tips on how to invest regularly, which they argue is the simplest principle to apply and the most important. Investing regularly just means learning regularly. 

There are various ways of learning about tech, generally speaking:
  • Books. Both technical and non-technical. Try to read a book every quarter. Go read Pragmatic Programmer!
  • Local user groups or meet ups. For example, there's like a dozen AngularJS meetup groups.
  • Classes. Online or offline. Sign up for a Udacity or Coursera class!
  • Newsgroups / Magazines. Keep up with trends. 

And more specifically, the authors suggest:
  • Learning a new programming language every year. Always used Python? Try Haskell.
  • Learning a new environment every year. Always used Mac? Try Linux.
Both of those efforts will broaden your thinking in really powerful ways. 

I'll be honest, I'm not doing any of those things right now. I think one thing I'm going to start doing is learning a new programming language. I feel like I have a very strong grasp of JavaScript. I'll write a short guide on it before moving on to a different language. 

Physique Swimming: Lesson 6

We had a pretty big group today! Got moved to beginners level 2 with Fru. We worked on ...

  • Exhaling. Breathing under water. Turns out, most of us were breathing out way too quickly and we were NOT taking very relaxed breaths. 
  • Streamline arms. My head was not tucked in tnough, my arms were too far out front, and my wrist point TOO far down so I have trouble staying above water. 
  • Backfloats. Here's the trick to head positioning: face the ceiling and DON'T move your head. Kick one feet up when your shoulders and head are in the water then kick the other feet up. Keep your belly up. Don't arch your back too much or you'll start drinking water. 
  • Deep end jumping. Jump in, then breathe out while kicking vertically. 
Feedback:
  • She said my kicks are small and fast. Good for racing. However, she thinks I'm kicking slightly from my knees so it's better to practice wider kicks.Weird, I feel like I'm getting contradicting feedback about my kick. Anthony thinks my kick is awesome, but she thinks I'm still kicking from my knees. 
  • There should be no gap between my arm and head when I'm in streamline. Tuck that shit together.
    • Make sure one hand is directly on top of the other. 
  • Relax. Relax. Relax.
Jospeh says that I've improved a lot. I feel it! I'm still struggling with sidekicks and I can still feel tension here and there but I do feel like I'm making progress so that feels good. I'll keep working on my kicks and breathing in the pool this week.

Sunday, April 17, 2016

Why won't you take my cookie? Cover domain and public suffixes ...

Recently at work we were have issues with cookies while trying to setting up docker for a bunch of apps. 

We had five applications running on five docker containers. 

Container A: authentication back-end
Container B: authentication front-end 
Container C: app front-end
Container D: app back-end
Container E: nginx

We were expecting this flow:
  1. Navigate to docker.local 
  2. Authentication front-end loads on client with signup page
  3. Fill out signup form and submit
  4. Authentication back-end creates account, returns success response and sets a session cookie on client
  5. Client redirects to app front-end
  6. App front-end does a GET on a protected resource in app back-end, passes session cookie along
  7. App back-end authenticates with authentication back-end using session cookie from request and returns the protected resource
  8. App front-end loads the resource and renders the page
We ran into problems at step #4. The session cookie was never being set. We were not using a secure cookie or a httponly cookie. Every time we submitted the form, we got a 200 response from the authentication back-end server with a Set-Cookie header that attempted to set a cookie named session_id. However, every time we logged the client cookie information after the server response, it was missing the session_id cookie. 

After reading more about cookies, we learned that the problem had to do with the value of the cookie domain attribute value (also known as the cover domain). In our case, the cookies cover domain was set to .local. The purpose of the cover domain is security - it tells the browser client whether or not to set the cookie as well as whether it should send the cookie. The basic rule of thumb is that if the client domain matches the cover domain or is a subdomain of the cover domain, the cookie will be set / sent. 

The exception to this rule are public suffixes.

For most modern browsers, any top level domain is considered a public suffix. A public suffix is a domain that anyone can register a domain with (there is an official list). For example, ".com" is considered a public suffix. You can have "bob.com" and I can have "alan.com". Since all subdomain of a public suffix have different owners, it's not safe for cookies set by "bob.com" to be passed along to "alan.com". 

Since, ".local" is a top level domain, it is considered a public suffix. Therefore, the cookie is not set! We changed it to "docker.local" and that solved our issue. 


Monday, April 11, 2016

What's the Tribeca Film Festival?

Every year I'm in New York I seem to hear about the Tribeca Film Festival. For a long time I just assumed that this was some event that was only interesting to film makers or film critics and not ordinary movie watchers like myself. I heard about it again early this year and decided to challenge that assumption by doing a bit of research into what it is and then taking part in it. Who knows? It could be fun.

My first stop was the website. It looks great but it didn't seem like it was designed with the "uninitiated" in mind. There wasn't even a button to some "about" page. So I looked at Wikipedia. 

"To enable the international film community and the general public to experience the power of film by redefining the film festival experience."

I had to really unpack that.

A festival is an organized series of events over some period of time to celebrate something. I learned that a film festival is a festival where the series of events are film screenings in multiple theaters and its celebration are the many aspects of film making and film watching. 

There are many different film festivals that take place all over the world (Sundance Film Festival, Venice Film Festival). Aside from the obvious difference of where these screenings take place and over what period of time, they can also differ based on the kinds of films they choose to screen. In some festivals, there may be a special focus on a particular genre or film maker. 

The films that are screened are independent films. That means these films are all produced outside of the major studio system. In other words, they are not created by the companies that create blockbuster movies like Spiderman or big name directors like Steven Spielberg. It's likely you've never heard of these films or film makers before if you're not part of the film making community.

The Tribeca Film Festival is held in Tribeca, NYC and the focus, like any other film festival, is on independent films (documentaries, fiction films, and short films). There is no particular film theme. In addition to the film screenings, the festival also puts on panel discussions with well known actors and actresses (this upcoming one features a panel discussion with Ethan Hawke), live music and comedy performances, interactive activities, and even major studio premieres (Star Wars: Attack of the Clones).

Questions about the upcoming TFF

When is it?

This year, the TFF runs from April 13-24.

How do you participate? 

The TFF is run as a business by a company called Tribeca Enterprises. None of these events are free. You have to get tickets for them. You can get two types of tickets: a festival pass or individual tickets. A festival pass costs between $550 - $1250. The $1250 pass pretty much gives you access to everything. Your other option is to buy individual tickets. That's a much better option if you only want to buy tickets to a few events. For example, maybe you only want to see one panel discussion and two films. That will probably be less than $100. 

Where do the events take place?

The films are all shown in select theatres in the Tribeca area. You can see the specific location on the actual event page. You can get more information here.

My Plans

I plan on checking out 2-3 events at this years festival with my girlfriend this year. I'll probably look at one or two films and maybe a couple of non-film watching activities. The festival officially begins tomorrow so I better start looking! I hope the tickets don't get sold out.

Physique Swimming: Lesson 5

I worked with Anthony again today!


Skills


Fetal position float

  • This is the same exercise we did last week. You inhale, then you enter the water slowly into a fetal position. Exhale the whole time and if you're sinking just allow yourself to sink until you're almost out of air.

Backstroke kick

  • Keep your neck back and stomach up. Kick and remember not to bend your knees. We did this with a kick board.
Streamline with one arm stroke
  • Using a kickboard, we do streamline and then perform a stroke with one arm. Then we take a breath by tilting our head up and then perform the other stroke with the other hand. 
    • The issue I had with this is I felt like I wasn't going in a straightline. I felt very unbalanced. Also, I felt like I was taking smaller and smaller breaths each time. 
Anthony recommended that I work on two things:
  • To maintain balance, pull your arm towards your chest but don't let it cross the mid-line (go diagonal) or else you'll start moving in a zig-zag (could be what I was doing). 
  • Remember to exhale and then when your head is out to take a big breath. Don't hold your breath and remember to take as big of an exhale you can. 
Other than those things, he said that my kicks look great (I was doing a good job not bending my knees and kicking from the hip). Next week, he said I'll be ready for beginners level 2!

Next steps:
  • Use a pullbuoy to practice your strokes (http://www.swimsmooth.com/catch.html)
    • https://www.youtube.com/watch?v=ZTQpF_mmg44
    • Early vertical forearm. Imagine your arms pushing against a block that's sitting at eye level!
  • Relaxation exercises. I still feel a bit of tension when I'm in the water. I need to stop holding my breath!



Physique Swimming: Lesson 4

We first started with bubbles, Joseph has us do streamline and then we got split into two groups: beginners 1 and beginners 2. I stayed in beginner 1 with and got a new instructor, Anthony.

My biggest pain point: staying buoyant

We worked on floating.
  • Fetal position, rest until still. rotate to right using left arm. Rotate toe left. Go right then stop and go other direction. 
  • Rest and then slowly open body to find natural buoyancy
  • My legs sink because ... too much muscle mass in the legs
I was actually able to float! Even though my legs were going down. I just had to relax, keep my belly up (engage the core) and remember to breath but don't breathe everything out. 

We then did streamline on our backs. I drank water the first two times.
  • Keep your arm above water. I had it too much in the water and this created an arch that pushed my head too far into the water. 
We then did an exercise that my girlfriend taught me. One hand on board, swim. Pull with one arm. Breath. Pull with other arm. Breath (head tilt up). I did it pretty well the first time but it got harder and harder over time because:

1) I was pushing my arms DOWN which caused my legs to sink
2) I was running out of air completely so started to sink
3) My sinking legs caused me to tilt my head higher to get water. Tilting higher caused body to sink even more. Vicious cycle.

Both of my instructors said that I'm still muscling my way through the water. I'm working too hard. Need to work with the water / buoyancy. 

I need to work on:

Staying Afloat


Kicking
  • Perform ankle stretches with Yoga Block (2 sets of 15 seconds at night and 2 sets in morning)
  • Visualize quarter in butt (kick from hips)
    • "A good way to think about kicking from your hips is to squeeze your bum when you kick. It's a bit crude, but imagine you have a large coin between your butt cheeks and you're trying to hold it there whilst you swim. Keep your knees relaxed and drive the kick from the hips."
  • toes. Use fins and remember to keep them pointed. 
  • Kick off the wall drill. Torpedo off and go as far as possible with hands out.
  • More information: http://www.swimsmooth.com/kick.html
Getting more relaxed through Breathing:
  • Not relaxed. Practice sink downs (http://www.swimsmooth.com/exhalation.html).
    • Exhale immediately
    • Exhale completely and pay attention to your threshold.