Help me choose

Posts151

[Effective Java] Item 38: emulate extensible enums with interfaces Enums cannot be extended. What does that mean? If we have an enum, and it had a method, then we cannot create another enum that implements the same method signature while being under the same type. There's a workaround for that. You can make enum implement an interface. This interface becomes the super type that can be extended by other enums. GradeCalculable Interface YearLevel Enum Advantage 1.. 2021. 11. 6.
[DDIS Part II]: Distributed system - Replication Replication Distributed database can come in two flavours: partition, replication. Replication is where you have multiple copies of database stored on different nodes (machines). Replication achieves: - lower latency (we can distribute database geographically so that access time from all around the world can be minimised) - higher availability (faults can be masked, replacement of faulted machin.. 2021. 11. 5.
[Effective Java] Item 37: Using EnumMap as a way to group items by enum Why should you read this article? - You want to group collection into different groups, by enum. - You want to avoid using Set[] and use Map, but want to minimise memory consumption (ie not use HashMap, but something equivalent in memory consumption to simple array that is fixed sized) Let's get started! Oftentimes, a list (or any kind of collection) might need to be grouped into separate groups.. 2021. 11. 5.
Algorithm cheatsheet Binary Tree General steps for DFS: 1. skip condition (start/leaf node) 2. visit current node (add current node to path, add sum etc) 3. DFS left and right 4. clean up (rollback whatever is shared across calls) Find # of paths from root that sum to target Precondition: Binary tree with integer nodes. Given root of the tree, find # of paths from root that sum to target. Algorithm: Parameters: n = .. 2021. 10. 24.
CSS man you are pretty cool I think I've reached a point where I can now think about CSS. What the hell does that mean? Well, I'm not sure. But it kind of means that I can think through my decisions, understand what's going on with the layout to the extent that I can think of a solution around some erratic behaviours. Now don't get me wrong, I am still starting out. But when I was working on replicating the wireframe like .. 2021. 10. 22.
Road to frontend mastery So recently I've landed on a role as a frontend intern. Woohoo! That means 1) I now don't have to worry about getting an internship 2) I have to have a decent working React & CSS & JS knowledge. I can say that I've used them, but I'm not very solid on anything to do with React/CSS/JS. I mean, I know bits and pieces which are enough to get me through, but I'm not so solid on those languages. At t.. 2021. 10. 22.
Software architecture - structure and views Structure describes a software system in different contexts. There are three structures: Module structure, Component-and-connector structure (CNC from here on), Allocation structure. Module structure describes static structure of the software system, while CNC structure describes runtime structure. Allocation structure is an add-on to either Module structure or CNC structure. Structure itself is.. 2021. 10. 16.
Link layer packet (frame) transfer This is a more in-depth overview of what happens in link layer when a host wants to send a message from a host to another host. The last post covered how error detection works in Link Layer, so I won't bother about the details of error detection in this post. Rather, I will focus more on keywords like MAC, LAN, ethernet, switches, ARP. I know, lots of buzzwords, but that's network :0 Each host h.. 2021. 10. 12.
Link layer Error Detection Code (EDC) Link layer is the second layer in the five layer model of network. Link layer packet is called 'frame', and the purpose of link layer is to put datagram (from network layer) into a frame. Frame = [headers, EDC(error detection code), datagram, trailers] Out of services that link layer provides, error detection and correction are two things that we will focus our discussion on. Error detection and.. 2021. 10. 10.
Hierarchical routing (iBGP, eBGP, OSPF, RIP) Motivation We communicate from our house to somewhere distant. In order for this to happen, we need to determine exactly which routers have to be trodden to get from our host to the other host. Routing algorithm determines the path. We also want the algorithm to provide the most efficient path to get from one host to another. The easiest way to do this is to see the network as a single, giant gr.. 2021. 10. 9.
Client and server architecture Tactic, pattern, architecture In the last two posts(Post 1 Post 2), I described about tactics: a solution to a single quality attribute/requirement (such as modifiability, security, testability, availability, performance) are ensured. Pattern is a higher level solution to multiple quality attributes, and unlike tactic, it has tradeoffs (since a pattern might do good for certain QA, but not other.. 2021. 10. 9.
Modifiability, Security, Testability in Software Architecture Modifiability Here, the stimulus is request for change, and the goal of modifiability tactic is to ensure that changes can be made, tested and deployed within time and budget. It is important to keep in mind that: 1. We only need modifiability of a component when it's reused or will be replaced by another component in the future.. A component that might be reused later will need high modifiabili.. 2021. 10. 9.
Availability and Performance in Software Architecture Here, we discuss two requirements that a software might need to meet, and how the requirements can be met through different tactics. Requirement 1: Availability Availability: the proportion of times client's requests can be served We want ATM machines to work 24/7 as per specification. We expect desktop application to work 8am to 12pm, so we don’t care outside of that hour. Availability is conce.. 2021. 10. 8.
PyQT5 simple, self-contained snippet for dialog popup It seems like I need to just make a pop up from time to time, and it's annoying because all the sample codes out there are not self-contained, so it's really annoying to piece things together. Here's the boilerplate that will pop a dialog up when that hello button is pressed class InvitationAcceptDeclineDialog(QDialog): def __init__(self, parent): super().__init__(parent) self.initUI() def initU.. 2021. 10. 6.
When everyone wants to say something - MAC (Medium Access Control) Recall the issue of deadlock? That's when many people wants to access a resource at the same time - we impose concurrency control at different isolation levels and reduce concurrency issues that could occur. There's a very similar issue in networks. It's multiple access problem. Let me outline the context, and the key problem that MAC (Medium Access Control) has to solve. There's a central hub c.. 2021. 10. 5.
Building multiroom chatting app in python (PyQT5, pure TCP socket) I'd like to share what I had to consider while building a chatting application. This is for an assignment where you have to build a chat application where you can connect to a server (by specifying ip address) and chat 1:1 with other people that are connected or create a group chat to talk to others. At the start, I was a little bit frustrated by the requirement - you have to use pure TCP socket.. 2021. 10. 3.
Authentication, Email, SSL Authentication (uses symmetric key system) If A wants to prove its identity to B, that's authentication. Or more precisely, it's an End-point authentication. If A was able to visit B, then it would be super easy to prove its identity. But in the network, the only way that authentication can be done is via packets sent over the network. Authentication of A to B: A sends 'hello' to B. A receives n.. 2021. 9. 30.
How do we guarantee confidentiality and integrity of message over the network? (ft. symmetric key, public key, hash, digital signature, certification authority) Network is always vulnerable to attacks. In particular, the existence of packet sniffing means that whatever is being transferred across the internet can be read, bit by bit. So rather than denying the potential for leaking the packets, network engineers have come up with several very robust, mathematical solutions that even if you know what the bits that are being transferred are, you cannot de.. 2021. 9. 29.
How is IP address allocated to a host/router? What is a subnet? Network layer deals with transmission of network-level packets called IP datagrams. Network layer is present on every router and end systems (hosts). Network layer is not concerned with the abstracted, end-to-end communication between two hosts (as in transport layer). It's concerned with the communication that happens between every pair of routers and hosts. That was abstract enough. Here's whe.. 2021. 9. 25.
Determining control signals for a cycle of instruction Cheatsheet - Singlecycle - Multicycle Properly solving it Look at the question above. It's quite intimidating at the start because it feels very difficult to parse through. Control signals are referring to the orange lines in the diagram below. The red dotted lines are drawn so that it's clear what needs to be considered in each cycle. The territory contained within that red dotted line is what .. 2021. 9. 22.