Posts

Showing posts from 2020

Can white prevent checkmate?

Image
I reached here as black. White to play - Qh5 was my last move. I had just sacked my bishop for 2 pawns to open up the king. Can white save checkmate? Full game: Nimzowitsch-Larsen Attack Fairly interesting in its own way: 1. b3 e5 2. Bb2 Nc6 3. Nf3 d6 4. e4 Nf6 5. Bb5 a6 6. Bxc6+ bxc6 7. Nc3 d5  8. exd5 cxd5 9. O-O Bg4  10. h3 Bh5 11. Qe2 e4 12. g4 Bxg4 13. hxg4 Nxg4 14. Nd4 Qh5 0-1

Expectations of an Engineering Manager

This is a beautiful article that very succinctly and accurately defines management responsibilities: The key principles being: Support the members of your team and help them grow. Follow along the deliveries, setting quality standards, making sure the team has the support they need and upper management the feedback they need [through you and without you] Keep a constant practice of creating, improving or eliminating team or company processes. There are some issues with the article as well: for example, the reliance on Andy Grove's definition of management is something that I don't fully agree with. It's a reasonable definition, don't get me wrong. It's even valuable in certain ways, I just don't fully agree with it though. Traditionally, Andy Grove defined a manager's output as the sum of their team's output and the teams under influence output . This is great if the goal of your organization's managers is to play politics at promotion time (hey I i

Pearls of wisdom: taxing into prosperity

Image
For a nation to try and tax itself into prosperity is like a man standing in a bucket trying to lift himself up by the handle -- Winston Churchill

Checked exceptions break composition

A.K.A. Always Throw Runtime Exceptions or their subclasses A typical Java or C++ function can potentially come with an exception specification: for example, a method can declare that it throws exceptions of a particular type (eg. IOException, std::bad_alloc etc.) and clients need to handle that exception being thrown with a try-catch block. This seems good at the outset till we spend time thinking through what this does to the type of the function. A typical function in a happy-go-lucky world either succeeds or fails with an exception because of something beyond its control. If it succeeds, it returns with a value of the provided return type (let's call it SuccessValueType). If it fails with an exception (eg. a file read error or a mem allocation error), it throws the exception and the error handling parts of the code run. In type terms, the return type of the function is Either<SuccessValueType, RuntimeExceptionType> (where the RuntimeExceptionType is an implicit return ty

IO numbers that everyone should know

In the Numbers Every Programmer Should Know , one set of numbers that I've always found missing were IO numbers (HDD vs SSD - random reads / writes). I found a really good source on StackExchange  for these numbers and for the sake of posterity, I'm documenting this here (for me and for you): SSD | HDD Sequential Read/Write : 700 MB/s+ | 115 MB/s (6x diff)  SSD | HDD Random Read 512KB : 160 MB/s | 39 MB/s (4x diff) SSD | HDD Random Write 512KB : 830 MB/s | 57 MB/s (14x diff) SSD | HDD Random Read  4KB :  27 MB/s  | 0.5 - 1.5 MB/s (17x diff) SSD | HDD Random Write  4KB :  135 - 177 MB/s  | 0.7 MB/s (192x+ diff!) The bottom line is that unless you're thrashing the HDD with lots of 4KB random writes, the HDD should not be tapped out till about 30+ MB/s (and an SSD should be just fine till about 150 - 300 MB/s ). If you're seeing an HDD tapped out at 3 MB/s, then you're either not writing sequentially or your block size of writes is too small. If you're seeing an