Puran
TIL Photos Reading Weekly Search Stats
  • 2024-12-04 TIL

    2024-12-04 TIL: P/Invoke, C# Iterators, Cross-Platform WPF, and ‘Dulce Domum’

    💻

    P/Invoke

    Ever needed to call native functions from a DLL in your .NET app? P/Invoke (Platform Invoke) bridges the gap between managed and unmanaged code.

    • Managed Code: Runs under the control of the .NET runtime (e.g., C#).
    • Unmanaged Code: Runs outside the .NET runtime (e.g., C/C++ native libraries).

    Key Ingredients for P/Invoke:

    1. DllImport Attribute: Declares the external method and specifies the DLL.
    2. Marshaling: Automatically converts between managed (C#) and unmanaged (native) types.
    3. System.Runtime.InteropServices: Provides tools for defining P/Invoke signatures and managing interop behavior.

    yield

    In C#, the yield keyword simplifies the creation of iterators, enabling methods to return elements of a collection one at a time without the overhead of creating temporary collections or implementing complex iterator logic.

    • Deferred Execution: Using yield return, a method can produce each element only when it’s needed during iteration.
    • State Preservation: The method retains its execution state between yield return calls, allowing it to resume from where it left off in subsequent iterations.

    LINQPad

    The Ultimate Scratchpad for C#

    • LINQPad comes with an integrated tutorial/reference, comprising interactive sample queries.

    Avalonia XPF

    A cross-platform WPF that enables you to reuse your code and extend your app’s reach.

    • Avalonia XPF enables WPF apps to run on macOS and Linux with Avalonia’s Fork of WPF, which allows Avalonia to maintain both API and binary compatibility with WPF. Avalonia XPF replaces the low-level WPF code (MilCore) with Avalonia.
    • Avalonia XPF is based on WPF shipped with .NET 6.0 SDK. Currently, unsupported WPF features include Visual3D, Viewport3D, InkCanvas, Win32 interop, and custom Window chromes.

    🌱

    趿

    tā, walk in slippers.

    • 趿拉:把鞋后帮踩在脚后跟下
    • 趿拉板儿:wooden slippers

    Dulce Domum

    Dulce Domum (lit. Sweetly Homeward) is a tune composed by Robert Ambrose in 1876. This phrase is used as the title of chapter 5 of the 1908 novel The Wind in the Willows.

    • lit. is an abbreviation for “literal” or “literally”.
    → 11:58 PM, Dec 4
    Also on Bluesky
  • 2024-12-03 TIL

    2024-12-03 TIL: NMEA Insights, SQL Tips, and Whimsical Observations: From Pac-Man to The Wind in the Willows

    💻

    NMEA Sentences

    • Four Common Types: $GPGGA, $GPRMC, $GPGSA, and $GPGSV.
      • $GPGGA and $GPRMC contain location and time-related data.
      • $GPGSA and $GPGSV provide satellite-related information.
    • Examples:
      • $GPRMC,194000.000,A,3401.8431,N,11711.4761,W,24.43,145.27,061020,,,D*4F
      • $GPGGA,194000.000,3401.8431,N,11711.4761,W,2,10,1.0,478.9,M,-32.5,M,2.0,0000*4D
    • Time and Date Formats:
      • $GPGGA: Time in HHMMSS.SSS format.
      • $GPRMC: Time (HHMMSS.SSS) + Date (DDMMYY), e.g., 194000.000 (UTC 19:40:00.000) and 061020 (6th October 2020).
    • Checksum: Ensures data integrity. Calculated by XOR-ing all characters between $ and *. Example: 4D.

    SQL for ArcGIS

    • Use TIMESTAMP with the format: yyyy-mm-dd hh24:mi:ss (24-hour clock, no AM/PM).

    🌱

    Figure Skating

    • A type of skating that involves circular patterns and often includes jumps.
    • /ˈfɪɡ.jɚ/

    Incisor

    • One of the sharp teeth at the front of the mouth that cut food when you bite into it. (切牙、门齿)
    • /ɪnˈsaɪ.zɚ/

    Pac-Man

    • Pac-Man, a classic arcade game by Namco. Named “食鬼” in Hong Kong, “小精灵” in Taiwan, “吃豆人” in Mianland China.
    • Ghost Characters: Blinky (red), Pinky (pink), Inky (light blue), Clyde (orange).

    XJBC (夏季八冲)

    • A humorous “coffee brewing technique” requiring:
      • No bean selection, no sifting, no stickers, no blooming, no temperature control, no timing, no circular stirring, no cup warming.

    Reading Notes from The Wind in the Willows

    1. On Laziness:
      • Finding joy in being the only idle one among busy citizens.
      • The essence of a good holiday is not resting but watching others work.
    2. On Fear:
      • A terrifying entity feared by all the small animals in the fields and hedges—the “horror of the Wild Wood.”

    Musical Skiers

    • Icelandic photographer Haukur Sigurdsson captured this aerial image of Nordic skiers looking like musical notes on a staff.
    → 11:39 PM, Dec 3
    Also on Bluesky
  • 2024-12-02 TIL

    2024-12-02 TIL: Flock, Location Properties, and Language Nuances

    💻

    • The PointsCount is distinct from Count in a Part.
    • Location has an AdditionalSourceProperties property, useful for storing extra attributes for a location, such as customized node types like start node, end node, and vertex.
    • Flock: Flutter by the community, for the community. Flock is Flutter+.

    🌱

    • 珩 (héng) is the top gem of the pendants.
    • The phrase ‘handled it’ could be pronounced as /ˈhan·dldɪt/.
    • The phrase ‘the exhibit instead’ should be pronounced as /ði ɪɡˈzɪbɪt ɪnˈstɛd/.
    → 11:28 PM, Dec 2
    Also on Bluesky
← Newer Posts Page 3 of 3
  • RSS
  • JSON Feed
  • Lucky
  • Archive
  • About