tinweirdo.life Blog

website·Indexed 29 days ago

https://tinweirdo.life/

A personal knowledge base and blog covering GIS (Geographic Information Systems), Web development, and personal growth. Technical content includes spatial indexing with R-Tree, tile services, Leaflet, ArcMap Python automation (arcpy), Vue, ES6, and Tauri. Also features notes on AI, Blender modeling, and personal reflections.

Tokens
22.8K
Snippets
103
Records
155
Agent score
50%

What's inside tinweirdo.life

  1. Leaflet tile service and data loading overview

    Leaflet is vendor-agnostic and supports any tile provider that follows standard tile specifications. Common providers include OpenStreetMap, MapBox, Bing Maps, Esri ArcGIS, Here Maps, and Stadia Maps. Users can also host their own OpenStreetMap (OSM) servers.
  2. Understand JavaScript variable name obfuscation

    Variable name obfuscation replaces meaningful variable names with short or hexadecimal-like strings (e.g., _0x7deb) to hinder code readability.

    Caveats:

    1. eval() usage: If a variable is renamed but its name is referenced as a string inside an eval() call, the code will throw a runtime error unless the string inside eval is also updated.
    2. Global Variables/SDKs: When exporting code as an SDK, global variables (e.g., $) must remain unchanged. If a global variable is obfuscated, external modules attempting to call that variable will fail.
    // Original
    var test = 'hello';
    
    // Obfuscated
    var _0x7deb = 'hello';
  3. Understand the Sponge City (海绵城市) urban design concept

    Sponge City is an urban development philosophy aimed at managing water resources and environmental protection by mimicking the absorbent properties of a sponge. Unlike traditional cities with hard paving that lead to rapid runoff and flooding, Sponge Cities enhance the hydrological cycle through:

    1. Rainwater Management: Using rain gardens, wetlands, and collection systems to retain, infiltrate, and purify water.
    2. Green Infrastructure: Increasing green spaces, wetlands, and river channels to provide hydrological capacity.
    3. Water Storage: Implementing underground storage facilities and collection ponds for irrigation and groundwater recharge.
    4. Sustainable Resource Management: Improving water use efficiency and reducing pollution.
  4. Understand the XYZ tile service coordinate system

    Most GIS tile services follow a standard XYZ rule where tiles are 256 × 256 pixel PNG files. The URL structure is typically /zoom/x/y.png, where zoom represents the zoom level, x represents the column, and y represents the tile within that column.

    Common tile service URL templates include:

    • OSM 'standard': https://tile.openstreetmap.org/zoom/x/y.png (Zoom 0-19)
    • OpenCycleMap: http://{abc}.tile.thunderforest.com/cycle/zoom/x/y.png (Zoom 0-22)
    • Thunderforest Transport: http://{abc}.tile.thunderforest.com/transport/zoom/x/y.png (Zoom 0-22)
    • MapTiles API Standard: https://maptiles.p.rapidapi.com/local/osm/v1/zoom/x/y.png?rapidapi-key=YOUR-KEY (Zoom 0-19)
  5. Understand the tripartite structure of the human brain

    Human behavior is driven by three distinct brain systems that often conflict:

    1. Instinctive Brain (本能脑): The oldest system; focuses on survival, comfort, and energy conservation. It manages programmed behaviors and the subconscious, often leading to short-sightedness.
    2. Emotional Brain (情绪脑): Evolved to help humans seek benefit and avoid harm (fight or flight). It is characterized by strong execution and a desire for immediate gratification.
    3. Rational Brain (理智脑): The newest system; responsible for language, art, technology, and civilization. It enables long-term planning, weighing options, and delayed gratification. However, it is the weakest of the three and often struggles to override the instinctive and emotional brains.
  6. Understand the concept of Robustness in software systems

    Robustness refers to the stability and reliability of a system, algorithm, or program when facing abnormal conditions, input errors, environmental changes, or other uncertainties. A robust system continues to operate normally without crashing or producing incorrect results even under complex or unexpected circumstances, such as incomplete/incorrect input data, network latency, hardware failures, or noise/errors.
  7. Mount a Vue instance to a DOM element

    There are two primary ways to bind a Vue instance to a DOM element:

    1. Use the el property during instance initialization.
    2. Use the $mount method on the instance.
    // Method 1
    new Vue({
        el: '#root'
    });
    
    // Method 2
    const vm = new Vue();
    vm.$mount('#root');
  8. Implement the Iterator interface for custom object traversal

    The Iterator interface allows data structures to be traversed using the for...of loop. To make an object iterable, you must implement a method with the key Symbol.iterator that returns an object with a next() method. Each call to next() must return an object containing value (the current element) and done (a boolean indicating if the traversal is complete).

    Native types that already implement this interface include Array, Arguments, Set, Map, String, TypedArray, and NodeList.

    const people = {
        age: 18,
        names: ['Alice', 'Bob', 'Charlie'],
        [Symbol.iterator]() {
            let index = 0;
            return {
                next: () => {
                    if (index < this.names.length) {
                        return { value: this.names[index++], done: false };
                    }
                    return { value: undefined, done: true };
                }
            };
        }
    };
    
    for (const name of people) {
        console.log(name); // Alice, Bob, Charlie
    }
  9. Implement two-way data binding with v-model

    The v-model directive provides two-way data binding. It is specifically designed for use with form-input elements such as <input> and <select>. By default, it collects the value of the element.
  10. Use Generator functions to control execution flow

    Generator functions (function*) allow a function to be paused and resumed. The yield keyword pauses execution and can send a value back to the caller. When the caller calls iterator.next(value), the value passed becomes the result of the yield expression inside the generator, allowing data to be injected back into the function.
    function* gen(arg) {
      console.log(arg); // Initial call
      const param1 = yield 'Value 1';
      console.log(param1); // Received from next('second')
      const param2 = yield 'Value 2';
      console.log(param2); // Received from next('third')
    }
    
    const iterator = gen('iterator param');
    console.log(iterator.next()); // { value: 'Value 1', done: false }
    console.log(iterator.next('second')); // Logs 'second', returns { value: 'Value 2', done: false }
    console.log(iterator.next('third')); // Logs 'third', returns { value: undefined, done: true }
  11. Standard 3D Production Workflow in Blender

    A typical 3D production pipeline follows these four sequential stages: Modeling, Lighting, Texturing, and Rendering.
    1. MODELING
    2. LIGHTING
    3. TEXTURING
    4. RENDERING
  12. Ensure robustness via boundary condition testing and redundancy

    To increase system reliability, apply the following strategies:

    1. Boundary Condition Testing: Test the system with extreme inputs, such as null values, maximum/minimum possible values, or specific edge cases (e.g., a point exactly on a line segment endpoint).
    2. Redundancy and Backup: Implement redundant designs for critical systems, such as database backups to prevent data loss or using multiple replicas in distributed systems to maintain availability during node failures.