What I’m currently reading

Over the last few weeks I found out that the company I work for is going to be sold over to Microsoft in a very large transaction. https://www.nytimes.com/2022/01/18/business/microsoft-activision-blizzard.html

I realized that if I’m going to become a Microsoft Engineer, I might as well start learning more about the windows ecosystem. So I picked up a copy of

As well as Programming Windows

Someone on stack overflow who is a principle engineer at Microsoft recommended these books to me. The programming windows book seems a bit boring for me, as it’s mostly about creating GUI applications. The Advanced Windows book is far more interesting as it goes over what Kernel Objects are and how windows creates different things like Threads, Files, etc. I highly recommend reading both of these if you want to get into windows programming. They seem to be the most comprehensive books I’ve found online.

Perforce for Git Users

This is a quick cheat sheet guide for git users trying to migrate over to perforce. It does not include an exhaustive list of commands, this is just a simple cheat sheet to get people started.

CommandGit Equivalent Perforce DocumentationNotes
p4 syncgit pull / git fetchhttps://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_sync.html
p4 integrategit mergehttps://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_integrate.html
p4 openedgit statushttps://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_opened.htmlThe git status command isn’t a direct equivalent of p4 opened. However, p4 opened will show what files you have checked out that are not yet submitted.
p4 editgit checkouthttps://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_edit.html#p4_editThe git checkout command is usually used for checking out a branch, there is no direct equivalent in git for p4 edit. All files in p4 must be “checked out” first before they can be checked in.
p4 submitgit push/git commithttps://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_submit.html#p4_submitIn git you usually have to do a git commit command and then a push. In p4, it’s all in one command, and you submit a “changelist”

Leetcode 733 – FloodFill

class Solution:
    
    def fill(self, image: List[List[int]], sr: int, sc: int, starting_color: int, newColor: int) -> List[List[int]]:
        if sr < 0 or sc < 0 or sr >= len(image) or sc >= len(image[0]) or image[sr][sc] != starting_color:
            return
        image[sr][sc] = newColor
        self.fill(image, sr + 1, sc, starting_color, newColor)
        self.fill(image, sr - 1, sc, starting_color, newColor)
        self.fill(image, sr, sc + 1, starting_color, newColor)
        self.fill(image, sr, sc - 1, starting_color, newColor)
        
    
    def floodFill(self, image: List[List[int]], sr: int, sc: int, newColor: int) -> List[List[int]]:
        if image[sr][sc] == newColor:
            return image
        self.fill(image, sr, sc, image[sr][sc], newColor)
        return image

This is my solution for the flood fill problem in python.

https://leetcode.com/problems/flood-fill/