[{"content":"Some tips and tricks for the CP-SAT solver.\nResources: https://github.com/or-tools/awesome_or-tools https://github.com/d-krupke/cpsat-primer https://stackoverflow.com/questions/tagged/or-tools https://or.stackexchange.com/questions/tagged/or-tools https://groups.google.com/g/or-tools-discuss https://github.com/google/or-tools/discussions https://discord.gg/ENkQrdf Solver Parameters By default, OR-tools will try to use all available cores but you can set num_search_workers manually.\nsolver.parameters.num_search_workers = 8 If the program silently crashes you can enable logging to get more info.\nsolver.parameters.log_search_progress = True You can also see which worker is better for your problem and improve the single core performance by setting the same parameters.\nSearch for all optimal solutions You can\u0026rsquo;t enumerate all solutions if you have an objective, so you have to do it in two steps:\n# Get the optimal objective value model.Maximize(objective) solver.Solve(model) # Set the objective to a fixed value # use round() instead of int() model.Add(objective == round(solver.ObjectiveValue())) model.Proto().ClearField(\u0026#39;objective\u0026#39;) # Search for all solutions solver.parameters.enumerate_all_solutions = True solver.Solve(model, cp_model.VarArraySolutionPrinter([x, y, z])) Non-contiguous Intvar Alternatives to model.NewIntVar(lb, ub, name), solving might be faster:\n# List of values model.NewIntVarFromDomain( cp_model.Domain.FromValues([1, 3, 4, 6]), \u0026#39;x\u0026#39; ) # List of intervals model.NewIntVarFromDomain( cp_model.Domain.FromIntervals([[1, 2], [4, 6]]), \u0026#39;x\u0026#39; ) # Exclude [-1, 1] model.NewIntVarFromDomain( cp_model.Domain.FromIntervals([[cp_model.INT_MIN, -2], [2, cp_model.INT_MAX]]), \u0026#39;x\u0026#39; ) # Constant model.NewConstant(154) Domains Working with Domains gives a lot of flexibility and should be faster than creating multiple constraints.\ndomain = cp_model.Domain(0, 10) domain = cp_model.Domain.FromValues([1, 3, 4, 6]) domain = cp_model.Domain.FromIntervals([[1, 2], [4, 6]]) domain = cp_model.Domain.FromIntervals([ [cp_model.INT_MIN, -2], [2, cp_model.INT_MAX] ]) model.AddLinearExpressionInDomain(sum(my_vars), domain).OnlyEnforceIf(b) Iff, equivalence, boolean product p \u0026lt;=\u0026gt; (x and y)\n# (x and y) =\u0026gt; p, rewrite as not(x and y) or p model.AddBoolOr([x.Not(), y.Not(), p]) # p =\u0026gt; (x and y) model.AddImplication(p, x) model.AddImplication(p, y) Boolean sum, boolean or p \u0026lt;=\u0026gt; (x or y)\n# p =\u0026gt; (x or y), rewrite as not(p) or x or y model.AddBoolOr([x, y, p.Not()]) # (x or y) =\u0026gt; p model.AddImplication(x, p) model.AddImplication(y, p) Note: see De Morgan\u0026rsquo;s laws\nBoolean Implications # a =\u0026gt; b (both booleans) model.AddImplication(a, b) # a \u0026lt;=\u0026gt; b (use only one of them if you can) model.Add(a == b) # a and b and c =\u0026gt; d model.Add(d == 1).OnlyEnforceIf([a, b, c]) or model.AddBoolOr([a.Not(), b.Not(), c.Not(), d]) If-Then-Else Using intermediate boolean variables.\nb = model.NewBoolVar(\u0026#39;b\u0026#39;) # Implement b == (x \u0026gt;= 5). model.Add(x \u0026gt;= 5).OnlyEnforceIf(b) model.Add(x \u0026lt; 5).OnlyEnforceIf(b.Not()) Solution hint / Warm start It may speed up the search.\nnum_vals = 3 x = model.NewIntVar(0, num_vals - 1, \u0026#39;x\u0026#39;) y = model.NewIntVar(0, num_vals - 1, \u0026#39;y\u0026#39;) z = model.NewIntVar(0, num_vals - 1, \u0026#39;z\u0026#39;) model.Add(x != y) model.Maximize(x + 2 * y + 3 * z) # Solution hinting: x \u0026lt;- 1, y \u0026lt;- 2 model.AddHint(x, 1) model.AddHint(y, 2) Storing Multi-index variables I recommend using dictionary comprehensions:\nemployee_works_day = { (e, day): model.NewBoolVar(f\u0026#34;{e} works {day}\u0026#34;) for e in employees for day in days } Variable product (Non linear) You have to create an intermediate variable:\nx = model.NewIntvar(0, 8, \u0026#39;x\u0026#39;) y = model.NewIntvar(0, 5, \u0026#39;y\u0026#39;) xy = model.NewIntVar(0, 8*5, \u0026#39;xy\u0026#39;) model.AddMultiplicationEquality(xy, [x, y]) Black box function (Non linear) As your last resort you can precalculate all the posible values and use an element constraint.\nfrom ortools.sat.python import cp_model model = cp_model.CpModel() x = model.NewIntVar(0, 10, \u0026#34;\u0026#34;) two_to_the_x = model.NewIntVar(1, 2 ** 10, \u0026#34;\u0026#34;) precalculated = [2 ** i for i in range(11)] model.AddElement(x, precalculated, two_to_the_x) # test model.Add(x == 3) solver = cp_model.CpSolver() solver.Solve(model) print(\u0026#34;x\u0026#34;, solver.Value(x)) print(\u0026#34;2**x\u0026#34;, solver.Value(two_to_the_x)) Load model Proto This allows you to use different machines.\nfrom google.protobuf import text_format from ortools.sat.python import cp_model model = cp_model.CpModel() a = model.NewIntVar(0, 10, \u0026#34;a\u0026#34;) b = model.NewIntVar(0, 10, \u0026#34;b\u0026#34;) model.Maximize(a + b) new_model = cp_model.CpModel() text_format.Parse(str(model), new_model.Proto()) solver = cp_model.CpSolver() status = solver.Solve(new_model) print(solver.StatusName(status)) print(solver.ObjectiveValue()) Circuit constraint (ordering) Ordering the numbers from 1 to 10 so that we maximize the distance between between numbers:\nfrom itertools import permutations from ortools.sat.python import cp_model model = cp_model.CpModel() solver = cp_model.CpSolver() literals = {} # An arc is just a (int, int, BoolVar) tuple all_arcs = [] nodes = range(1, 11) for i in nodes: # We use 0 as a dummy nodes as we don\u0026#39;t have an actual circuit literals[0, i] = model.NewBoolVar(f\u0026#34;0 -\u0026gt; {i}\u0026#34;) # start arc literals[i, 0] = model.NewBoolVar(f\u0026#34;{i} -\u0026gt; 0\u0026#34;) # end arc all_arcs.append([0, i, literals[0, i]]) all_arcs.append([i, 0, literals[i, 0]]) for i, j in permutations(nodes, 2): # this booleans will be true if the arc is present literals[i, j] = model.NewBoolVar(f\u0026#34;{i} -\u0026gt; {j}\u0026#34;) all_arcs.append([i, j, literals[i, j]]) # to make an arc optional, add the [i, i, True] loop model.AddCircuit(all_arcs) model.Maximize(sum(literals[i, j] * abs(i - j) for i, j in permutations(nodes, 2))) solver.Solve(model) node = 0 print(node, end=\u0026#34;\u0026#34;) while True: for i in nodes: if i != node and solver.Value(literals[node, i]): print(f\u0026#34; -\u0026gt; {i}\u0026#34;, end=\u0026#34;\u0026#34;) node = i break else: break print(\u0026#34; -\u0026gt; 0\u0026#34;) Fairness, distribute items evenly Maximize the minimum value model = cp_model.CpModel() n_tasks = 100 n_employees = 3 min_tasks = model.NewIntVar(0, n_tasks, \u0026#34;\u0026#34;) employee_tasks = [model.NewIntVar(0, n_tasks, \u0026#34;\u0026#34;) for _ in range(n_employees)] model.Add(sum(employee_tasks) == n_tasks) model.AddMinEquality(min_tasks, employee_tasks) model.Maximize(min_tasks) solver = cp_model.CpSolver() status = solver.Solve(model) print([solver.Value(n) for n in employee_tasks]) Minimize delta to the average value model = cp_model.CpModel() n_tasks = 100 n_employees = 3 avg = n_tasks // n_employees delta = model.NewIntVar(0, n_tasks, \u0026#34;\u0026#34;) employee_tasks = [model.NewIntVar(0, n_tasks, \u0026#34;\u0026#34;) for _ in range(n_employees)] model.Add(sum(employee_tasks) == n_tasks) for i in range(n_employees): model.Add(employee_tasks[i] \u0026lt;= avg + delta) model.Add(employee_tasks[i] \u0026gt;= avg - delta) model.Minimize(delta) solver = cp_model.CpSolver() status = solver.Solve(model) print([solver.Value(n) for n in employee_tasks]) Multiobjective optimization Two ways to achieve that:\nAdd a weight to each objective Solve with the first objective, constraint the objective with the solution, hint and solve with the new objective. from ortools.sat.python import cp_model model = cp_model.CpModel() solver = cp_model.CpSolver() x = model.NewIntVar(0, 10, \u0026#34;x\u0026#34;) y = model.NewIntVar(0, 10, \u0026#34;y\u0026#34;) # Maximize x model.Maximize(x) solver.Solve(model) print(\u0026#34;x\u0026#34;, solver.Value(x)) print(\u0026#34;y\u0026#34;, solver.Value(y)) print() # Hint (speed up solving) model.AddHint(x, solver.Value(x)) model.AddHint(y, solver.Value(y)) # Maximize y (and constraint prev objective) model.Add(x == round(solver.ObjectiveValue())) # use \u0026lt;= or \u0026gt;= if not optimal model.Maximize(y) solver.Solve(model) print(\u0026#34;x\u0026#34;, solver.Value(x)) print(\u0026#34;y\u0026#34;, solver.Value(y)) Soft constraints https://stackoverflow.com/a/66377562\nEarly stopping Stop if objective does not improve.\nfrom threading import Timer from ortools.sat.python import cp_model class ObjectiveEarlyStopping(cp_model.CpSolverSolutionCallback): def __init__(self, timer_limit: int): super(ObjectiveEarlyStopping, self).__init__() self._timer_limit = timer_limit self._timer = None self._reset_timer() # Remove to guarantee a solution def on_solution_callback(self): self._reset_timer() def _reset_timer(self): if self._timer: self._timer.cancel() self._timer = Timer(self._timer_limit, self.StopSearch) self._timer.start() def StopSearch(self): print(f\u0026#34;{self._timer_limit} seconds without improvement\u0026#34;) super().StopSearch() ","permalink":"https://xiang.dev/posts/cp-sat/","summary":"\u003cp\u003eSome tips and tricks for the CP-SAT solver.\u003c/p\u003e","title":"✨ Recipes for Google OR-Tools"},{"content":"List of tools I use daily\nCoding IDE: PyCharm / VS Code Autocompletion: Copilot Formatters: black / ruff / prettier Questions: Stack Overflow / Reddit Code search: Sourcegraph / Github Libraries list: Awesome / Awesome-python / Bundlephobia VCS Hosting: Github / Gitlab / Bitbucket Conventions: Gitmoji / Conventional Comments / Conventional Commits pre-commit Communication Chat: Slack / Google Chat / Discord Tickets: Trello / Jira Documentation: Confluence Code sharing: Pastebin / carbon API Tunneling: ngrok HTTP Client: bruno / httpie Spec: Swagger / Async API JSON: CyberChef / jq / JWT DB SQL: DBeaver NoSQL: NoSQLBooster Devops CI/CD: Cloud Build / Jenkins / GitHub Actions Static Analysis: SonarQube Docker: Docker Desktop / Docker Compose / OpenLens / Pod Menu Other Diagrams: Excalidraw / draw.io / jsoncrack / sequencediagram Images: Unsplash / Pexels / FreePik Office: Google docs PDF, image editing: tinywow Data generator: DNI generator / RandomKeyGen PassWords: KeePass / KeePassXC Browsers: Chrome / Firefox Developer Edition Browser Plugins: Awesome Screen / Json viewer Music: Spotify / Lofi Girl ","permalink":"https://xiang.dev/posts/tooling/","summary":"\u003cp\u003eList of tools I use daily\u003c/p\u003e","title":"🔨 My Development Tools"},{"content":"Some notes about computer networking, won\u0026rsquo;t go too deep.\nReferences Zines by Julia Evans Network warrior book OSI / CIDR DNS IPv4 Address classes Class Start End Mask CIDR Class A 0.0.0.0 127.255.255.255 255.0.0.0 /8 Class B 128.0.0.0 191.255.255.255 255.255.0.0 /16 Class C 192.0.0.0 223.255.255.255 255.255.255.0 /24 Class D 224.0.0.0 239.255.255.255 - /4 Class E 240.0.0.0 255.255.255.255 - - Private addresses Desc Start End CIDR class A (1) 10.0.0.0 10.255.255.255 10.0.0.0/8 class B (16) 172.16.0.0 172.31.255.255 172.16.0.0/12 class C (256) 192.168.0.0 192.168.255.255 192.168.0.0/16 CIDR Notation 198.51.100.0/24\nSubnet. The first 24 bits (198.51.100) define the network portion, and the remaining 8 bits are for individual devices (hosts) within that network. This subnet can contain a total of 256 (2^8) IP addresses, but two are reserved (network address - 198.51.100.0 and broadcast address - 198.51.100.255).\n198.51.100.14/24 198.51.100.14 is a specific IP address within the subnet defined by 198.51.100.0/24. The \u0026ldquo;/24\u0026rdquo; still refers to the subnet mask, but in this case, it clarifies that this particular IP (198.51.100.14) belongs to the network 198.51.100.0/24.\nOSI Model 7. Application Layer Data generated by and usable by software applications (eg: API calls).\nProtocols: HTTP and SMTP.\n6. Presentation Layer Responsible for translation, encryption, and compression of data.\nProtocols: HTTPS??\n5. Session Layer This is the layer responsible for opening and closing communication between the two devices.\nUsually handled by TCP.\n4. Transport Layer This includes taking data from the session layer and breaking it up into chunks called segments before sending it to layer 3.\nProtocols: TCP, UDP.\n3. Network Layer Handles the routing and sending of data between different networks.\nProtocols: IP and ICMP.\nRouter (Gateway) Device that forwards packets to a destination other than the local network\n2. Data Link Layer Facilitates data transfer between two devices on the same network.\nEthernet Switches Forwarding based on MAC addresses, maintains a mapping of MAC -\u0026gt; PORT (physical).\nAddress Resolution Protocol (ARP) https://en.wikipedia.org/wiki/Address_Resolution_Protocol#Example\n1. Physical Layer Includes the physical equipment involved in the data transfe (cables and switches). Data gets converted into a bit stream (1s and 0s).\n","permalink":"https://xiang.dev/posts/networking/","summary":"\u003cp\u003eSome notes about computer networking, won\u0026rsquo;t go too deep.\u003c/p\u003e","title":"📝 Networking notes"},{"content":"Some notes about Japanese\nResources Rikaikun Extension Tae Kim\u0026rsquo;s Guide Spotify playlist: use spotify web to copy lyrics 漢字で GO!: Kanji game, pretty hard Anki Syosetu web novels 傭兵団の料理番: Cook of the Mercenary Corp 無職転生: Mushoku tensei 陰の実力者になりたくて: The eminence in shadow 異世界のんびり農家: Farming Life in Another World 薬屋のひとりごと: The Apothecary Diaries Gemini Gem Purpose and Goals: * Analyze Japanese phrases provided by the user. * Provide a structured breakdown of each phrase, including the original phrase, its romanization, its overall meaning, and a detailed explanation of each component word. * Follow the specified format closely without adding extra information or explanations beyond the requested structure. Behaviors and Rules: 1) Input Processing: a) Receive a Japanese phrase from the user. b) Identify each word and particle within the phrase. c) Determine the romanization for the entire phrase. d) Translate the overall meaning of the phrase into English. e) For each component word or particle, provide its individual meaning in English. 2) Output Formatting: a) Present the breakdown in the following structured format as a list: - Original: [Original Japanese Phrase] - Romanji: \u0026#39;[Romanized Japanese Phrase]\u0026#39; - Meaning: \u0026#39;[Overall English Meaning]\u0026#39; And a table with breakdown of - [Japanese Word/Particle 1] ([Romanization 1]): [English Meaning 1] - [Japanese Word/Particle 2] ([Romanization 2]): [English Meaning 2] - ... (and so on for all components) b) Do not include any introductory or concluding remarks. c) Adhere strictly to the requested structure and avoid adding any extra explanations or details. d) Maintain accuracy in romanization and translation. Overall Tone: * Be informative and analytical. * Maintain a neutral and objective tone. * Focus solely on providing the requested structured breakdown. ","permalink":"https://xiang.dev/posts/japanese/","summary":"\u003cp\u003eSome notes about Japanese\u003c/p\u003e","title":"🎓 Studying Japanese"},{"content":"Things to listen and/or watch during commute.\nPodcasts Name Links Description Soft Skills Eng. ⭐⭐⭐⭐⭐ Software Eng. Daily Some cool guests Changelog News Stack Overflow Pretty nice Real Python 🐍 Redhat \u0026hellip; Syntax \u0026hellip; Ologies with Alie Ward Relax \u0026amp; Science CodelyTV Spanish Paradigma Digital Spanish _ _ \u0026hellip; YT channels and playlists TODO\n","permalink":"https://xiang.dev/posts/things/","summary":"\u003cp\u003eThings to listen and/or watch during commute.\u003c/p\u003e","title":"📺 Things to listen / watch"},{"content":"Notes about the book.\nWhat Is Software Engineering? Programming integrated over time.\nWith a sufficient numbers of users of an API [\u0026hellip;] all observable behaviors of your system will be depended on by somebody. - Hyrum\u0026rsquo;s Law\nIt\u0026rsquo;s programming if \u0026lsquo;clever\u0026rsquo; is a compliment, but it\u0026rsquo;s software engineering if \u0026lsquo;clever\u0026rsquo; is an accusation.\nIf a product experiences outages [\u0026hellip;] but the issue wasn\u0026rsquo;t surfaced by tests in CI, it is not the fault of the infrastructure change.\n\u0026ldquo;If you liked it, you should have put a CI test on it.\u0026rdquo;\nThe more frequently you change your infrastructure, the easier it becomes to do so.\nFinding problems earlier in the developer worklow usually reduces costs.\nCosts: Financial (money), Resource (CPU), Personnel (effort), Transaction (to take action), Opportunity (cost to not take action), Societal (impact on society)\nJevons Paradox: consumption of a resource may increase as a response to greater efficiency in its use.\nSoftware is sustainable when, for the expected life span of the code, we are capable of responding to changes in dependencies, technology, or product requirements. We may choose to not change things, but we need to be capable.\nMost decisions are based on a mix of data, assumption, precedent, and argument. It’s best when objective data makes up the majority of those inputs, but it can rarely be all of them. Being data driven over time implies the need to change directions when the data changes\nHow to Work Well on Teams You\u0026rsquo;re probably not a genius.\nThe chances of an early misstep are high. The more feedback you solicit early on, the more you lower this risk. [\u0026hellip;] “Fail early, fail fast, fail often.”\nBus factor: the number of people that need to get hit by a bus before your project is completely doomed.\nProgrammers work best in tight feedback loops: write a new function, compile. Add a test, compile. Refactor some code, compile.\nSoftware engineering is a team endeavor.\nPillar 1: Humility, You are not the center of the universe (nor is your code!). You’re neither omniscient nor infallible. You’re open to self-improvement.\nPillar 2: Respect, You genuinely care about others you work with. You treat them kindly and appreciate their abilities and accomplishments.\nPillar 3: Trust, You believe others are competent and will do the right thing, and you’re OK with letting them drive when appropriate.\nDo not underestimate the power of playing the social game. It’s not about tricking or manipulating people; it’s about creating relationships to get things done.\n“Hey, I’m confused by the control flow in this section here. I wonder if the xyzzy code pattern might make this clearer and easier to maintain?”\nA good postmortem should include the following:\nA brief summary of the event A timeline of the event, from discovery through investigation to resolution The primary cause of the event Impact and damage assessment A set of action items (with owners) to fix the problem immediately A set of action items to prevent the event from happening again Lessons learned Googleyness:\nThrives in ambiguity: can deal with conflicting messages or directions Values feedback: has humility to both receive and give feedback gracefully Challenges status quo: Is able to set ambitious goals and pursue them Puts users first: Has empathy and respect for users Cares about the team: Has empathy and respect for coworkers Does the right thing: Has strong sense of ethics about everything they do If you want to work effectively with a team or a large organization, be aware of your preferred working style and that of others.\nKnowledge Sharing Challenges\nLack of psychological safety Information islands Information fragmentation Information duplication Information skew Software engineering can be defined as the multiperson development of multiversion programs.\nCooperative Adversarial Basic questions or mistakes are guided in the proper direction Basic questions or mistakes are picked on, and the person asking the question is chastised Explanations are given with the intent of helping the person asking the question learn Explanations are given with the intent of showing off one’s own knowledge Responses are kind, patient, and helpful Responses are condescending, snarky, and unconstructive Interactions are shared discussions for finding solutions Interactions are arguments with “winners” and “losers” No feigning surprise No well-actually’s No backseat driving No subtle -isms Always be learning; always be asking questions.\nSeek out and understand context, especially for decisions that seem unusual.\nThe first time you learn something is the best time to see ways that the existing documentation and training materials can be improved.\nEngineering for Equity Bias is the default.\nDiversity is necessary to design properly for a comprehensive user base.\nInclusivity is critical not just to improving the hiring pipeline for underrepresented groups, but to providing a truly supportive work environment for all people.\nProduct velocity must be evaluated against providing a product that is truly useful to all users. It’s better to slow down than to release a product that might cause harm to some users.\nDon\u0026rsquo;t build for everyone. Build with everyone.\nDesign for the user who will have the most difficulty using your product.\nHow to Lead Team An engineering manager is responsible for the performance, productivity, and happiness of every person on their team— including their tech lead— while still making sure that the needs of the business are met\nThe tech lead (TL) of a team— who will often report to the manager of that team— is responsible for the technical aspects of the product,\nIf an individual succeeds, praise them in front of the team. If an individual fails, give constructive criticism in private.\nAntipattern: Hire Pushovers\nYou should strive to hire people who are smarter than you and can replace you.\nAntipattern: Ignore Low Performers\nIf you immediately deal with a low performer, you’ll often find that they merely need some encouragement or direction to slip into a higher state of productivity. If you wait too long to deal with a low performer, their relationship with the team is going to be so sour and you’re going to be so frustrated that you’re not going to be able to help them.\nAntipattern: Ignore Human Issues\nAntipattern: Be Everyone’s Friend\nIt can be tricky to move into a management role over someone who has been a good friend and a peer. [\u0026hellip;] We recommend that you avoid getting into this situation whenever possible, but if you can’t, pay extra attention to your relationship with those folks.\nAntipattern: Compromise the Hiring Bar\nA team needs to hire 5 engineers, so it sifts through a pile of applications, interviews 40 or 50 people, and picks the best 5 candidates regardless of whether they meet the hiring bar. This is one of the fastest ways to build a mediocre team.\nAntipattern: Treat Your Team Like Children\nIf you hire people worthy of trust and show these people you trust them, they’ll usually rise to the occasion.\nLose the Ego\nPart of “losing the ego” is trust: you need to trust your team.\nBe a Zen Master\nMediating your reactions and maintaining your calm is more important as you lead more people. Zen management trick: asking questions.\nBe a Catalyst, Remove Roadblocks, Be a Teacher and a Mentor, Set Clear Goals, Be Honest, Track Happiness\nDelegate, but get your hands dirty. Seek to replace yourself. Know when to make waves. Shield your team from chaos. Give your team air cover. Let your team know when they\u0026rsquo;re doing well.\nDelegate where possible; don\u0026rsquo;t DIY.\nLeading at Scale Always be Deciding, Always be Leaving, Always be Scaling\nReevaluate and rebalance the trade-offs again; it\u0026rsquo;s an iterative process. This is what we mean when we say Always Be Deciding.\nYour Mission: Build a \u0026ldquo;Self-Driving\u0026rdquo; Team\nAsk yourself: What can I do that nobody else on my team can do?\nIt\u0026rsquo;s also important to \u0026ldquo;manage up\u0026rdquo;, making sure your management chain understand what your group is doing and staying connected to the company at large.\n95% observation and listening, and 5% making critical adjustments in just the right place.\nAnchoring a team identity to a specific solution can lead to all sorts of angst over time. (should own the problem instead)\nYour organization is scaling by tackling new problems and then figuring out how to compress them so that it can take on new, parallel struggles.\nIf you let yourself slip into pure reactive mode (which happens almost automatically), you spend every moment of your life on urgent things, but almost none of those things are important in the big picture.\nFirst, even if you don’t delegate that middle 60% of tasks, your subleaders often notice and pick them up automatically. Second, if something in that middle bucket is truly critical, it ends up coming back to you anyway, eventually migrating up into the top 20%.\nMeasuring Engineering Productivity \u0026hellip;\nProcesses \u0026hellip;\nStyle Guides and Rules \u0026hellip;\nCode Review \u0026hellip;\nDocumentation \u0026hellip;\nTesting Overview \u0026hellip;\nUnit Testing They tend to be small according to Google’s definitions of test size. They tend to be easy to write at the same time as the code they’re testing, They promote high levels of test coverage because they are quick and easy to write. They tend to make it easy to understand what’s wrong when they fail They can serve as documentation and examples. we encourage engineers to aim for a mix of about 80% unit tests and 20% broader-scoped tests.\nbrittle: they broke in response to a harmless and unrelated change that introduced no real bugs. Second, the tests were unclear: after they were failing, it was difficult to determine what was wrong,\nthe ideal test is unchanging: after it’s written, it never needs to change unless the requirements of the system under test change.\nWhen an engineer refactors the internals of a system without modifying its interface, whether for performance, clarity, or any other reason, the system’s tests shouldn’t need to change.\nAs with refactorings, a change to existing tests when adding new features suggest unintended consequences of that feature or inappropriate tests.\nthe presence of the bug suggests that a case was missing from the initial test suite,\nChanging a system’s existing behavior is the one case when we expect to have to make updates to the system’s existing tests.\nThe takeaway is that after you write a test, you shouldn’t need to touch that test again as you refactor the system, fix bugs, or add new features.\nwrite tests that invoke the system being tested in the same way its users would; that is, make calls against its public API rather than its implementation details\nTest State, Not Interactions: we tend to prefer the use of real objects in favor of mocked objects, as long as the real objects are fast and deterministic.\nA clear test is one whose purpose for existing and reason for failing is immediately clear to the engineer diagnosing a failure.\nA test is complete when its body contains all of the information a reader needs in order to understand how it arrives at its result. A test is concise when it contains no other distracting or irrelevant information.\nrather than writing a test for each method, write a test for each behavior.\nBehaviors can often be expressed using the words “given,”“when,” and “then”\nWhen writing such tests, be careful to ensure that you’re not inadvertently testing multiple behaviors at the same time. Each test should cover only a single behavior, and the vast majority of unit tests require only one “when” and one “then” block.\nA test’s name should summarize the behavior it is testing. A good name describes both the actions that are being taken on a system and the expected outcome\nmultiplyingTwoPositiveNumbersShouldReturnAPositiveNumber multiply_postiveAndNegative_returnsNegative divide_byZero_throwsException\nin test code, stick to straight-line code over clever logic, and consider tolerating some duplication when it makes the test more descriptive and meaningful.\nA good failure message contains much the same information as the test’s name: it should clearly express the desired outcome, the actual outcome, and any relevant parameters.\nGood tests are designed to be stable, and in fact you usually want them to break when the system being tested changes. So DRY doesn’t have quite as much benefit when it comes to test code.\nInstead of being completely DRY, test code should often strive to be DAMP —that is, to promote “Descriptive And Meaningful Phrases.”\nDAMP is not a replacement for DRY; it is complementary to it. Helper methods and test infrastructure can still help make tests clearer by making them more concise, factoring out repetitive steps whose details aren’t relevant to the particular behavior being tested.\nUsing helper methods to construct these values allows each test to create the exact values it needs without having to worry about specifying irrelevant information or conflicting with other tests.\nOne risk in using setup methods is that they can lead to unclear tests if those tests begin to depend on the particular values used in setup.\nTests like these that explicitly care about particular values should state those values directly, overriding the default defined in the setup method if need be.\nThe best validation helper methods assert a single conceptual fact about their inputs, in contrast to general-purpose validation methods that cover a range of conditions.\nStrive for unchanging tests. Test via public APIs. Test state, not interactions. Make your tests complete and concise. Test behaviors, not methods. Structure tests to emphasize behaviors. Name tests after the behavior being tested. Don’t put logic in tests. Write clear failure messages. Follow DAMP over DRY when sharing code for tests. Test Doubles \u0026hellip;\nLarger Testing \u0026hellip;\nDeprecation \u0026hellip;\nTools \u0026hellip;\nVersion Control and Branch Management \u0026hellip;\nCode Search \u0026hellip;\nBuild Systems and Build Philosophy \u0026hellip;\nCritique: Google\u0026rsquo;s Code Review Tool \u0026hellip;\nStatic Analysis \u0026hellip;\nDependency Management \u0026hellip;\nLarge-Scale Changes \u0026hellip;\nContinuous Integration \u0026hellip;\nContinuous Delivery \u0026hellip;\nCompute as a Service \u0026hellip;\n","permalink":"https://xiang.dev/posts/software-google/","summary":"\u003cp\u003eNotes about the \u003ca href=\"https://abseil.io/resources/swe-book\"\u003ebook\u003c/a\u003e.\u003c/p\u003e","title":"📝 Software Engineering at Google notes"},{"content":"Quick look at the repo for arq by Samuel Colvin.\nLinks: https://github.com/samuelcolvin/arq/ https://pypi.org/project/arq/ Codemap .github/: mainly GitHub Actions arq/: source code docs/: sphinx documentation requirements/: requirements.in and txt, using pip-tools, for local dev tests/: pytest, one test file per public module .codecov.yml: codecov config .gitignore .pre-commit-config.yaml: pre-commit + make lint + mypy HISTORY.rst: changelog LICENSE: MIT Makefile: install, format, lint (flake8, isort, black), test, all, docs, etc README.md: simple readme for github and pypi pyproject.toml: hatchling, PEP 621, config for pytest, coverage, black, isort, mypy Dependencies Direct redis[hiredis]: redis interface with faster parser click: Command Line Interface Creation Kit, from the pallets team typing-extensions: backport of new typing features for older python versions docs.in Sphinx: documentation generator for multiple languages linting.in black: code formatter flake8: linter flake8-quotes isort[colors]: import sorter with colorama mypy: static type checker types-pytz: typeshed stubs for pytz types-redis: typeshed stubs for redis testing.in coverage[toml] dirty-equals msgpack pydantic pytest pytest-asyncio pytest-mock pytest-sugar pytest-timeout pytz redislite Code examples Use __all__ in __init__.py to control what is exported __all__ = ( \u0026#39;ArqRedis\u0026#39;, \u0026#39;create_pool\u0026#39;, \u0026#39;cron\u0026#39;, \u0026#39;VERSION\u0026#39;, \u0026#39;Retry\u0026#39;, \u0026#39;Worker\u0026#39;, \u0026#39;check_health\u0026#39;, \u0026#39;func\u0026#39;, \u0026#39;run_worker\u0026#39;, ) __main__.py file to run the module as a script, e.g. arq --help: from .cli import cli if __name__ == \u0026#39;__main__\u0026#39;: cli() from typing import TYPE_CHECKING to avoid circular imports: if TYPE_CHECKING: from .typing import WorkerSettingsType py.typed file to indicate that the package is fully typed, for tools like mypy sphinx markup in docstrings, type only with type hints async def abort(self, *, timeout: Optional[float] = None, poll_delay: float = 0.5) -\u0026gt; bool: \u0026#34;\u0026#34;\u0026#34; Abort the job. :param timeout: maximum time to wait for the job result before raising ``TimeoutError``, will wait forever on None :param poll_delay: how often to poll redis for the job result :return: True if the job aborted properly, False otherwise \u0026#34;\u0026#34;\u0026#34; Use sys.version_info to check for python version if sys.version_info \u0026gt;= (3, 8): from typing import Literal, Protocol else: from typing_extensions import Literal, Protocol typing.py file with type aliases and Protocol classes instead of Callable OptionType = Union[None, Set[int], int] WeekdayOptionType = Union[OptionType, Literal[\u0026#39;mon\u0026#39;, \u0026#39;tues\u0026#39;, \u0026#39;wed\u0026#39;, \u0026#39;thurs\u0026#39;, \u0026#39;fri\u0026#39;, \u0026#39;sat\u0026#39;, \u0026#39;sun\u0026#39;]] SecondsTimedelta = Union[int, float, timedelta] class WorkerCoroutine(Protocol): __qualname__: str async def __call__(self, ctx: Dict[Any, Any], *args: Any, **kwargs: Any) -\u0026gt; Any: # pragma: no cover pass Use cast to avoid typing errors redis_settings = cast(Optional[RedisSettings], cls_kwargs.get(\u0026#39;redis_settings\u0026#39;)) health_check_key = cast(Optional[str], cls_kwargs.get(\u0026#39;health_check_key\u0026#39;)) queue_name = cast(Optional[str], cls_kwargs.get(\u0026#39;queue_name\u0026#39;)) Keyword only arguments using * async def create_pool( settings_: RedisSettings = None, *, retry: int = 0, job_serializer: Optional[Serializer] = None, job_deserializer: Optional[Deserializer] = None, default_queue_name: str = default_queue_name, expires_extra_ms: int = expires_extra_ms, ) -\u0026gt; ArqRedis: ","permalink":"https://xiang.dev/posts/arq/","summary":"\u003cp\u003eQuick look at the repo for \u003ca href=\"https://github.com/samuelcolvin/arq/\"\u003earq\u003c/a\u003e by Samuel Colvin.\u003c/p\u003e","title":"👨‍🎓 arq source analysis"},{"content":" Note\nUsar post-its con fechas en tuppers. No lavar carne, solo secar con papel de cocina. Despensa:\nSal, Azúcar, MSG, Avecrem, Pimienta negra y blanca, Paprika Aceite de sésamo, salsa de soja, vinagre Vino de arroz, vinagre de arroz, vino blanco Almidón de patata, maicena Comino en polvo, laurel, tomillo Congelar https://youtu.be/XlndcLo3j7I Arroz con cosas https://www.youtube.com/shorts/kuahesSco-4?feature=share\nhttps://www.youtube.com/shorts/v2lj1bQQdas?feature=share\nGolden Curry + arroz\nDorar 1 cuenco de cebolla y carne (contramuslo pollo o ragut) Añadir agua, patatas y zanahorias, dejar 20 min, quitar espuma Medio paquete curry cortado 5 min Lao gan ma, huevo y arroz 📺\nHuevo frito, sobre arroz con salsa lao gan ma Escaldar col china 2 min en agua con sal y aceite, escurrir, añadir salsa de soja Arroz con cerdo y setas 📺\nLomo de cerdo en tacos, marinar con sal, azúcar, maicena, vino arroz, soja y aceite Shiitake sin tallo en tacos, escaldar 1 min, escurrir Jengibre y 3 dientes de ajo, apretar con cuchillo 3 Cebolleta, reservar blanco, picar verde Freir jengibre, ajo, y blanco de cebolleta, 15 segundos Añadir cerdo hasta que esté hecho, añadir vino y setas, 1 min Añadir salsa de soja, agua, salsa de ostras, azúcar, pimienta blanca, msg Espesar con maicena, añadir verde de cebolleta y aceite de sésamo Huevos con tomate 📺\nCortar tomate en rodajas, batir huevos con sal Saltear huevo, retirar, saltear tomate, ketchup, añadir agua, sal, azúcar Espesar con agua con almidon, aceite de sésamo, devolver huevo Añadir cebollino Sopas y cremas Sopa de maíz, pollo, huevo 📺\nFreir jengibre picado, añadir agua y pechuga, unos 5 min Añadir maiz, 3 min, añadir pechuga deshilachada, sal, azúcar, avecrem Almidon de patata con agua para espesar, añadir huevo poco a poco, torbellino Un poco de pimienta blanca, aceite de sésamo Sopa de huevo y tomate 📺\nTomate picado, freir en sarten un ratillo, sal y azúcar Añadir agua (y caldo), quitar espuma Salsa de soja, aceite sésamo, sal y pimienta blanca Espesar con almidon/maicena, añadir huevo y Cebollino Carnes Chistorra a la sidra\nTemplar chistorra, dorar chistorra en sarten 5 min sin aceite Añadir sidra, 15 min Gulas al ajillo\nTemplar Gulas frescas en un plato Dorar ajo a fuego suave, añadir guindillas Subir fuego, añadir gulas y remover sin que se frian, corregir sal Pollo guisado 📺 ⏳\nDorar muslos de pollo 3 min, retirar Añadir cebolla picada, pimiento rojo y verde, ajo picado, sal 5 min fuego suave, tomate pelado en tacos, 5 min más 1 vaso de vino blanco, 3 min más fuego fuerte, añadir pollo Cubrir con caldo, hoja de laurel, 45 min fuego medio Guiso de ternera y patata 📺 ⏳\nSalpimentar ternera, dorar, retirar Añadir cebolla picada, zanahoria tacos, ajo picado, sal y pimienta Fuego suave 10 min, vaso tomate triturado, tomillo, 10 min más Devolver ternera, integrar 1 min 1 vaso de vino tinto, 1 vaso de caldo, sal, pimienta 30 min, fuego suave, tapado, añadir patatas en cubos, 25 min más Pollo Kung Pao 📺\nLasaña de calabaza 📺\nFideos con mantequilla de cacahuete 📺\nPasta carbonara 📺\nJiangbao tofu 📺\nTODO\nVegetariano Broccoli con ajo 📺\njuntar sal, azulcar, maicena, agua, msg escaldar broccoli 20 seg, pasar agua fria para parar coccion ajo picado, jengibre picado, freir 15 seg, meter brocoli y salsa, 15 seg Espaguetis con huevo 📺\nLao gan ma? Pimientos asados 📺\nLentejas 📺\nShakshuka 📺\nMenemen 📺\nTODO\nExtra Patatas fritas al horno 📺\nhervir 8 min agua con sal y vinagre horno 200ºC, 15 min, vuelta, 15 min Cebolla rosa curada 📺\nCortar de polo a polo Añadir vinagre, medio sumergido Un poquito de sal, un par de cucharadillas de azúcar 2 días en la nevera antes de consumir / 2 semanas máximo Congelar carne 📺\nTODO\n","permalink":"https://xiang.dev/recetas/","summary":"\u003cscript\u003e\n    window.onload = function() {\n        var links = document.querySelectorAll(\"a\");\n        links = Array.from(links)\n        links = links.filter(a =\u003e a.text == \"📺\");\n        links.forEach(a =\u003e a.target = \"_blank\");\n    }\n\u003c/script\u003e\n\u003cstyle type=\"text/css\"\u003e.notice{--root-color:#444;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#c33;--warning-content:#fee;--info-title:#fb7;--info-content:#fec;--note-title:#6be;--note-content:#e7f2fa;--tip-title:#5a5;--tip-content:#efe}@media (prefers-color-scheme:dark){.notice{--root-color:#ddd;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#800;--warning-content:#400;--info-title:#a50;--info-content:#420;--note-title:#069;--note-content:#023;--tip-title:#363;--tip-content:#121}}body.dark .notice{--root-color:#ddd;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#800;--warning-content:#400;--info-title:#a50;--info-content:#420;--note-title:#069;--note-content:#023;--tip-title:#363;--tip-content:#121}.notice{padding:18px;line-height:24px;margin-bottom:24px;border-radius:4px;color:var(--root-color);background:var(--root-background)}.notice p:last-child{margin-bottom:0}.notice-title{margin:-18px -18px 12px;padding:4px 18px;border-radius:4px 4px 0 0;font-weight:700;color:var(--title-color);background:var(--title-background)}.notice.warning .notice-title{background:var(--warning-title)}.notice.warning{background:var(--warning-content)}.notice.info .notice-title{background:var(--info-title)}.notice.info{background:var(--info-content)}.notice.note .notice-title{background:var(--note-title)}.notice.note{background:var(--note-content)}.notice.tip .notice-title{background:var(--tip-title)}.notice.tip{background:var(--tip-content)}.icon-notice{display:inline-flex;align-self:center;margin-right:8px}.icon-notice img,.icon-notice svg{height:1em;width:1em;fill:currentColor}.icon-notice img,.icon-notice.baseline svg{top:.125em;position:relative}\u003c/style\u003e\n\u003cdiv\u003e\u003csvg width=\"0\" height=\"0\" display=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003csymbol id=\"tip-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"note-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"warning-notice\" viewBox=\"0 0 576 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"info-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z\"/\u003e\u003c/symbol\u003e\u003c/svg\u003e\u003c/div\u003e\u003cdiv class=\"notice note\" \u003e\n\u003cp class=\"first notice-title\"\u003e\u003cspan class=\"icon-notice baseline\"\u003e\u003csvg\u003e\u003cuse href=\"#note-notice\"\u003e\u003c/use\u003e\u003c/svg\u003e\u003c/span\u003eNote\u003c/p\u003e","title":"🍽️ Recetas"},{"content":"⬅️Back to Roadmap\n💼 Jobs / 🥋 Codewards\nBasics Web Frameworks ","permalink":"https://xiang.dev/java/","summary":"\u003cp\u003e\u003ca href=\"/roadmap\"\u003e⬅️Back to Roadmap\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://www.linkedin.com/jobs/search/?keywords=java\u0026amp;location=Spain\"\u003e💼 Jobs\u003c/a\u003e\n/\n\u003ca href=\"https://www.codewars.com/kata/search/java\"\u003e🥋 Codewards\u003c/a\u003e\u003c/p\u003e\n\u003ch2 id=\"basics\"\u003eBasics\u003c/h2\u003e\n\u003ch2 id=\"web-frameworks\"\u003eWeb Frameworks\u003c/h2\u003e","title":"☕ Java"},{"content":"⬅️Back to Roadmap\n💼 Jobs / 🥋 Codewards\nhttps://stateofjs.com/en-us/\nBasics Download NodeJS and Visual Studio Code.\n📝Handbook 📝TypeScript Deep Dive Web Frameworks Note\nSee notes about web\nExpress: Fastify: NestJS: ToolJet Novu Amplication Vendure ","permalink":"https://xiang.dev/typescript/","summary":"\u003cp\u003e\u003ca href=\"/roadmap\"\u003e⬅️Back to Roadmap\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://www.linkedin.com/jobs/search/?keywords=nodejs\u0026amp;location=Spain\"\u003e💼 Jobs\u003c/a\u003e\n/\n\u003ca href=\"https://www.codewars.com/kata/search/typescript\"\u003e🥋 Codewards\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://stateofjs.com/en-us/\"\u003ehttps://stateofjs.com/en-us/\u003c/a\u003e\u003c/p\u003e\n\u003ch2 id=\"basics\"\u003eBasics\u003c/h2\u003e\n\u003cp\u003eDownload \u003ca href=\"https://nodejs.org/en/\"\u003eNodeJS\u003c/a\u003e and \u003ca href=\"https://code.visualstudio.com/\"\u003eVisual Studio Code\u003c/a\u003e.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e📝\u003ca href=\"https://www.typescriptlang.org/docs/handbook/intro.html\"\u003eHandbook\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e📝\u003ca href=\"https://basarat.gitbook.io/typescript/\"\u003eTypeScript Deep Dive\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"web-frameworks\"\u003eWeb Frameworks\u003c/h2\u003e\n\u003cstyle type=\"text/css\"\u003e.notice{--root-color:#444;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#c33;--warning-content:#fee;--info-title:#fb7;--info-content:#fec;--note-title:#6be;--note-content:#e7f2fa;--tip-title:#5a5;--tip-content:#efe}@media (prefers-color-scheme:dark){.notice{--root-color:#ddd;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#800;--warning-content:#400;--info-title:#a50;--info-content:#420;--note-title:#069;--note-content:#023;--tip-title:#363;--tip-content:#121}}body.dark .notice{--root-color:#ddd;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#800;--warning-content:#400;--info-title:#a50;--info-content:#420;--note-title:#069;--note-content:#023;--tip-title:#363;--tip-content:#121}.notice{padding:18px;line-height:24px;margin-bottom:24px;border-radius:4px;color:var(--root-color);background:var(--root-background)}.notice p:last-child{margin-bottom:0}.notice-title{margin:-18px -18px 12px;padding:4px 18px;border-radius:4px 4px 0 0;font-weight:700;color:var(--title-color);background:var(--title-background)}.notice.warning .notice-title{background:var(--warning-title)}.notice.warning{background:var(--warning-content)}.notice.info .notice-title{background:var(--info-title)}.notice.info{background:var(--info-content)}.notice.note .notice-title{background:var(--note-title)}.notice.note{background:var(--note-content)}.notice.tip .notice-title{background:var(--tip-title)}.notice.tip{background:var(--tip-content)}.icon-notice{display:inline-flex;align-self:center;margin-right:8px}.icon-notice img,.icon-notice svg{height:1em;width:1em;fill:currentColor}.icon-notice img,.icon-notice.baseline svg{top:.125em;position:relative}\u003c/style\u003e\n\u003cdiv\u003e\u003csvg width=\"0\" height=\"0\" display=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003csymbol id=\"tip-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"note-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"warning-notice\" viewBox=\"0 0 576 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"info-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z\"/\u003e\u003c/symbol\u003e\u003c/svg\u003e\u003c/div\u003e\u003cdiv class=\"notice note\" \u003e\n\u003cp class=\"first notice-title\"\u003e\u003cspan class=\"icon-notice baseline\"\u003e\u003csvg\u003e\u003cuse href=\"#note-notice\"\u003e\u003c/use\u003e\u003c/svg\u003e\u003c/span\u003eNote\u003c/p\u003e","title":"🇹 TypeScript / NodeJS"},{"content":"⬅️Back to Roadmap\n💼 Jobs / 🥋 Codewards\nBasics Use Google Colab to learn the basic syntax and concepts.\nDownload Python and Visual Studio Code with the Python extension to start writing single file scripts.\n📚Introducing Python (2019): Ignore everything after chapter 11 📝Basic OOP 🎨Skim through pep8 ⚡️Learn a bit of DSA (Data Structures and Algorithms): do easy in neetcode Note\nProject ideas:\nMake a discord bot with discord.py Program a simple game with PyGame such as Snake Deploy a simple FastAPI website in Deta (maybe a TODO list) Advanced Switch to PyCharm once you are familiar with the syntax and concepts such as virtualenvs, git, etc.\n📚Read: Fluent Python (2022): magic methods, dataclasses, Advanced typing, decorators Architecture Patterns with Python (2020): DDD, CQRS, Event-Driver Architecture, etc. Robust Python (2022): typing, etc. Google Style Guide: don\u0026rsquo;t have to follow it, interesting to see how it evolves 📺Watch: sort by popular ArjanCodes: Advanced, refactoring videos are great. mCoding: Trivia. 🧰Learn about Design Patterns in python but don\u0026rsquo;t go too crazy. 📝StackOverflow Questions: should know the answers to the most voted questions. Info\nUse venv and pip-tools for managing virtual environments and dependencies.\nUse hatchling to package libraries.\n⚡️Concurrency with superfast python: Why Learn Python Concurrency How to Choose the Right Concurrency API 🧪Learn about testing / Property-based testing 🔄Task queues: Celery / arq 🔧CI Tools: MyPy, Black, ruff, pip-audit, bandit 👀Checkout some Open Source projects, better if you have used them before: requests and httpx: probably familiar with them arq: small modern project, take a good look at every file Tip\nKeep an eye on:\nLatest Python features: read summaries Reddit: Check top posts by year or month Top libraries: by year Web Frameworks Note\nSee notes about web\nDeploy using https://deta.space/ or https://www.pythonanywhere.com/\nDjango: tutorial / Views readthedocs: documentation hosting sentry: monitoring platform old mdn: kuma, old MDN guya.moe: manga reading website Flask: tutorial SimpleLogin Apache Airflow redash.io sourcehut FastAPI: tutorial TermPair Dispatch Mealie Opal ","permalink":"https://xiang.dev/python/","summary":"\u003cp\u003e\u003ca href=\"/roadmap\"\u003e⬅️Back to Roadmap\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://www.linkedin.com/jobs/search/?keywords=python\u0026amp;location=Spain\"\u003e💼 Jobs\u003c/a\u003e\n/\n\u003ca href=\"https://www.codewars.com/kata/search/python\"\u003e🥋 Codewards\u003c/a\u003e\u003c/p\u003e\n\u003ch2 id=\"basics\"\u003eBasics\u003c/h2\u003e\n\u003cp\u003eUse \u003ca href=\"https://colab.research.google.com/\"\u003eGoogle Colab\u003c/a\u003e to learn the basic syntax and concepts.\u003c/p\u003e\n\u003cp\u003eDownload \u003ca href=\"https://www.python.org/downloads/\"\u003ePython\u003c/a\u003e and \u003ca href=\"https://code.visualstudio.com/\"\u003eVisual Studio Code\u003c/a\u003e with the Python extension to\nstart writing \u003cstrong\u003esingle file scripts\u003c/strong\u003e.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e📚\u003ca href=\"https://www.oreilly.com/library/view/introducing-python-2nd/9781492051374/\"\u003eIntroducing Python (2019)\u003c/a\u003e: Ignore everything after chapter 11\u003c/li\u003e\n\u003cli\u003e📝\u003ca href=\"https://realpython.com/python3-object-oriented-programming/\"\u003eBasic OOP\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e🎨Skim through \u003ca href=\"https://peps.python.org/pep-0008/\"\u003epep8\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e⚡️Learn a bit of DSA (Data Structures and Algorithms): do \u003cstrong\u003eeasy\u003c/strong\u003e in \u003ca href=\"https://neetcode.io/roadmap\"\u003eneetcode\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cstyle type=\"text/css\"\u003e.notice{--root-color:#444;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#c33;--warning-content:#fee;--info-title:#fb7;--info-content:#fec;--note-title:#6be;--note-content:#e7f2fa;--tip-title:#5a5;--tip-content:#efe}@media (prefers-color-scheme:dark){.notice{--root-color:#ddd;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#800;--warning-content:#400;--info-title:#a50;--info-content:#420;--note-title:#069;--note-content:#023;--tip-title:#363;--tip-content:#121}}body.dark .notice{--root-color:#ddd;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#800;--warning-content:#400;--info-title:#a50;--info-content:#420;--note-title:#069;--note-content:#023;--tip-title:#363;--tip-content:#121}.notice{padding:18px;line-height:24px;margin-bottom:24px;border-radius:4px;color:var(--root-color);background:var(--root-background)}.notice p:last-child{margin-bottom:0}.notice-title{margin:-18px -18px 12px;padding:4px 18px;border-radius:4px 4px 0 0;font-weight:700;color:var(--title-color);background:var(--title-background)}.notice.warning .notice-title{background:var(--warning-title)}.notice.warning{background:var(--warning-content)}.notice.info .notice-title{background:var(--info-title)}.notice.info{background:var(--info-content)}.notice.note .notice-title{background:var(--note-title)}.notice.note{background:var(--note-content)}.notice.tip .notice-title{background:var(--tip-title)}.notice.tip{background:var(--tip-content)}.icon-notice{display:inline-flex;align-self:center;margin-right:8px}.icon-notice img,.icon-notice svg{height:1em;width:1em;fill:currentColor}.icon-notice img,.icon-notice.baseline svg{top:.125em;position:relative}\u003c/style\u003e\n\u003cdiv\u003e\u003csvg width=\"0\" height=\"0\" display=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003csymbol id=\"tip-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"note-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"warning-notice\" viewBox=\"0 0 576 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"info-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z\"/\u003e\u003c/symbol\u003e\u003c/svg\u003e\u003c/div\u003e\u003cdiv class=\"notice note\" \u003e\n\u003cp class=\"first notice-title\"\u003e\u003cspan class=\"icon-notice baseline\"\u003e\u003csvg\u003e\u003cuse href=\"#note-notice\"\u003e\u003c/use\u003e\u003c/svg\u003e\u003c/span\u003eNote\u003c/p\u003e","title":"🐍 Python"},{"content":"⬅️Back to Roadmap\n💼 Jobs / 🥋 Codewards\nBasics 📚Learn Go with Tests 🌐Tour 📚Learning Go 📚Go by Example 📚Effective Go: a bit dated, 2009 Advanced 📺Rethinking Classical Concurrency Patterns 📚Let\u0026rsquo;s Go: Working app with templating, stateful sessions, raw SQL, etc 📚Let\u0026rsquo;s Go Further: Modern JSON REST API Web Frameworks Benchmarks: https://www.techempower.com/benchmarks/ https://github.com/mingrammer/go-web-framework-stars ","permalink":"https://xiang.dev/go/","summary":"\u003cp\u003e\u003ca href=\"/roadmap\"\u003e⬅️Back to Roadmap\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://www.linkedin.com/jobs/search/?keywords=Golang\u0026amp;location=Spain\"\u003e💼 Jobs\u003c/a\u003e\n/\n\u003ca href=\"https://www.codewars.com/kata/search/go?q=\u0026amp;order_by=popularity%20desc\"\u003e🥋 Codewards\u003c/a\u003e\u003c/p\u003e\n\u003ch2 id=\"basics\"\u003eBasics\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e📚\u003ca href=\"https://quii.gitbook.io/learn-go-with-tests/\"\u003e\u003cstrong\u003eLearn Go with Tests\u003c/strong\u003e\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e🌐\u003ca href=\"https://go.dev/tour/welcome/1\"\u003eTour\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e📚\u003ca href=\"https://www.oreilly.com/library/view/learning-go/9781492077206/\"\u003eLearning Go\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e📚\u003ca href=\"https://gobyexample.com/\"\u003eGo by Example\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e📚\u003ca href=\"https://go.dev/doc/effective_go\"\u003eEffective Go\u003c/a\u003e: a bit dated, 2009\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"advanced\"\u003eAdvanced\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e📺\u003ca href=\"https://youtu.be/5zXAHh5tJqQ\"\u003eRethinking Classical Concurrency Patterns\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e📚\u003ca href=\"https://lets-go.alexedwards.net/\"\u003eLet\u0026rsquo;s Go\u003c/a\u003e: Working app with templating, stateful sessions, raw SQL, etc\u003c/li\u003e\n\u003cli\u003e📚\u003ca href=\"https://lets-go-further.alexedwards.net/\"\u003eLet\u0026rsquo;s Go Further\u003c/a\u003e: Modern JSON REST API\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"web-frameworks\"\u003eWeb Frameworks\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eBenchmarks: \u003ca href=\"https://www.techempower.com/benchmarks/\"\u003ehttps://www.techempower.com/benchmarks/\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/mingrammer/go-web-framework-stars\"\u003ehttps://github.com/mingrammer/go-web-framework-stars\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e","title":"🐿️ Go"},{"content":"⬅️Back to Roadmap\n💼 Jobs / 🥋 Codewards\nBasics Web Frameworks Note\nSee notes about web\nActix: tutorial for beginners miniserve mdn: superseeds kuma axum roapi restful template realworld ","permalink":"https://xiang.dev/rust/","summary":"\u003cp\u003e\u003ca href=\"/roadmap\"\u003e⬅️Back to Roadmap\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://www.linkedin.com/jobs/search/?keywords=rust\u0026amp;location=Spain\"\u003e💼 Jobs\u003c/a\u003e\n/\n\u003ca href=\"https://www.codewars.com/kata/search/rust\"\u003e🥋 Codewards\u003c/a\u003e\u003c/p\u003e\n\u003ch2 id=\"basics\"\u003eBasics\u003c/h2\u003e\n\u003ch2 id=\"web-frameworks\"\u003eWeb Frameworks\u003c/h2\u003e\n\u003cstyle type=\"text/css\"\u003e.notice{--root-color:#444;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#c33;--warning-content:#fee;--info-title:#fb7;--info-content:#fec;--note-title:#6be;--note-content:#e7f2fa;--tip-title:#5a5;--tip-content:#efe}@media (prefers-color-scheme:dark){.notice{--root-color:#ddd;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#800;--warning-content:#400;--info-title:#a50;--info-content:#420;--note-title:#069;--note-content:#023;--tip-title:#363;--tip-content:#121}}body.dark .notice{--root-color:#ddd;--root-background:#eff;--title-color:#fff;--title-background:#7bd;--warning-title:#800;--warning-content:#400;--info-title:#a50;--info-content:#420;--note-title:#069;--note-content:#023;--tip-title:#363;--tip-content:#121}.notice{padding:18px;line-height:24px;margin-bottom:24px;border-radius:4px;color:var(--root-color);background:var(--root-background)}.notice p:last-child{margin-bottom:0}.notice-title{margin:-18px -18px 12px;padding:4px 18px;border-radius:4px 4px 0 0;font-weight:700;color:var(--title-color);background:var(--title-background)}.notice.warning .notice-title{background:var(--warning-title)}.notice.warning{background:var(--warning-content)}.notice.info .notice-title{background:var(--info-title)}.notice.info{background:var(--info-content)}.notice.note .notice-title{background:var(--note-title)}.notice.note{background:var(--note-content)}.notice.tip .notice-title{background:var(--tip-title)}.notice.tip{background:var(--tip-content)}.icon-notice{display:inline-flex;align-self:center;margin-right:8px}.icon-notice img,.icon-notice svg{height:1em;width:1em;fill:currentColor}.icon-notice img,.icon-notice.baseline svg{top:.125em;position:relative}\u003c/style\u003e\n\u003cdiv\u003e\u003csvg width=\"0\" height=\"0\" display=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003csymbol id=\"tip-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"note-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"warning-notice\" viewBox=\"0 0 576 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z\"/\u003e\u003c/symbol\u003e\u003csymbol id=\"info-notice\" viewBox=\"0 0 512 512\" preserveAspectRatio=\"xMidYMid meet\"\u003e\u003cpath d=\"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z\"/\u003e\u003c/symbol\u003e\u003c/svg\u003e\u003c/div\u003e\u003cdiv class=\"notice note\" \u003e\n\u003cp class=\"first notice-title\"\u003e\u003cspan class=\"icon-notice baseline\"\u003e\u003csvg\u003e\u003cuse href=\"#note-notice\"\u003e\u003c/use\u003e\u003c/svg\u003e\u003c/span\u003eNote\u003c/p\u003e","title":"🦀 Rust"},{"content":"Some notes about microservices\nReference Building Microservices Microservices Indendently releasable/deployable services (loosely coupled, stable contracts). Modeled around a business domain (end-to-end slices of business functionality). Implementation details are hidden (owning their own state, no sharing of databases, different technologies/try new things, etc). Tip\nThey allow developers to work independently, reducing delivery contention. (Technology Heterogeneity, Robustness, Scaling, Ease of Deployment, Organizational Alignment, Composability, etc)\nInfo\nThey are not a great idea if the product is brand new or the domain is undergoing significant change. Also, if the team is small, the time spent on deployment and management might not be worth it. (Developer Experience, Deployment Overhead, Cost, Reporting, Monitoring, Security, Testing, Latency, Data Consistency, etc)\nMonoliths A valid default choice, doesn\u0026rsquo;t mean legacy.\nSingle-process monoliths: most common, single process that talks to a database (monolithic Django, Rails, etc). Modular monoliths: single process with separate modules that can be worked on independently (shopify). Distributed monolith: multiple services that must be deployed together (disadvages of distributed systems and single-process monoliths, not enough focus on information hiding and cohesion of business functionality). Microservice Boundary Information Hiding: improve development time by allowing more things to be worked on in parallel, allow each module to be understood in isolation and allow modules to be changed independently. The important thing is to form good boundaries between modules. Cohesion The code that changes together, stays together.\nWe want the functionality grouped in a way that we have to make changes in as few places as possible. Avoiding the need to deploy multiple services at the same time.\nCoupling A structure is stable if cohesion is strong and coupling is low.\nSome coupling is inevitable, but we want to minimize it. A loosely coupled service knows as little as it needs to about the other services. Limiting the number of different types of calls is also important, chatty communication is a sign of tight coupling.\nDomain Coupling: Largely unavoidable, occurs when one microservice needs a functionality that the other provides. If a microservice needs to talk to a lot of other microservices it might be doing too much. Also, remember to send only the absolute minimum amount of data needed. Temporal Coupling: One microservice needs another to do something at the same time (synchronous HTTP call), it isn\u0026rsquo;t inherently bad, but with more microservices it can cause issues if you want to scale. Pass-Through Coupling: one microservice passes data to another microservice because it is needed by some other downstream microservice. There are some ways to improve this: bypass the intermediary, make the intermediary take in data in its contract and delegate the formatting to it or make the intermediary treat the needed data as an opaque blob. Common Coupling: two o more microservices use a common set of data (shared database, shared memory or filesystem), changing the structure of the data can impact multiple services. This can be a big problem if the structure of the common data changes frequently / multiple microservices are reading and writing. Who should be responsible of managing the correct lifecycle of the data, do we make a thin CRUD wrapper and reduce cohesion? Content Coupling: similar to common coupling but there is no clear knowledge about ownership of the data (eg: one microserve makes changes to a database bypassing the actual service that exposes the data). DDD Important concepts for building microservices:\nUbiquitous Language: the same language is used by all the stakeholders (developers, business, etc). Aggregates: a group of objects that are treated as a unit for the purpose of data changes, typically have a life cycle around them / state machine. Bounded Context: organizational boundary, internal concerns should be hidden, make use of hidden models and shared models of associated aggregates. Mapping Aggregates and Bounded Contexts to Microservices: you can always star with a coarser-grained API and split into more microservices if needed (implementation detail). Event Storming: a technique for building a domain model with both technical and nontechnical stakeholders. Alternatives:\nVolatility: extract parts that go through a lot of changes (eg: bimodal IT, Mode 1 and Mode 2), not very recommended. Data: driven by privacy and security concerns, to reduce risk of data breaches and simplify oversight. Technology: this isn\u0026rsquo;t really a general means of decomposition. Organizational: driven by the organizational structure of the company, prefer end-to-end vertical slice instead of a horizontal slice. Splitting the Monolith Microservices are not the goal just a means to an end. Incremental migration, identify quick wins, avoid premature decomposition. Balance difficulty with benefits. Patterns: Strangler Fig: wrap an old system with the new system gradually. Parallel Run: run both and compare. Feature Toggle: feature flags. Data Decomposition: Performance: joins? Integrity: cascading? Transactions: distributed transactions, sagas? Reporting database for external reading. Communication styles TODO\n","permalink":"https://xiang.dev/posts/microservices/","summary":"\u003cp\u003eSome notes about microservices\u003c/p\u003e","title":"📝 Microservices notes"},{"content":"Some notes about DDD\nReferences Awesome Domain-Driven Design Cosmic Python Domain-Driven Design Implementing Domain-Driven Design Domain Use @dataclass(frozen=True) for value objects For entities (objects with long lived identity, aka Reference Objects) use a normal class and implement __eq__ and __hash__ Don\u0026rsquo;t use FooBuilder, BarManager classes, just functions Repository Use Protocol instead of abc. Leave .commit() as a responsibility for the caller. For simple cases this abstraction is unnecessary, you can just stick with ORMs. Create an in-memory FakeRepository for testing. Info\nSome people consider \u0026ldquo;monkeypatching\u0026rdquo; a code smell and prefer using Fakes.\nService Pass the repository as a parameter to service-layer functions and use primitives instead of Domain objects. Leave endpoints as a thin wrapper for parsing and returning HTTP responses, but you can combine controller/views if it is just a web app. Write tests for the service layer. Unit of Work Use context manager and initialize the repository on __enter__. Explicit commit is recommended for easier state flushing. Add uow to the service layer. Aggregates and Consistency Boundaries An AGGREGATE is a cluster of associated objects that we treat as a unit for the purpose of data changes.\nConfigure version counters for Optimistic Concurrency Control. Retry on conflict. The only repository that should be used is the one for the aggregate. Part 1: https://github.com/cosmicpython/code/tree/chapter_07_aggregate\nEvents and Message Bus To avoid violating the single responsibility principle, use events instead of commands. A message bus is a dict that maps event types to a list of handlers. Rethink API calls as capturing events. Services will have only 2 params: the event and the uow. Commands If at first you don’t succeed, retry the operation with an exponentially increasing back-off period.\nCommands are usually imperative verbs and expect a response. Events are usually past-tense verbs and broadcasted. Event-Driven Architecture Use an external message broker (redis, kafka, rabbitmq). Two services should accept eventual consistency between them. Avoid the Distributed Big Ball of Mud, think in terms of verbs / business processes with asynchronous communication. https://martinfowler.com/articles/201701-event-driven.html\nCommand-Query Responsibility Separation (CQRS) Create thin views for our data: via raw SQL?? (repository are clunky and ORMs slow). Dependency Injection (DI) Dependency Injection vs Monkeypatching. Part 2: https://github.com/cosmicpython/code\n","permalink":"https://xiang.dev/posts/ddd/","summary":"\u003cp\u003eSome notes about DDD\u003c/p\u003e","title":"📝 Domain Driven Design notes"},{"content":"Some notes about design patterns\nInfo\nDo NOT use design patterns just because you can.\nUse them when they make sense, they should emerge naturally from the problem.\nIn some languages, they might be considered anti-patterns.\nReferences https://python-patterns.guide/ https://refactoring.guru/design-patterns/catalog https://www.oreilly.com/library/view/head-first-design/9781492077992/ https://github.com/faif/python-patterns Behavioral ⭐Strategy Pattern Define a family of algorithms, encapsulate each one, and make them interchangeable.\nEnables algorithm at runtime, hide implementation details, easy to add new strategies.\nExample from typing import Protocol class Order: def __init__( self, price: float, discount_strategy: \u0026#34;DiscountStrategy\u0026#34; = None, ): self.price = price self.discount_strategy = discount_strategy def apply_discount(self) -\u0026gt; float: if self.discount_strategy: discount = self.discount_strategy(self) else: discount = 0 return self.price - discount class DiscountStrategy(Protocol): def __call__(self, order: Order) -\u0026gt; float: ... def ten_percent_discount(order: Order) -\u0026gt; float: return order.price * 0.1 def on_sale_discount(order: Order) -\u0026gt; float: return order.price * 0.25 + 20 if __name__ == \u0026#34;__main__\u0026#34;: order = Order(100, discount_strategy=ten_percent_discount) print(order.apply_discount()) order = Order(100, discount_strategy=on_sale_discount) print(order.apply_discount()) ⭐Observer Pattern Maintains a list of dependents and notifies them of any state changes.\nDjango signals / Flask signals\nExample class Observer(Protocol): def update(self, subject: \u0026#34;Subject\u0026#34;) -\u0026gt; None: ... class Subject: def __init__(self) -\u0026gt; None: self._observers: list[Observer] = [] def attach(self, observer: Observer) -\u0026gt; None: if observer not in self._observers: self._observers.append(observer) def detach(self, observer: Observer) -\u0026gt; None: with suppress(ValueError): self._observers.remove(observer) def notify(self, modifier: Observer | None = None) -\u0026gt; None: for observer in self._observers: if modifier != observer: observer.update(self) class Data(Subject): def __init__(self, name: str = \u0026#34;\u0026#34;) -\u0026gt; None: super().__init__() self.name = name self._data = 0 @property def data(self) -\u0026gt; int: return self._data @data.setter def data(self, value: int) -\u0026gt; None: self._data = value self.notify() class HexViewer: def update(self, subject: Data) -\u0026gt; None: print(f\u0026#34;HexViewer: Subject {subject.name} has data 0x{subject.data:x}\u0026#34;) class DecimalViewer: def update(self, subject: Data) -\u0026gt; None: print(f\u0026#34;DecimalViewer: Subject {subject.name} has data {subject.data}\u0026#34;) if __name__ == \u0026#34;__main__\u0026#34;: data1 = Data(\u0026#34;Data 1\u0026#34;) view1 = DecimalViewer() view2 = HexViewer() data1.attach(view1) data1.attach(view2) data1.data = 10 ⭐Command Pattern Object oriented implementation of callback functions.\nExample from typing import Protocol class HideFileCommand: def __init__(self) -\u0026gt; None: self._hidden_files: list[str] = [] def execute(self, filename: str) -\u0026gt; None: print(f\u0026#34;hiding {filename}\u0026#34;) self._hidden_files.append(filename) def undo(self) -\u0026gt; None: filename = self._hidden_files.pop() print(f\u0026#34;un-hiding {filename}\u0026#34;) class DeleteFileCommand: def __init__(self) -\u0026gt; None: self._deleted_files: list[str] = [] def execute(self, filename: str) -\u0026gt; None: print(f\u0026#34;deleting {filename}\u0026#34;) self._deleted_files.append(filename) def undo(self) -\u0026gt; None: filename = self._deleted_files.pop() print(f\u0026#34;restoring {filename}\u0026#34;) class Command(Protocol): def execute(self, filename: str) -\u0026gt; None: ... def undo(self) -\u0026gt; None: ... class MenuItem: def __init__(self, command: Command) -\u0026gt; None: self._command = command def on_do_press(self, filename: str) -\u0026gt; None: self._command.execute(filename) def on_undo_press(self) -\u0026gt; None: self._command.undo() if __name__ == \u0026#34;__main__\u0026#34;: item1 = MenuItem(DeleteFileCommand()) item2 = MenuItem(HideFileCommand()) test_file_name = \u0026#34;test-file\u0026#34; item1.on_do_press(test_file_name) item1.on_undo_press() item2.on_do_press(test_file_name) item2.on_undo_press() ⭐Iterator Pattern Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.\nExample def count_to(count: int): \u0026#34;\u0026#34;\u0026#34;Counts by word numbers, up to a maximum of five\u0026#34;\u0026#34;\u0026#34; numbers = [\u0026#34;one\u0026#34;, \u0026#34;two\u0026#34;, \u0026#34;three\u0026#34;, \u0026#34;four\u0026#34;, \u0026#34;five\u0026#34;] yield from numbers[:count] def count_to_five() -\u0026gt; None: return count_to(5) for number in count_to_five(): print(number) Template Method Pattern Skeleton of a base algorithm, definition of exact steps in subclasses.\nDjango Class Based Views\nExample def template_function(getter, converter=None, to_save=False) -\u0026gt; None: data = getter() print(f\u0026#34;Got `{data}`\u0026#34;) if len(data) \u0026lt;= 3 and converter: data = converter(data) else: print(\u0026#34;Skip conversion\u0026#34;) if to_save: saver() print(f\u0026#34;`{data}` was processed\u0026#34;) State Pattern Lets an object alter its behavior when its internal state changes.\nExample class State: def scan(self) -\u0026gt; None: self.pos += 1 if self.pos == len(self.stations): self.pos = 0 print(f\u0026#34;Scanning... Station is {self.stations[self.pos]} {self.name}\u0026#34;) class AmState(State): def __init__(self, radio: Radio) -\u0026gt; None: self.radio = radio self.stations = [\u0026#34;1250\u0026#34;, \u0026#34;1380\u0026#34;, \u0026#34;1510\u0026#34;] self.pos = 0 self.name = \u0026#34;AM\u0026#34; def toggle_amfm(self) -\u0026gt; None: print(\u0026#34;Switching to FM\u0026#34;) self.radio.state = self.radio.fmstate class FmState(State): def __init__(self, radio: Radio) -\u0026gt; None: self.radio = radio self.stations = [\u0026#34;81.3\u0026#34;, \u0026#34;89.1\u0026#34;, \u0026#34;103.9\u0026#34;] self.pos = 0 self.name = \u0026#34;FM\u0026#34; def toggle_amfm(self) -\u0026gt; None: print(\u0026#34;Switching to AM\u0026#34;) self.radio.state = self.radio.amstate class Radio: def __init__(self) -\u0026gt; None: \u0026#34;\u0026#34;\u0026#34;We have an AM state and an FM state\u0026#34;\u0026#34;\u0026#34; self.amstate = AmState(self) self.fmstate = FmState(self) self.state = self.amstate def toggle_amfm(self) -\u0026gt; None: self.state.toggle_amfm() def scan(self) -\u0026gt; None: self.state.scan() Chain of Responsibility Pattern Allow a request to pass down a chain of receivers until it is handled. Faif Mediator Pattern Encapsulates how a set of objects interact. Faif Memento Pattern Provides the ability to restore an object to its previous state. Faif Visitor Pattern Separates an algorithm from an object structure on which it operates. Faif Structural ⭐Adapter Pattern Allows the interface of an existing class to be used as another interface.\nExample T = TypeVar(\u0026#34;T\u0026#34;) class Adapter: def __init__(self, obj: T, **adapted_methods: Callable): \u0026#34;\u0026#34;\u0026#34;We set the adapted methods in the object\u0026#39;s dict.\u0026#34;\u0026#34;\u0026#34; self.obj = obj self.__dict__.update(adapted_methods) def __getattr__(self, attr): \u0026#34;\u0026#34;\u0026#34;All non-adapted calls are passed to the object.\u0026#34;\u0026#34;\u0026#34; return getattr(self.obj, attr) def original_dict(self): \u0026#34;\u0026#34;\u0026#34;Print original object dict.\u0026#34;\u0026#34;\u0026#34; return self.obj.__dict__ cat = Cat() objects.append(Adapter(cat, make_noise=cat.meow)) human = Human() objects.append(Adapter(human, make_noise=human.speak)) car = Car() objects.append(Adapter(car, make_noise=lambda: car.make_noise(3))) for obj in objects: print(\u0026#34;A {0} goes {1}\u0026#34;.format(obj.name, obj.make_noise())) ⭐Model-View-Controller Pattern Separates data in GUIs from the ways it is presented, and accepted. Decorator Pattern Adds behaviour to object without affecting its class. Faif Facade Pattern Provides a simpler unified interface to a complex system. Faif Composite Pattern Describes a group of objects that is treated as a single instance. Faif Proxy Pattern Add functionality or logic to a resource without changing its interface. Faif Bridge Pattern Decouples an abstraction from its implementation. Faif Flyweight Pattern Minimizes memory usage by sharing data with other similar objects. Faif Creational ⭐Factory Pattern Object for creating other objects without having to specify the exact class.\nExample (Real Python) class SongSerializer: def serialize(self, song, format): serializer = get_serializer(format) return serializer(song) def get_serializer(format): if format == \u0026#39;JSON\u0026#39;: return _serialize_to_json elif format == \u0026#39;XML\u0026#39;: return _serialize_to_xml else: raise ValueError(format) def _serialize_to_json(song): payload = { \u0026#39;id\u0026#39;: song.song_id, \u0026#39;title\u0026#39;: song.title, \u0026#39;artist\u0026#39;: song.artist } return json.dumps(payload) def _serialize_to_xml(song): song_element = et.Element(\u0026#39;song\u0026#39;, attrib={\u0026#39;id\u0026#39;: song.song_id}) title = et.SubElement(song_element, \u0026#39;title\u0026#39;) title.text = song.title artist = et.SubElement(song_element, \u0026#39;artist\u0026#39;) artist.text = song.artist return et.tostring(song_element, encoding=\u0026#39;unicode\u0026#39;) Example (Faif) class GreekLocalizer: def __init__(self) -\u0026gt; None: self.translations = {\u0026#34;dog\u0026#34;: \u0026#34;σκύλος\u0026#34;, \u0026#34;cat\u0026#34;: \u0026#34;γάτα\u0026#34;} def localize(self, msg: str) -\u0026gt; str: return self.translations.get(msg, msg) class EnglishLocalizer: def localize(self, msg: str) -\u0026gt; str: return msg def get_localizer(language: str = \u0026#34;English\u0026#34;) -\u0026gt; object: localizers = { \u0026#34;English\u0026#34;: EnglishLocalizer, \u0026#34;Greek\u0026#34;: GreekLocalizer, } return localizers[language]() e, g = get_localizer(language=\u0026#34;English\u0026#34;), get_localizer(language=\u0026#34;Greek\u0026#34;) for msg in [\u0026#34;dog\u0026#34;, \u0026#34;parrot\u0026#34;, \u0026#34;cat\u0026#34;, \u0026#34;bear\u0026#34;]: print(e.localize(msg), g.localize(msg)) ⭐Abstract Factory Pattern Provides a way to encapsulate a group of individual factories.\nExample class PetShop: def __init__(self, animal_factory: Type[Pet]) -\u0026gt; None: self.pet_factory = animal_factory def buy_pet(self, name: str) -\u0026gt; Pet: pet = self.pet_factory(name) print(f\u0026#34;Here is your lovely {pet}\u0026#34;) return pet # Create a random animal def random_animal(name: str) -\u0026gt; Pet: \u0026#34;\u0026#34;\u0026#34;Let\u0026#39;s be dynamic!\u0026#34;\u0026#34;\u0026#34; return random.choice([Dog, Cat])(name) cat_shop = PetShop(Cat) pet = cat_shop.buy_pet(\u0026#34;Lucy\u0026#34;) shop = PetShop(random_animal) pet = shop.buy_pet(\u0026#34;Max\u0026#34;) ⭐Builder Pattern Decouples the creation of a complex object and its representation.\nExample class Building: def __init__(self) -\u0026gt; None: self.build_floor() self.build_size() def build_floor(self): raise NotImplementedError def build_size(self): raise NotImplementedError # Concrete Buildings class House(Building): def build_floor(self) -\u0026gt; None: self.floor = \u0026#34;One\u0026#34; def build_size(self) -\u0026gt; None: self.size = \u0026#34;Big\u0026#34; class Flat(Building): def build_floor(self) -\u0026gt; None: self.floor = \u0026#34;More than One\u0026#34; def build_size(self) -\u0026gt; None: self.size = \u0026#34;Small\u0026#34; Singleton Pattern Ensure a class only has one instance, and provide a global point of access to it. Prefer Global Object Pattern in python Prototype Pattern Creates new object instances by cloning prototype. Faif ","permalink":"https://xiang.dev/posts/patterns/","summary":"\u003cp\u003eSome notes about design patterns\u003c/p\u003e","title":"📝 Design Patterns notes"},{"content":"Overview of the CP-SAT solver from Google OR-Tools\nReferences: Awesome OR-Tools: https://github.com/or-tools/awesome_or-tools#algorithms Laurent Perron and Frédéric Didier, CPAIOR 2020: https://youtu.be/lmy1ddn4cyw Peter J. Stuckey, Search is Dead: https://people.eng.unimelb.edu.au/pstuckey/PPDP2013.pdf Dominik Krupke, CP-SAT primer: https://github.com/d-krupke/cpsat-primer Model Building The first step is building the model using the CPModel class. This class is actually a wrapper around the cp_model protobuf.\nLet\u0026rsquo;s see an example (source):\nfrom ortools.sat.python import cp_model \u0026#34;\u0026#34;\u0026#34;Minimal CP-SAT example to showcase calling the solver.\u0026#34;\u0026#34;\u0026#34; # Creates the model. # [START model] model = cp_model.CpModel() # [END model] # Creates the variables. # [START variables] num_vals = 3 x = model.NewIntVar(0, num_vals - 1, \u0026#39;x\u0026#39;) y = model.NewIntVar(0, num_vals - 1, \u0026#39;y\u0026#39;) z = model.NewIntVar(0, num_vals - 1, \u0026#39;z\u0026#39;) # [END variables] # Creates the constraints. # [START constraints] model.Add(x != y) # [END constraints] # Creates a solver and solves the model. # [START solve] solver = cp_model.CpSolver() status = solver.Solve(model) # [END solve] if status == cp_model.FEASIBLE: print(\u0026#39;x = %i\u0026#39; % solver.Value(x)) print(\u0026#39;y = %i\u0026#39; % solver.Value(y)) print(\u0026#39;z = %i\u0026#39; % solver.Value(z)) This model creates the following proto print(str(model)):\nvariables { name: \u0026#34;x\u0026#34; domain: 0 domain: 2 } variables { name: \u0026#34;y\u0026#34; domain: 0 domain: 2 } variables { name: \u0026#34;z\u0026#34; domain: 0 domain: 2 } constraints { linear { vars: 1 vars: 0 coeffs: -1 coeffs: 1 domain: -9223372036854775808 domain: -1 domain: 1 domain: 9223372036854775807 } } Note: int64 is [-9223372036854775808, 9223372036854775807]\nPresolve Loop First stage: We will process all active constraints until a fix point is reached. During this stage:\nVariable will never be deleted, but their domain will be reduced. Constraint will never be deleted (they will be marked as empty if needed). New variables and new constraints can be added after the existing ones. Constraints are added only when needed to the mapping_problem if they are needed during the postsolve. Second stage:\nAll the variables domain will be copied to the mapping_model. Everything will be remapped so that only the variables appearing in some constraints will be kept and their index will be in [0, num_new_variables). - source Presolve: Domain reduction, constraint simplification/rewrite Constraint expansion/decomposition: Similar to Minizinc -\u0026gt; Flatzinc (element constraint, table, automaton, inverse, product, modulo, reservoir) Detect variable equivalence and affine relations. Substitute by canonical representation. Probing: Fix variables and see what is propagated. This produces 2 new models, the inner model that will be solved and a channeling model used to populate the solution of the initial model. - source\nSolver The CP-SAT solver uses a lazy clause generation solver on top of an SAT solver. The best description is a presentation from Peter Stuckey called Search is Dead - Laurent Perron\nIn Lazy clause generation (LCG), integer variables are encoded as booleans, ortools creates 2 booleans for each variable and value:\nvar == value var \u0026lt;= value Note: var \u0026gt;= value (represented as ![x \u0026lt;= value-1])\n(var == value) \u0026lt;=\u0026gt; (var \u0026gt;= value) and (var \u0026lt;= value) (var \u0026lt;= value) =\u0026gt; (var \u0026lt;= value+1) Propagation is clause generation:\ne.g. [x \u0026lt;= 2] and x \u0026gt;= y means that [y \u0026lt;= 2] clause [x \u0026lt;= 2] =\u0026gt; [y \u0026lt;= 2] Linear relaxation TODO\nDefault search (single thread) VSIDS on the Boolean problem, when it reaches a fixed point, it asks the heuristic to select an integer variable, a value and a braching direction.\nMultithreading The solver uses the first X threads to generic methods, and use all the remaining ones on LNS (Large Neighborhood Search). -Laurent Perron\n","permalink":"https://xiang.dev/posts/explaining-cp-sat/","summary":"\u003cp\u003eOverview of the CP-SAT solver from Google OR-Tools\u003c/p\u003e","title":"🎓 How the CP-SAT solver works"},{"content":"How I set up this website using GitHub Pages, namecheap and Cloudflare\nWarning\nI have migrated my website to Hugo PaperMod + hugo notice\nRead the Papermod Guide and how to host on Github for more info.\nGitHub Pages GitHub Pages is a free and easy way to host a static website. It also works with jekyll, making creating a personal blog very easy.\nSelecting a theme There are a lot of different themes that you can choose from on GitHub.\nIn my case I pretty much chose the first one: Minimal Mistakes and used the starter from its guide.\nAfter setting myusername.github.io as the repository name and enabling github pages in the settings, the website was up and running.\nCustom Domain I wanted to use a custom domain name for my site, so I went to namecheap and purchased xiang.dev given that Google released this domain quite recently.\nI used Cloudflare to handle the redirect and SSL certificates for the site, it is completely free and quite easy to use.\nThis guide by Bart de Goede is quite detailed and explains this step quite well.\nYou may also need to set up A records on Cloudflare pointing to the IPs owned by GitHub.\nNote: Don\u0026rsquo;t forget to also change the nameservers of your domain to the ones provided by cloudflare.\n","permalink":"https://xiang.dev/posts/website-setup/","summary":"\u003cp\u003eHow I set up this website using GitHub Pages, namecheap and Cloudflare\u003c/p\u003e","title":"🔧 Website Setup"},{"content":"Software engineer.\nAvid gamer, reader and weeb.\nLanguages: 🇪🇸, 🇨🇳, 🇬🇧 and learning 🇯🇵\nExperience Date Position Company 09/2023 - Present Software Engineer 09/2021 - 08/2023 Software Engineer 04/2021 - 09/2021 Software Engineer 09/2018 - 01/2021 Software Engineer 09/2017 - 12/2017 Internship Education Title Organization Master in Computer Science (In Progress) Degree in Mathematics and Computer Science Other Fandom Wiki admin: Hollow Knight (ES) Blasphemous (ES) Contributor: Google OR-Tools: Open Source Peer Bonus winner Towards Explainability of On-board Satellite Scheduling for End User Interactions: Helped Cheyenne a bit with her paper. ","permalink":"https://xiang.dev/about/","summary":"\u003cp\u003eSoftware engineer.\u003c/p\u003e\n\u003cp\u003eAvid gamer, reader and weeb.\u003c/p\u003e\n\u003cp\u003eLanguages: 🇪🇸, 🇨🇳, 🇬🇧 and learning 🇯🇵\u003c/p\u003e\n\u003ch2 id=\"experience\"\u003eExperience\u003c/h2\u003e\n\u003ctable\u003e\n  \u003cthead\u003e\n      \u003ctr\u003e\n          \u003cth\u003eDate\u003c/th\u003e\n          \u003cth\u003ePosition\u003c/th\u003e\n          \u003cth\u003eCompany\u003c/th\u003e\n      \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n      \u003ctr\u003e\n          \u003ctd\u003e09/2023 - Present\u003c/td\u003e\n          \u003ctd\u003e\u003cstrong\u003eSoftware Engineer\u003c/strong\u003e\u003c/td\u003e\n          \u003ctd\u003e\u003ca href=\"https://careers.google.com/\"\u003e\u003cimg src=\"https://thumb.wikimedia.org/wikipedia/commons/thumb/e/ee/Google_2026_logo.svg/3840px-Google_2026_logo.svg.png\" alt=\"Google\" width=\"200\"/\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n          \u003ctd\u003e09/2021 - 08/2023\u003c/td\u003e\n          \u003ctd\u003e\u003cstrong\u003eSoftware Engineer\u003c/strong\u003e\u003c/td\u003e\n          \u003ctd\u003e\u003ca href=\"https://www.paradigmadigital.com/\"\u003e\u003cimg src=\"https://www.paradigmadigital.com/assets/img/logo/paradigma-logos/horizontal/paradigma_digital_logo_default.svg\" alt=\"Paradigma Digital\" width=\"200\"/\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n          \u003ctd\u003e04/2021 - 09/2021\u003c/td\u003e\n          \u003ctd\u003e\u003cstrong\u003eSoftware Engineer\u003c/strong\u003e\u003c/td\u003e\n          \u003ctd\u003e\u003ca href=\"https://dezzai.com/\"\u003e\u003cimg src=\"https://dezzai.com/en/wp-content/uploads/2021/10/dezzai_logo_morado.png\" alt=\"dezzai\" width=\"200\"/\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n          \u003ctd\u003e09/2018 - 01/2021\u003c/td\u003e\n          \u003ctd\u003e\u003cstrong\u003eSoftware Engineer\u003c/strong\u003e\u003c/td\u003e\n          \u003ctd\u003e\u003ca href=\"https://foqum.io\"\u003e\u003cimg src=\"https://i.imgur.com/NeCw0UF.png\" alt=\"Foqum\" width=\"200\"/\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n          \u003ctd\u003e09/2017 - 12/2017\u003c/td\u003e\n          \u003ctd\u003e\u003cstrong\u003eInternship\u003c/strong\u003e\u003c/td\u003e\n          \u003ctd\u003e\u003ca href=\"https://www.accenture.com\"\u003e\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Accenture.svg/3840px-Accenture.svg.png\" alt=\"Accenture\" width=\"200\"/\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003ch1 id=\"education\"\u003eEducation\u003c/h1\u003e\n\u003ctable\u003e\n  \u003cthead\u003e\n      \u003ctr\u003e\n          \u003cth\u003eTitle\u003c/th\u003e\n          \u003cth\u003eOrganization\u003c/th\u003e\n      \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n      \u003ctr\u003e\n          \u003ctd\u003eMaster in Computer Science (In Progress)\u003c/td\u003e\n          \u003ctd\u003e\u003ca href=\"https://www.uoc.edu/\"\u003e\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/a/a3/Logo_blau_uoc.png\" alt=\"UOC\" width=\"200\"/\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n          \u003ctd\u003eDegree in Mathematics and Computer Science\u003c/td\u003e\n          \u003ctd\u003e\u003ca href=\"https://www.upm.es\"\u003e\u003cimg src=\"https://www.upm.es/sfs/Rectorado/Gabinete%20del%20Rector/Logos/UPM/CEI/LOGOTIPO%20leyenda%20color%20JPG%20p.png\" alt=\"UPM\" width=\"200\"/\u003e\u003c/a\u003e\u003c/td\u003e\n      \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003ch1 id=\"other\"\u003eOther\u003c/h1\u003e\n\u003chr\u003e\n\u003cul\u003e\n\u003cli\u003eFandom Wiki admin:\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://hollowknight.fandom.com/es/wiki/Hollow_Knight_Wiki\"\u003eHollow Knight (ES)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://blasphemous.fandom.com/es/wiki/Blasphemous_Wiki\"\u003eBlasphemous (ES)\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eContributor:\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/google/or-tools\"\u003eGoogle OR-Tools\u003c/a\u003e: Open Source Peer Bonus \u003ca href=\"https://opensource.googleblog.com/2022/09/announcing-the-second-group-of-open-source-peer-bonus-winners-in-2022.html\"\u003ewinner\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://strathprints.strath.ac.uk/79038/13/Powell_Riccardi_IAC_2021_Towards_explainability_of_on_board_satellite_scheduling_for_end_user_interactions.pdf\"\u003eTowards Explainability of On-board Satellite Scheduling for End User Interactions\u003c/a\u003e: Helped Cheyenne a bit with her paper.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e","title":"About me"},{"content":"Here are some of my personal projects.\nHollow Knight Hollow Knight Wikia Loved that game and decided to translate the english wikia into spanish. Hollow Knight Translator Tool to search of in-game translations.\nFinal Degree Project (University) Generating quality 2D polygon meshes using Restricted Delaunay Triangulations.\n","permalink":"https://xiang.dev/projects/","summary":"\u003cp\u003eHere are some of my personal projects.\u003c/p\u003e\n\u003ch3 id=\"hollow-knight\"\u003eHollow Knight\u003c/h3\u003e\n\u003ch4 id=\"hollow-knight-wikiahttpshollowknightfandomcomeswikihollow_knight_wiki\"\u003e\u003ca href=\"https://hollowknight.fandom.com/es/wiki/Hollow_Knight_Wiki\"\u003eHollow Knight Wikia\u003c/a\u003e\u003c/h4\u003e\n\u003cp\u003eLoved that game and decided to translate the english wikia into spanish.\n\u003cimg alt=\"hollow knight wiki\" loading=\"lazy\" src=\"/projects/hollow_knight_wiki.png\"\u003e\u003c/p\u003e\n\u003ch4 id=\"hollow-knight-translatorhollow-knight-translator\"\u003e\u003ca href=\"/hollow-knight-translator\"\u003eHollow Knight Translator\u003c/a\u003e\u003c/h4\u003e\n\u003cp\u003eTool to search of in-game translations.\u003c/p\u003e\n\u003cp\u003e\u003cimg alt=\"hollow knight translator\" loading=\"lazy\" src=\"/projects/hk-translator.png\"\u003e\u003c/p\u003e\n\u003ch3 id=\"final-degree-projecthttpsgithubcomxiangchen96automatic-mesh-generation-university\"\u003e\u003ca href=\"https://github.com/xiangchen96/Automatic-mesh-generation\"\u003eFinal Degree Project\u003c/a\u003e (University)\u003c/h3\u003e\n\u003cp\u003eGenerating quality 2D polygon meshes using Restricted \u003ca href=\"https://en.wikipedia.org/wiki/Delaunay_triangulation\"\u003eDelaunay Triangulations\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cimg alt=\"final degree project\" loading=\"lazy\" src=\"/projects/tfg.gif\"\u003e\u003c/p\u003e","title":"Projects"}]