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.
What's inside tinweirdo.life
- 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.
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:
eval()usage: If a variable is renamed but its name is referenced as a string inside aneval()call, the code will throw a runtime error unless the string insideevalis also updated.- 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';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:
- Rainwater Management: Using rain gardens, wetlands, and collection systems to retain, infiltrate, and purify water.
- Green Infrastructure: Increasing green spaces, wetlands, and river channels to provide hydrological capacity.
- Water Storage: Implementing underground storage facilities and collection ponds for irrigation and groundwater recharge.
- Sustainable Resource Management: Improving water use efficiency and reducing pollution.
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, wherezoomrepresents the zoom level,xrepresents the column, andyrepresents 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)
- OSM 'standard':
Understand the tripartite structure of the human brain
Human behavior is driven by three distinct brain systems that often conflict:
- Instinctive Brain (本能脑): The oldest system; focuses on survival, comfort, and energy conservation. It manages programmed behaviors and the subconscious, often leading to short-sightedness.
- 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.
- 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.
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.Mount a Vue instance to a DOM element
There are two primary ways to bind a Vue instance to a DOM element:
- Use the
elproperty during instance initialization. - Use the
$mountmethod on the instance.
// Method 1 new Vue({ el: '#root' }); // Method 2 const vm = new Vue(); vm.$mount('#root');- Use the
Implement the Iterator interface for custom object traversal
The
Iteratorinterface allows data structures to be traversed using thefor...ofloop. To make an object iterable, you must implement a method with the keySymbol.iteratorthat returns an object with anext()method. Each call tonext()must return an object containingvalue(the current element) anddone(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 }Implement two-way data binding with v-model
Thev-modeldirective provides two-way data binding. It is specifically designed for use with form-input elements such as<input>and<select>. By default, it collects thevalueof the element.Use Generator functions to control execution flow
Generator functions (function*) allow a function to be paused and resumed. Theyieldkeyword pauses execution and can send a value back to the caller. When the caller callsiterator.next(value), thevaluepassed becomes the result of theyieldexpression 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 }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. RENDERINGEnsure robustness via boundary condition testing and redundancy
To increase system reliability, apply the following strategies:
- 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).
- 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.