Posts

How did modern markets develop? (A Tulip Market Analogy)

I've been interested in how our modern stock markets work for a while now, and recently I've been trying my best to understand all these fancy terms, like "T+1", "clearing firm", "broker-dealer', etc. Here's a situation that I came up with, that helped me understand how markets may have evolved. Imagine you're living in 17th century Amsterdam, and you're looking to buy a lot of tulips. How would you do this? You need to find a seller, you need to know the price. Then, if you choose to buy at that price, you need to sign an agreement to exchange money for tulips at a later date that's convenient for the two of you. Where can you find a seller? You heard there's a tulip market where the tulip buyers and sellers hang out. It runs weekdays from 9:30AM to 4:00PM. There's also a pre-market and a post-market, but there aren't too many people there, so it's a lot less liquid outside of the main hours. This place is called an ...

The Very Basics of Android: Starting Activities

Image
When you click on a link on a webpage to navigate to another webpage, what do you need to tell the backend in order for it to fetch the right page for you? First, you have to tell the backend which page you want to see. Second, you have to tell the backend any extra information it might require. You take these two pieces of information, package them into a nice bundle of data called a URL and send it off to the backend. When we launch an activity, we do a very similar thing. First, we get the name of which activity we want to open. Then we package together any extra information we might need to show this page into a nice bundle. We package these two pieces of information together into an object called an Intent  and then we send it off to the Android OS using the very aptly named `startActivity` command. Here's what an Intent  looks like in code: Intent(context, SearchActivity::class.java) .apply { putExtra("q", "duolingo") } Ignoring the context for now, t...

The Very Basics of Android: Tasks, Activities, and the Backstack

Image
Welcome to The Very Basics of Android ! This series is aimed at folks just starting out on Android, and the goal is by the end of the series, you should be familiar enough with common Android topics to be able to go on to other intro materials. To start, this first article will discuss the terminology we use when talking about the UI of the app: Tasks, Activities, and the Backstack. Go onto your Android phone, and click on the small square button at the bottom of the screen. This screen represents all of the tasks running that you have opened! Here's what it looks like on my screen: As you can see, I most recently opened Duolingo and second most recently opened the calculator app, so I have a Duolingo task as well as a calculator task. Each one of these tasks is just a stack of "webpages", called the backstack . Each one of these "webpages" we call an activity . Here's my artist's rendition of what this looks like: When browsing a webpage, you are clicki...

Reading "The Design of Everyday Things"

Life so far It's been a tough 2022 so far. I'm burned out at work, my grandpa is ill, my old car broke down, etc. Hence the general lack of motivation to write anything. I feel like this year will be learning year for me, where I get my ass handed to me by life, and I come out of it battered but more mature. In this vein of learning, I've been trying to institute a few changes in my life to help alleviate some of the things that are going on in my life. Basically, try to stay in control of my life as much as I can. A few basic ones: Work exactly 8 hours a day and push back on deadlines that would require working more than 8 hours a day. Write every so often. In my blog, in my random notebooks. Keep in contact with family. Keep my girlfriend in the loop about my stresses and struggles (she's a psych major!) Always be learning something new. Let's hope everything works out! *knock on wood* Reading "The Design of Everyday Things" In terms of my goal to always...

Thinking about fuzzy logic and implementing black boxes

Today, Google did a doodle about Dr. Lotfi Zadeh who published a paper that proposed fuzzy logic. It feels like it's been forever since I studied anything that has to do with machine learning so I decided why not, let me learn a bit about this. It turns out, fuzzy logic is actually really applicable to my job (which involves no machine learning at all) not because I need to implement a bunch of ambiguous things on the app (although dealing with ambiguity is a big part of the job) but it proposes a really neat way to think about constructing a black box. First, my understanding of a fuzzy system. It is effectively a black box, with rules that you can configure. You feed in your raw data on one end, it goes through the "fuzzifier", the "inference engine", the "defuzzifier" and some new data emerges from the other end. The core of this box is the inference engine. Basically, this part of the system holds the rules that you and your product folks come up w...

Scary Spookvember: Regex!

Image
This is the first blog post in a new series of blog posts that involves me learning and blogging about things that scare developers. I came up with this idea basically right after Halloween ended, so unfortunately this has to be the Scary Spookvember series now instead of Spooktober, which would've made more sense 🤦. This first article is about Regex. Many developers think of it as like a template that can match strings, but actually, Regex is a simple programming language! To show this, let's take a look at a simple Regex that matches a simple lowercase UUID, such as e81dd3ba-44bb-11ec-81d3-0242ac130003 . The Regex that I found on stack overflow is: \b([0-9a-f]){8}-([0-9a-f]){4}-([0-9a-f]){4}-([0-9a-f]){4}-([0-9a-f]){12}\b At first glance, this looks quite confusing and scary, but once we reformat it a bit, things begin to start taking shape: \b # match the beginning or end of a word ( [0-9a-f] # match any character from 0-9 or a-f ) {8} # loop 8 times - # match the...

Link Prediction Using Friends Common ++

Image
Imagine the following scenario: You are provided a list of people in a conference, and you can see all of their Facebook friends. You want to know which people probably know each other. How can you do that in a way that is efficient?  Idea 0: If they are FB friends, then they are probably real life friends Right off the bat, you know that if somebody at the conference is Facebook friends with another person at the conference, then they're very likely to know each other. This is pretty quick to compute. You just build a map of conference goers to Facebook Friends, then go through all their Facebook Friends and check if they are a conference goer. However, now that we know who probably directly knows each other based on their Facebook friends, how can we figure out who might know each other at the conference but have not added each other on Facebook? Idea 1: Count the number of common Facebook friends One easy way to do this would be to say, for any two people, the more Facebook frie...