<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Muhammed Burak Şentürk on Medium]]></title>
        <description><![CDATA[Stories by Muhammed Burak Şentürk on Medium]]></description>
        <link>https://medium.com/@meftunca?source=rss-6929ff7b8864------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*DLGljdOIo2Dhdgp7PUGIEw.jpeg</url>
            <title>Stories by Muhammed Burak Şentürk on Medium</title>
            <link>https://medium.com/@meftunca?source=rss-6929ff7b8864------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 08:46:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@meftunca/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Compressing Without Losing SQL, Random Access, or the Original Bytes: Inside VXG v0.6.0]]></title>
            <link>https://medium.com/@meftunca/compressing-without-losing-sql-random-access-or-the-original-bytes-inside-vxg-v0-6-0-1b4bcfe1ce3c?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b4bcfe1ce3c</guid>
            <category><![CDATA[compression]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Sat, 21 Nov 2026 02:33:32 GMT</pubDate>
            <atom:updated>2026-11-21T02:33:32.932Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How a zero-dependency Rust block codec beats </em><em>Zstd + Trained Dictionary on structured corpora, executes sub-millisecond SQL via NEON/AVX2 without schema ETL, and fixes </em><em>mmap&#39;s cold-NVMe page-fault wall with </em><em>mincore(2) and coalesced </em><em>pread(2).</em></p><p>Modern data pipelines usually force an awkward engineering choice between two worlds:</p><ol><li>General-purpose lossless codecs (LZ4, Zstd): They preserve every byte of your raw NDJSON, CSV, logs, and timestamps verbatim. In return, you forfeit structural queryability and fine-grained random access unless you chunk streams down to tiny independent blocks—at which point compression ratios degrade sharply because dictionaries cannot span chunks.</li><li>Columnar analytical formats (Parquet + DuckDB): They scan and aggregate millions of rows rapidly, but only after an upfront lossy-to-formatting ETL step (81.8 ms on a 300k-row batch up to 3.72–4.32 s on 40M CSV rows). In the process, the original raw text representation (JSON key order, whitespace, float formatting, trailing zeros, multi-template heterogeneity) is discarded—meaning you cannot reconstruct byte offset k or raw record 42 bit-for-bit, nor salvage surviving records if a file header corrupts partway through ingestion.</li></ol><p>I wanted to know if one byte-addressed binary format in pure Rust (zero C dependencies, compiling cleanly down to dependency-free wasm32-unknown-unknown) could break that trilemma:</p><ul><li>100% byte-exact original file reconstruction (decompress(compress(x)) == x, verbatim),</li><li>O(1) block random access &amp; O(log B) row extraction, plus partial recovery (vxg recover) of intact blocks from damaged archives, and</li><li>Direct compressed-domain SQL (vxg sql) and filtered Apache Arrow / DuckDB / Polars pushdown (read_vxg()) competitive with pre-converted Parquet—with zero upfront schema ETL.</li></ul><p>After six releases of profiling, kernel spelunking, and adversarial fuzzing, VXG v0.6.0 (Format v4/v5) achieves that trade-off cleanly—and benchmarks reveal just as much about where PAX block architectures lose (truly cold NVMe scans) as where they dominate.</p><p>This is a deep dive into the data structures, SIMD kernels, bit-level encoding tricks, and OS VM lessons behind VXG.</p><h3>1. The Wire Contract: VXG1 Independent Blocks and Byte-Budget Racing</h3><p>Rather than committing blindly to LZ77 or columnar encoding for an entire file, VXG partitions an input of size N into self-contained independent blocks of nominal size B (4 KiB .. 1 MiB, defaulting to 64 KiB), or newline-snapped variable-size blocks (--record-aligned, bounded by &lt;= 1 MiB) so multi-column NDJSON/CSV records never tear across block boundaries.</p><p>Every block races candidate encoders strictly on exact emitted payload byte count:</p><ul><li>BLOCK_COLUMN (kind = 2): Automatic runtime schema discovery (NDJSON, nested JSON flattened up to depth 4, pretty-printed JSON, CSV/TSV/PSV, CLF HTTP logs, Logfmt) routing each column to specialized models (DecimalPacked, ScaledDecimal, PFOR-Delta, ISO-8601 Timestamp, Dictionary, SegmentDictionary, FrontCodedDict, EpochCounter, Affine, or Pattern).</li><li>BLOCK_DICT_LZ (kind = 3, Format v5): An LZ matcher with L1-resident u16 hash tables, 3 repeat offsets, an optional &lt;= 256 KiB self-contained frame prefix dictionary (FLAG_FRAME_DICT), and 5 byte/control streams where canonical Huffman and 2-way interleaved FSE (tANS) compete per stream by exact byte size.</li><li>BLOCK_LZ (kind = 1): Multi-stride byte-plane transpose + Subtract-Green (R-G, B-G) decorrelation for raw raster/telemetry grids, or Fast-LZ.</li><li>BLOCK_RAW (kind = 0): Incompressible/cryptographic escape hatch guaranteeing strict expansion and CPU work bounds:</li></ul><pre>encoded_size     &lt;= N + 32 + 32 * ceil(N / B)<br>CPU hash probes  &lt;= N<br>accepted matches &lt;= matched_bytes / 8</pre><p>A 32-byte header (VXG1, version, flags, N, B, count, optional v5 dictionary lengths) precedes an 8-byte per-block directory (u32 payload_size | (kind &lt;&lt; 30) + u32 crc32c), optional var_raw lengths (4 * count bytes), an optional shared prefix dictionary, and optional row_index metadata (rows_i | (ends_nl_i &lt;&lt; 31) per block).</p><p>Raw offsets are reconstructed by prefix sum in memory — no 64-bit seek tables bloated into disk headers, no external .dict sidecar files, and no cross-block decompression dependencies. That enables embarrassingly parallel multi-core decode (38.59 GB/s 8T on structured NDJSON) and exact block salvaging from truncated archives.</p><h3>2. Breaking the 64 KiB Wall: Shift-Invariant SWAR Anchors &amp; Pure-Rust FSE</h3><p>In early builds (v0.4.1, before Format v5), 64 KiB block independence had an Achilles&#39; heel: repeating schemas, multi-line documentation, and long text payloads repeated across blocks (source-and-docs.txt) could not reference history across block boundaries (0.2702 ratio vs whole-stream compressors).</p><p>Adding a cross-block shared dictionary (&lt;= 256 KiB, FLAG_FRAME_DICT) solved this—<em>if</em> you can build it without slowing down ingest by 5x or sampling periodic records at the exact wrong stride.</p><h3>Shift-Invariant 1-in-16 SWAR Anchoring</h3><p>If you sample a multi-megabyte buffer at a fixed stride (say, every 16th byte) to sketch recurring 16-byte substrings across 127 windows (sketch16), any input whose record size shares a factor with 16 phases into aliasing bugs—either missing identical JSON prefixes shifted by 1 byte or overflowing a narrow hash bucket.</p><p>Instead, VXG’s macroscopic dictionary trainer (src/dict_lz/train_macro.rs) computes a content-defined 1-in-16 anchor mask across 8 bytes simultaneously in 5 branchless integer operations—testing ((b ^ (b &gt;&gt; 3)) &amp; 0x0f) == 0b1011:</p><pre>/// 100% shift-invariant SWAR 1-in-16 byte anchor (`((b ^ (b &gt;&gt; 3)) &amp; 15) == 11`),<br>/// yielding ~16 anchors per 256-byte block while keeping `sketch16` load &lt;= 0.5.<br>#[inline(always)]<br>fn anchor_mask16(w: u64) -&gt; u64 {<br>    let x = w ^ ((w &gt;&gt; 3) &amp; 0x0f0f_0f0f_0f0f_0f0f);<br>    x &amp; (x &gt;&gt; 1) &amp; (!x &gt;&gt; 2) &amp; (x &gt;&gt; 3) &amp; 0x0101_0101_0101_0101<br>}</pre><p>Unpacking set anchor bits with m.trailing_zeros() &gt;&gt; 3 and m &amp;= m - 1 keeps the probe count tightly bounded (&lt;= 1/16 positions on uniformly distributed bytes, falling back cleanly when inputs are skewed) while parallelizing FastCover segment scoring deterministically across threads (1T == 8T bit-identical dictionary output!).</p><h3>L1D Working Sets &amp; 2-Way Interleaved Pure-Rust tANS / FSE</h3><p>For unstructured streams (BLOCK_DICT_LZ), VXG separates tokens ((lit_code) | (ml_code &lt;&lt; 4)), literals, repeat-aware offset codes, match length extensions, and raw offset bits into 5 independent streams.</p><p>Skewed distributions like off_codes or len_ext frequently have Shannon entropy well below 1.0 bit/symbol, where Huffman wastes up to a full bit per symbol. VXG implements a zero-C-dependency, wasm32-clean 2-way interleaved FSE (tANS) coder (src/dict_lz/fse.rs) with table_log in 5..=10 and a branchless backward unaligned u64 bit reader:</p><pre>#[inline(always)]<br>fn pop(&amp;mut self, bits: u32) -&gt; Result&lt;usize&gt; {<br>    let b = bits as usize;<br>    if b &gt; self.bit_cursor {<br>        return Err(Error::InvalidFrame(&quot;fse bitstream underflow&quot;));<br>    }<br>    self.bit_cursor -= b;<br>    if b == 0 {<br>        return Ok(0);<br>    }<br>    let byte_idx = self.bit_cursor &gt;&gt; 3;<br>    let shift = self.bit_cursor &amp; 7;<br>    let raw = if byte_idx + 8 &lt;= self.bytes.len() {<br>        unsafe { self.bytes.as_ptr().add(byte_idx).cast::&lt;u64&gt;().read_unaligned().to_le() }<br>    } else {<br>        let mut tmp = [0u8; 8];<br>        let rem = self.bytes.len() - byte_idx;<br>        tmp[..rem].copy_from_slice(&amp;self.bytes[byte_idx..]);<br>        u64::from_le_bytes(tmp)<br>    };<br>    Ok(((raw &gt;&gt; shift) &amp; ((1u64 &lt;&lt; bits) - 1)) as usize)<br>}</pre><p>Every stream races raw bytes vs. 4-stream canonical Huffman vs. FSE by exact serialized length.</p><p>Real-world 64 KiB block benchmark result (Apple Silicon 8T, liblz4 1.10.0, libzstd 1.5.7):</p><pre>Corpus (64 KiB independent blocks, 8T)     VXG Ratio   LZ4(a1)   Zstd-9   Zstd+Dict-9*   zstd -19 --long**   VXG Enc / Dec<br>---------------------------------------------------------------------------------------------------------------------------<br>nyc-taxi-2024-01.ndjson (52.3 MB)           0.0593     0.1899    0.0823      0.0784          0.0554         8.84 / 38.59 GB/s<br>nyc-taxi-2024-01.csv    (23.0 MB)           0.1829     0.4241    0.2194      0.2141          0.1617         3.22 / 14.66 GB/s<br>gharchive-2025-01-15.ndjson (50.3 MB)       0.1181     0.2256    0.1414      0.1072          0.0633         0.95 / 15.31 GB/s<br>apache-access.clf        (2.4 MB)           0.0974     0.1730    0.1062      0.0896          0.0535         0.75 / 12.75 GB/s<br>macos-install.log       (34.2 MB)           0.0548     0.1249    0.0770      0.0452          0.0278         2.34 / 18.04 GB/s<br>pg100-shakespeare.txt    (5.6 MB)           0.3780     0.6223    0.3918      0.3729          0.3000         0.26 /  6.57 GB/s<br>---------------------------------------------------------------------------------------------------------------------------<br>6-Dataset Public Geomean                    0.1171     0.2500    0.1419      0.1181          0.0795         1.52 / 15.35 GB/s</pre><pre>*  Zstd+Dict-9 sweeps 32..256 KiB dict budgets per corpus (min total incl. dict); VXG timings INCLUDE dictionary training!<br>** zstd -19 --long uses a 128 MiB whole-file window (random access = NO).</pre><blockquote><em>Notice the </em><em>--level L1D working-set trade-off: VXG&#39;s default </em><em>--level 3 uses 4-way local L1D </em><em>u16 hash tables (</em><em>WAYS=4, DWAYS=4, </em><em>128 KiB scratch) plus </em><em>FSE, pulling the 6-dataset geomean ahead of </em><em>Zstd+Dict-9 (</em><em>0.1171 vs </em><em>0.1181) at </em><em>1.52 GB/s encode / </em><em>15.35 GB/s decode (</em><em>8T). Dropping to </em><em>--level 1 shrinks the working set back into L1 (</em><em>WAYS=1, DWAYS=1, greedy, no </em><em>FSE), lifting </em><em>8T encode back to </em><em>2.07 GB/s at </em><em>0.1232 ratio.</em></blockquote><h3>3. Exception-Patched PFOR-Delta on Cumulative Time-Series</h3><p>Naive delta coding breaks badly on real-world multi-entity time-series CSVs such as datasets/covid-19:</p><p>Inside a single country/county partition, cumulative confirmed counts move in tiny steps (0..63, fitting in &lt;= 6 bits). Every time the file crosses a country or county boundary, the series jumps cleanly from 30,000,000 -&gt; 0. One reset forces unpatched zigzag-delta coding to allocate ~26 bits for every row in the block—blowing the block budget so badly it falls back to generic LZ!</p><p>In src/columns/model_delta_pfor.rs, VXG encodes MODEL_DECIMAL_DELTA (and MODEL_SCALED_DECIMAL) with exception-patched PFOR-Delta (width_hdr = 0x80 | base_width):</p><ol><li>All n - 1 row-to-row zigzag deltas pack into uniform base_width bits (0..=63).</li><li>Rare boundary jumps store only their truncated high bits as sorted sparse (idx_gap: uleb, high_zigzag: uleb64) patches (rejected automatically unless &lt;= n / 4 exceptions and saving &gt;= 10% over flat packed decimals).</li><li>Crucially, the column header embeds exact [min_val, min_val + span] ULEB bounds directly (decimal_header_bounds), allowing WHERE col &gt;= K filters to prune whole blocks in O(1) without touching a single bit-packed value.</li></ol><p>Measured impact on real datasets/covid-19 (64 KiB independent blocks):</p><ul><li>time-series-19-covid-combined.csv (8.6 MB): 0.1836 -&gt; 0.0963 (131 / 131 blocks compressed as BLOCK_COLUMN) — 31.9% smaller than Zstd-9 (0.1415), and even smaller than whole-file non-random-access zstd -19 --long (0.1066), decoding at 11.05 GB/s (8T)!</li><li>us_confirmed_33m.csv (35.2 MB): 0.0456 (1.97× smaller than Zstd-9 0.0897), decoding at 24.66 GB/s (8T).</li></ul><h3>4. Compressed-Domain SQL Without Metadata Cheats</h3><p>Let’s clear up one important benchmark detail immediately: when benchmarking VXG sql against DuckDB 2.0 + Parquet, none of the 15 in-cache or 10 scale analytical queries answer from precomputed block sum/min/max headers. Column headers for MODEL_DECIMAL_PACKED / MODEL_SCALED_DECIMAL contain only (min, bit_width). Every single row in a matching block is genuinely unpacked and aggregated.</p><p>How does it beat DuckDB + Parquet on warm data without decompressing records back into text or heap columns?</p><h3>Algebraic Residual Factorization + Branch-Free RowBitset Probing</h3><p>Given an unsigned bit-packed column v_i = min + r_i (width bits per residual r_i) and a surviving predicate bitmask M:</p><pre>sum_{i in M} (min + r_i) = |M| * min + sum_{i in M} r_i</pre><p>In src/columns/ops_agg_fast.rs, try_agg_decimal_packed_fast branches purely on predicate density and bit width:</p><ul><li>Unfiltered / Dense Scan (TplMask::All, width &lt;= 16): Unpacks 64 tightly bit-packed residuals into a stack-resident [u16; 64] L1 buffer and reduces sum/min/max straight in SIMD registers (vaddlvq_u16 / vminvq_u16 / vmaxvq_u16 on AArch64 NEON, AVX2/SSE2 on x86_64):</li></ul><pre>#[cfg(target_arch = &quot;aarch64&quot;)]<br>if cnt == 64 {<br>    unsafe {<br>        use core::arch::aarch64::*;<br>        let p = buf.as_ptr();<br>        for g in 0..8usize {<br>            let v = vld1q_u16(p.add(g * 8));<br>            r_sum += u64::from(vaddlvq_u16(v));<br>            r_lo = r_lo.min(vminvq_u16(v));<br>            r_hi = r_hi.max(vmaxvq_u16(v));<br>        }<br>    }<br>    start_row += 64;<br>    continue;<br>}</pre><ul><li>Sparse Filtered Scan (w0.count_ones() &lt;= 20 per 64-row word): Does not unpack the 64-row chunk at all! Instead, it steps strictly over set bits via hardware trailing_zeros() + bit-clear (w &amp;= w - 1) and extracts only matching offsets with read_packed_bits_at:</li></ul><pre>while w != 0 {<br>    let bit = w.trailing_zeros() as usize;<br>    let r = read_packed_bits_at(<br>        packed_bytes,<br>        (start_row + bit) * (width as usize),<br>        width,<br>    );<br>    r_sum += u128::from(r);<br>    r_lo = r_lo.min(r);<br>    r_hi = r_hi.max(r);<br>    w &amp;= w - 1;<br>}</pre><h3>Stack-First SoA Group Buckets &amp; Dynamic Top-K Bounds</h3><p>For GROUP BY (src/columns/ops_group_soa.rs), VXG avoids per-group HashMap&lt;Vec&lt;u8&gt;, Accum&gt; allocations entirely. SoaU32 / SoaU64 inline fixed [T; 16] Structure-of-Arrays slots on the stack (c_s, s_s, lo_s, hi_s), spilling to a dense Vec only when block cardinality exceeds 16 groups, and fusing directly with dictionary/packed key scans.</p><p>For ORDER BY col DESC LIMIT K, worker threads share a single AtomicI64 cutoff bound (top_k_column_with_bound): as soon as one block establishes a 10th-best threshold, downstream threads skip entire compressed blocks whenever header bounds (min, max) prove no row inside can beat the shared atomic bound.</p><h3>Zero-Copy Arrow / DuckDB Bridge &amp; Real Analytical Benchmarks</h3><p>External engines (DuckDB 2.0+, Polars, Python) don&#39;t even have to touch VXG&#39;s internal format—read_vxg(path, columns=[...], where=&quot;...&quot;) pushes WHERE predicates into compressed blocks and streams only matching rows across the C Data / C Stream ABI (ArrowArrayStream via zero-pyarrow Python PyCapsule!).</p><p>1. In-Cache Queries (200k–300k rows, 1T / 8T latency in ms):</p><ul><li>Across 15 analytical queries on nyc-taxi.ndjson, nyc-taxi.csv, and multi-template ndjson_varied (libvxg.dylib vs duckdb 2.0.0 PREPARE/EXECUTE, 100% numeric equality verified):</li><li>VXG --record-aligned wins 15 / 15 on 8T (0.03–0.26 ms) and 15 / 15 on 1T (0.13–1.12 ms).</li><li>Default fixed-64 KiB VXG wins 15 / 15 on 8T and 11 / 15 on 1T.</li><li>Meanwhile, storing raw 52.33 MB nyc-taxi.ndjson takes 24.5 ms (8T --record-aligned, 2.86 MB, lossless) vs 81.8 ms Parquet-Snappy ETL (3.94 MB, lossy-to-formatting) and 89.2 ms Parquet-Zstd ETL (2.96 MB, lossy-to-formatting).</li></ul><p>2. Multi-GB Warm OS Page Cache Scale (12 months of unmodified 2024 NYC TLC data):</p><pre>Dataset &amp; Metric (Warm OS Cache)        VXG --rec-align    Parquet-Snappy    Parquet-Zstd<br>-----------------------------------------------------------------------------------------<br>nyc-taxi-2024-10m.ndjson (2.62 GB raw)<br>  Size / 8T Ingest / Byte-Lossless      140.8 MB (0.67s)   193.3 MB (0.96s)  144.6 MB (0.96s)<br>                                        Lossless: YES      Lossless: NO      Lossless: NO<br>  WHERE COUNT(*)          (1T / 8T)     29.79 / 3.91 ms    41.03 / 13.64 ms  70.19 / 13.48 ms<br>  SUM/MIN/MAX(total)      (1T / 8T)     11.75 / 2.30 ms    38.35 / 15.43 ms  53.58 / 10.81 ms<br>  GROUP BY pay + SUM      (1T / 8T)     32.58 / 5.91 ms    43.92 / 10.62 ms  59.72 / 11.56 ms<br>  ORDER BY total LIMIT 10 (1T / 8T)      9.58 / 1.58 ms    16.10 /  9.50 ms  27.29 / 14.11 ms</pre><pre>nyc-taxi-2024-40m.csv (3.06 GB raw)<br>  Size / 8T Ingest / Byte-Lossless      550.4 MB (1.69s)   773.1 MB (4.32s)  579.4 MB (3.72s)<br>  WHERE COUNT(*)          (1T / 8T)    150.67 / 25.88 ms  159.14 / 36.79 ms 275.13 / 60.13 ms<br>  SUM/MIN/MAX(total)      (1T / 8T)     82.42 / 12.64 ms  156.03 / 28.03 ms 210.90 / 34.48 ms<br>  GROUP BY pay + SUM      (1T / 8T)    162.75 / 27.79 ms  177.54 / 35.50 ms 241.67 / 38.14 ms<br>  ORDER BY total LIMIT 10 (1T / 8T)     63.08 / 11.07 ms   30.05 / 18.03 ms  46.00 / 21.97 ms</pre><p>Notice the two honest nuances right inside the data:</p><ul><li>On 10M NDJSON without --record-aligned, fixed-64 KiB VXG creates ~40,000 tiny blocks (~245 verbose JSON rows/block), making fixed-64 KiB scans (13.98–38.73 ms 8T) slower than Parquet—proving block count, not row count, governs verbose NDJSON scan overhead.</li><li>On 40M CSV single-threaded Top-10, Parquet&#39;s row-group zone maps still win 1T (30.05 ms vs 63.08 ms), while VXG takes 8T (11.07 ms vs 18.03 ms).</li></ul><h3>5. Hitting the Cold-NVMe mmap Wall—and Fixing It with mincore(2) + Coalesced pread(2)</h3><p>Everything looked fast until I flushed the OS page cache (F_NOCACHE) and ran cold 1st-pass queries directly from NVMe SSD.</p><p>In v0.5.3, cold NVMe scans hit a brick wall:</p><ul><li>10M NDJSON: 103.21–146.93 ms (VXG --record-aligned) vs 12.21–52.59 ms (DuckDB + Parquet)</li><li>40M CSV: 370.81–643.57 ms (VXG) vs 27.02–62.92 ms (DuckDB + Parquet)</li></ul><p>Two separate physical realities caused that 5–10x cold gap, and teasing them apart changed how v0.6.0 touches memory-mapped files:</p><h3>Reality #1: OS mmap Fault Serialization on Cold Pages</h3><p>When 8 worker threads touch uncached 16 KiB VM pages inside a mmap region simultaneously, every missing page triggers an expensive synchronous kernel fault serialization inside the VM subsystem instead of coalesced queue-depth-deep NVMe pread(2) I/O. Even probing 4 sample pages with mincore fails when an archive is partially cached.</p><p>In VXG v0.6.0 (src/mmap/sys.rs &amp; src/mmap/pread.rs), ChunkResidency::probe issues one single mincore(2) system call across the entire mapped address range, producing an exact per-1 MiB residency bitmap:</p><pre>let mut vec = vec![0u8; total_pages];<br>MINCORE_CALLS.fetch_add(1, Ordering::Relaxed);<br>let rc = unsafe { mincore(base as *const c_void, total_pages * ps, vec.as_mut_ptr()) };<br>if rc != 0 {<br>    return (vec![true; num_chunks], num_chunks);<br>}<br>for c in 0..num_chunks {<br>    let c_start = slice_start + c * chunk_bytes;<br>    let c_end = (slice_start + (c + 1) * chunk_bytes).min(slice_end);<br>    let p_start = (c_start - base) / ps;<br>    let p_end = (c_end - 1 - base) / ps;<br>    let is_res = vec[p_start..=p_end].iter().all(|&amp;v| (v &amp; 1) != 0);<br>    // Resident 1 MiB chunks -&gt; zero-copy mmap slice<br>    // Cold 1 MiB chunks     -&gt; parallel coalesced pread(2) into HybridArena<br>}</pre><ul><li>Resident 1 MiB chunks execute zero-copy directly from mmap (zero warm-cache regression).</li><li>Non-resident 1 MiB chunks bypass VM faults via parallel coalesced 1 MiB pread(2) calls (HybridArena) backed by automatic fd resolution (resolve_backing_fd), cutting cold NVMe 10M-row NYC Taxi query latency by 2.6–3.7× without a single user-facing flag.</li></ul><h3>Reality #2: PAX Block Locality vs. Pure Column-Chunk I/O</h3><p>Even with HybridArena saturating NVMe bandwidth, a fundamental storage trade-off remains:</p><p>In a PAX self-contained block codec like VXG, all 13 columns of a block sit side-by-side inside that block so you can decompress block #42 standalone, splice columns, verify raw line checksums, or salvage intact blocks. On a truly cold disk scan projecting 1 or 2 columns out of 13, reading contiguous 1 MiB chunks touches the entire 140–550 MB file on SSD—whereas Parquet&#39;s 122,880-row macro column chunks let DuckDB issue range reads over strictly the ~18–45 MB belonging to those 2 queried columns (note how shrinking Parquet row groups from 122,880 to 16,384 immediately slows cold Parquet-Snappy from 32.44 -&gt; 148.02 ms on 40M CSV too!).</p><p>For warm-cache / operational log stores / verbatim archives, PAX wins decisively. For cold petabyte archival OLAP touching 2 of 200 columns from object storage, pure columnar row-group layouts like Parquet remain structurally superior. Both tradeoffs are honest physics.</p><h3>6. Hardware CRC32C, Forgery-Safe Row Indices, and Zero-WASI wasm32</h3><p>Three subtle systems details round out v0.6.0:</p><ol><li>Hardware CRC32C (src/checksum.rs): Software Slice-by-8 table lookup bottlenecks parallel frame verification (verify_frame) on large archives. v0.6.0 dispatches dynamically to native ARMv8 __crc32cd (32-byte unrolled loop) on aarch64 and SSE4.2 _mm_crc32_u64 on x86_64, verifying frames at 12+ GB/s with ~64 KiB thread scratch.</li><li>Adversarial Integrity on row_index: Storing a trailing row_index count per block lets frame_row_count inspect line counts in $O(\text{blocks})$ and extract_row jump in $O(\log B)$ without decoding earlier blocks—but a malformed or malicious frame could lie about row_meta_i. VXG validates pack_block_row_meta(decoded_block) == row_meta_i during verify_frame and extract_row_range across 1,250+ adversarial fuzzer mutations.</li><li>Portable C ABI &amp; wasm32-unknown-unknown: Compiles cleanly to libvxg.a, libvxg.dylib / .so / .dll (<a href="https://github.com/meftunca/vxg/blob/main/include/vxg.h">include/vxg.h</a>), C/C++/Go/C#/Python bindings (examples/ffi/), and a standalone vxg.wasm (--target wasm32-unknown-unknown) with zero WASI imports (WebAssembly.instantiate(bytes, {})).</li></ol><h3>7. Honest Engineering Summary: When to Use What</h3><pre>Workload                                         Best Fit                      Why<br>----------------------------------------------------------------------------------------------------------------<br>Verbatim JSON/CSV log lakes + fast SQL/Arrow     VXG (--record-aligned)        Smaller than Parquet, 0 ETL,<br>                                                                               0.03-0.26 ms 8T warm SQL, 100% raw<br>Cumulative time-series (metrics, counters)       VXG (PFOR-Delta)              0.0456-0.0963 ratio (beats Zstd-9)<br>Individual prose, free-text logs, deep JSON      Zstd + Dict (L9)              Optimal parser + full cross-file win<br>Maximum raw ingest/extract MB/s on raw logs      LZ4 (a1)                      Lightest CPU path (4.95/20.52 GB/s)<br>Cold-disk NVMe/S3 wide-table 2-of-100-col scan   DuckDB + Parquet              Macro column chunks skip unread cols</pre><p>If you store operational NDJSON, CSV, telemetry, or multi-level JSON logs and hate choosing between keeping the raw bytes intact and querying them at C++ analytical speeds without standing up an ETL cluster — give VXG v0.6.0 a spin.</p><ul><li>Repository &amp; Source: <a href="https://github.com/meftunca/vxg">github.com/meftunca/vxg</a> (MIT License, Rust 1.89+)</li><li>Reproducible Benchmarks: cargo run --release --features bench --bin vxg-bench and scripts/bench_scale_duckdb.py</li></ul><pre>git clone https://github.com/meftunca/vxg &amp;&amp; cd vxg<br>cargo build --release<br>./target/release/vxg compress events.ndjson events.vxg --record-aligned -t auto<br>./target/release/vxg sql events.vxg \<br>  &quot;SELECT service, COUNT(*), SUM(bytes) WHERE status = 500 GROUP BY service ORDER BY SUM(bytes) DESC LIMIT 10&quot;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b4bcfe1ce3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Artificial Intelligence Does Not Need to Be Bigger. It Needs a Better Architecture.]]></title>
            <link>https://medium.com/@meftunca/artificial-intelligence-does-not-need-to-be-bigger-it-needs-a-better-architecture-11a4b5884439?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/11a4b5884439</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 16:27:51 GMT</pubDate>
            <atom:updated>2026-08-12T16:27:51.977Z</atom:updated>
            <content:encoded><![CDATA[<h3>The hidden cost of the compute age — and the alternative proposed by Bit4</h3><p>The prevailing story of progress in artificial intelligence rests on a remarkably simple equation: more data, more parameters, more accelerators, and more electricity. This strategy has produced extraordinary results. It has also confined the field within an architectural regime whose continued success depends upon its continued expansion.</p><p>The problem is not merely that large models are expensive. The deeper problem is that the dominant architecture of contemporary AI attempts to resolve several distinct functions — knowledge, reasoning, context, tool use, and adaptation — within substantially the same parametric structure. When the system needs to know, remember, verify, or use something, it often activates the same general-purpose computational engine once again. When knowledge changes, the weights become stale. When new context arrives, transient memory grows. When a new capability is required, the usual prescription is more data, more training, or a larger model.</p><p>This is not the inevitable form of intelligence. It is an engineering choice.</p><p>Bit4 is an architectural research programme that re-examines that choice.</p><p>Its premise is straightforward: an intelligent system need not store everything in one place, solve every problem through one mechanism, or reorganise its entire mind whenever it encounters new information. Intelligence concerns more than what a system knows. It also concerns whether the system can determine what it needs, where reliable information resides, which instrument should be used, which result requires verification, and which change must not be made permanent.</p><h3>The Great Success — and the Great Misconception — of Scaling</h3><p>It is tempting to dismiss contemporary large language models. It would also be mistaken. Transformer-based systems have produced remarkable advances in language, programming, pattern recognition, and general-purpose problem solving. For the first time, one computational structure has demonstrated meaningful competence across an unusually broad range of cognitive tasks.</p><p>Yet the success of an approach does not establish that it is either final or efficient.</p><p>The present paradigm resolves many different problems by absorbing them into an increasingly large probabilistic function. Knowledge of the world is distributed through model weights. Temporary user information is appended to context. Long conversations are carried in an expanding working memory. Tools and external resources are frequently inserted into that same context as textual descriptions. Reasoning, facts, instructions, and intermediate results then compete and interact within a common stream of tokens.</p><p>As a consequence, even a modest need may activate a vast general-purpose computational surface. Establishing whether a model possesses the correct information can become more expensive than using the information itself. The link between a claim and its source weakens. Temporary thought, durable knowledge, and operational state begin to blur into one another.</p><p>The architecture carries an implicit assumption:</p><blockquote><em>A sufficiently large and sufficiently well-trained model can reproduce the required knowledge and behaviour at the moment they are needed.</em></blockquote><p>That assumption works at certain scales. Its cost, however, does not merely rise along a smooth technical curve. It reorganises the surrounding economy.</p><h3>When Computation Becomes a Black Hole</h3><p>The energy consumption of the AI industry is not only an environmental concern. It is also an economic record of architectural inefficiency. Every unnecessary movement of memory, every intermediate representation computed again, and every context enlarged without purpose has a physical counterpart: electricity, cooling, silicon, and infrastructure.</p><p>The pursuit of more capable AI is increasingly organised as the following chain:</p><pre>larger model<br>→ more accelerators<br>→ larger data centre<br>→ more energy<br>→ greater capital requirements<br>→ fewer viable participants<br>→ a more centralised AI economy</pre><p>This cycle is self-reinforcing. As hardware becomes more expensive, fewer organisations can develop foundation models. As fewer organisations can develop them, the research agenda adapts to the infrastructure those organisations already possess. Because scaling continues to produce results, greater scale appears to be a safer investment than the search for fundamentally better algorithms. Capital validates the existing paradigm, and the existing paradigm demands still more capital.</p><p>The resulting concentration is not exclusively technological. The production of machine intelligence, the behavioural boundaries of models, the direction of research, and the economic conditions of access increasingly depend upon a small number of infrastructure owners.</p><p>This is not an argument that large technology companies are uniquely malicious. The problem is structural: the dominant architecture naturally produces centralisation. If advancing a technology requires billions of dollars in computational infrastructure, the power to reproduce, inspect, and modify that technology cannot be broadly distributed. Publishing open weights does not, by itself, distribute those capabilities equally.</p><p>For this reason, the sustainability problem of AI cannot be solved solely with cleaner electricity or more efficient chips. We do not merely need a greener method of performing the same ever-expanding computation. We need architectures that eliminate computation which should never have been necessary.</p><h3>Separating Intelligence from Knowledge</h3><p>Contemporary models frequently carry knowledge inside the machinery of intelligence itself. Bit4 treats knowledge, behaviour, and cognitive coordination as different responsibilities.</p><p>A system need not memorise every fact in parametric memory. It may be sufficient for it to locate an authoritative source when required, evaluate the validity of that source, and admit into its working state only the evidence necessary for the current task. Similarly, rather than embedding every operational detail of every tool in model weights, a system may learn when a tool is appropriate and under which contract it may be invoked.</p><p>This is not simply the familiar practice of attaching several external tools to a language model. It proposes a deeper separation of concerns:</p><ul><li>A core engine provides linguistic and cognitive coordination.</li><li>Specialised capabilities are represented as independent, verifiable components.</li><li>Knowledge travels with its provenance and conditions of validity.</li><li>Temporary working state remains distinct from durable facts.</li><li>Learning produces bounded and reversible changes rather than uncontrolled modification of the entire system.</li><li>The system does not merely produce an answer; it can retain an account of which components were used, why they were selected, and upon which evidence the result depends.</li></ul><p>These principles require us to regard AI not as a single enormous model, but as a coordinated and evolving computational organism.</p><h3>From a Monolithic Model to a Living System</h3><p>Natural systems do not retrain their entire structure after every new experience. They do not rewrite their full genetic code in order to acquire a skill. Short-term state, durable knowledge, reflex, instrument use, and specialised function are not all stored through one undifferentiated memory mechanism.</p><p>Biology is not a software specification. It nevertheless offers a valuable engineering lesson: resilient intelligence requires differentiated responsibilities and controlled adaptation.</p><p>In Bit4, the model is not treated as a finished and frozen product. It is treated as a system capable, over time, of selecting, testing, and reorganising its components. Adding new knowledge or a new capability need not require retraining the entire engine. A candidate component can first be evaluated in isolation. Its provenance, dependencies, permissions, and behavioural boundaries can be inspected. If it succeeds, it may be introduced gradually. If it causes harm, it may be quarantined or replaced by a previously trusted version.</p><p>The essential idea is not perpetual change. It is the capacity to change safely.</p><p>A central risk in online learning is the uncertain boundary between adaptation and corruption. A system may learn something new while forgetting an old capability. It may be poisoned by an unreliable source, or damage its general behaviour in exchange for a local improvement. Within Bit4, no update becomes trustworthy merely because it has been learned. It must be evaluated together with its evidence, scope, regressions, dependencies, and conditions for reversal.</p><h3>Towards Bounded Working Memory</h3><p>Long context has become one of the most visible features of modern AI. But long context should not be confused with long-term intelligence.</p><p>The ability to retain millions of tokens in working memory does not establish that those tokens have been understood effectively. As context expands, so do memory use, data movement, attention cost, and the risk that irrelevant material will interfere with active computation. The method used to carry the past can become more expensive than the past is valuable.</p><p>Bit4 investigates a different direction: preserve task-relevant state within a bounded active workspace rather than keeping the entire history continuously active. Raw experience may remain available in durable sources and time-indexed records; the active engine should carry only the state, evidence, and abstractions required for the present decision.</p><p>The desired memory relation can be stated without relying on a particular rendering engine:</p><pre>Active memory at time T<br>    = engine memory<br>    + bounded working state<br>    + evidence selected for the current task</pre><p>The architectural objective is therefore:</p><pre>growth of active memory with respect to history length T ≈ 0</pre><p>This is not yet a marketing claim. It is an architectural hypothesis that must be tested. Bounded memory without preserved quality is not success. Every proposed memory transformation must therefore be evaluated against a conventional baseline under equivalent tasks, with accuracy, latency, energy, and regression measured together.</p><h3>Why Tokens per Second Are Not Enough</h3><p>Comparing AI systems only by tokens per second is rather like comparing vehicles only by engine revolutions. A system may produce tokens extremely quickly while still requiring unnecessary tokens, repeated tool calls, or redundant reasoning to complete the task.</p><p>A more meaningful measure is:</p><pre>real efficiency<br>    = verified successful tasks<br>      / (time × energy × peak memory × processed tokens)</pre><p>This shifts the evaluation of AI from the volume of production to the quality and cost of completed work. If a small engine selects the correct source and resolves a task in fifty thousand tokens while a general-purpose model requires one million, raw generation speed conceals the economic reality.</p><p>Bit4 is not intended to produce a model that merely speaks faster. Its aim is to construct a system that knows what computation is required — and what computation is not.</p><h3>The Correct Source May Be More Valuable Than a Larger Model</h3><p>Modern models possess impressive general knowledge. Parametric knowledge, however, is detached from its original source, becomes stale, and rarely carries an explicit degree of confidence. A larger model can reduce this difficulty, but cannot eliminate it.</p><p>In many real-world tasks, the need is not for more memorisation but for access to the correct truth. When the subject is a financial record, scientific measurement, legal rule, medical protocol, production state, or private organisational datum, the answer should not be whatever the model most plausibly recalls. It should be grounded in an authorised and current source.</p><p>A source-oriented architecture has two important consequences.</p><p>First, when information changes, the whole model need not be retrained. Second, a result can become not merely linguistically persuasive but epistemically traceable. The system may know which source supports a claim, when that source was last verified, and which dependent conclusions require reconsideration if the source changes.</p><p>For trustworthy AI, this may constitute a more fundamental advance than model size.</p><h3>Reversing Economic Centralisation Through Architecture</h3><p>The concentration of AI is commonly discussed as a matter of policy, regulation, or competition law. Those instruments matter. Yet so long as the technological foundation remains unchanged, the physical cause of centralisation remains intact.</p><p>If a capable system can operate locally, within a few gigabytes of memory and a modest energy budget, the economic structure changes. Universities, small companies, municipalities, hospitals, and independent researchers need no longer remain merely customers of a remote API. They can operate intelligence over their own data, under their own permissions, and according to their own standards of inspection.</p><p>More importantly, the production of expertise can move from the centre towards the periphery. Instead of requiring one company to teach a single model the whole of human knowledge, communities can develop verifiable capabilities and knowledge components within their own fields. A scientific institution might maintain a component for its discipline; a company might define an instrument for its internal processes; an open-source community might develop an independent verification package.</p><p>Value does not disappear under such a system. It moves. Capital need not flow almost exclusively towards giant training runs and the owners of data centres. It may instead support information quality, safe tools, verification, specialised knowledge, and local application.</p><p>The economic proposition of Bit4 is not free intelligence. It is a more plural economy of intelligence.</p><h3>Why This Matters for Europe</h3><p>Europe is frequently assessed in the AI race against the scale of American capital and Asian manufacturing. That comparison assumes Europe must play the same game with fewer resources.</p><p>Perhaps the correct strategy is not to play the same game.</p><p>Energy efficiency, data sovereignty, local execution, auditable learning, and traceable knowledge are not merely European regulatory preferences. They may become design advantages of a new AI architecture. Privacy and accountability need not be compliance layers attached after the system has been built. They can become properties of how the system works.</p><p>Compact but capable systems that run within an institution, keep its data local, refuse to make untrusted information durable, and connect decisions to verifiable sources would have strategic value across government, science, medicine, defence, and industry.</p><p>Europe’s opportunity in AI may not be to reproduce the largest model. It may be to establish a better architecture for knowledge and computation.</p><h3>What Bit4 Does Not Claim</h3><p>Bit4 does not claim to repeal the laws of physics. It does not assume that knowledge can be compressed at zero cost, that every task can be solved by a small model, or that bounded working memory can represent an unlimited history without loss.</p><p>It argues, instead, that the limits must be measured explicitly.</p><ul><li>Every compressed representation must be evaluated for information loss.</li><li>Every faster execution must be measured together with accuracy and energy.</li><li>Every learned change must be tested for regression against prior capabilities.</li><li>Every external component must remain subject to provenance, permission, and dependency boundaries.</li><li>Every architectural gain must be compared with a control system under equivalent hardware and task conditions.</li></ul><p>Bit4 does not claim that perfect intelligence has been achieved. It claims that a substantial fraction of the costs treated as inevitable in contemporary AI are consequences of architectural choices.</p><h3>The Experiment Ahead</h3><p>The value of these ideas will be determined not by the force of a manifesto, but by working systems.</p><p>The first stage is deliberately modest. A real low-bit neural engine will be reimplemented in an independent runtime. The purpose is not to demonstrate every proposed advantage at once. It is to establish that the existing model can be loaded, executed, and verified layer by layer without sacrificing its behaviour.</p><p>Conventional mechanisms can then be replaced under controlled conditions. New forms of memory, composition, and learning will not be imposed across the whole system in a single step. Each change will first be tested within a limited region against a teacher model. Successful changes can expand; unsuccessful ones can be reversed.</p><p>The governing principle is simple:</p><blockquote><em>Progress not by retraining intelligence from the beginning, but by understanding it, separating its responsibilities, and transforming them into the right components.</em></blockquote><h3>Conclusion: Less Waste, Not Merely More Compute</h3><p>If the future of AI consists only of larger data centres, machine intelligence will become progressively more expensive, centralised, and energy-intensive. That path may continue to produce capable models in the near term. It will also raise the economic and physical cost of each advance to a level that fewer institutions can bear.</p><p>The alternative is not to romanticise small models. It is to reconsider which responsibilities belong inside the model at all.</p><p>An AI system need not memorise everything. It need not keep every past token active. It need not alter all its weights for every new capability. It need not answer every question through the same computational path.</p><p>Once knowledge is separated from its source, reasoning from its instruments, working state from durable memory, and adaptation from verification, a different form of scaling becomes possible — not scale by parameter count and energy consumption, but scale by correct composition.</p><p>Bit4 is an investigation of that possibility.</p><p>If it succeeds, the result will not be merely a faster or smaller language model. It will be a new class of computational system — one capable of changing who may develop AI, where it may operate, how it may learn, and how its economic value may be distributed.</p><p>The defining word of the present AI era has been <em>bigger</em>.</p><p>The next era may require a simpler principle:</p><blockquote><em>The right knowledge, through the right component, at the right time — and only as much computation as the task requires.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11a4b5884439" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Silicon and Steel: The Nanomaterial Blueprint for Global Infrastructure Transmutation]]></title>
            <link>https://medium.com/@meftunca/beyond-silicon-and-steel-the-nanomaterial-blueprint-for-global-infrastructure-transmutation-e2cc8520c530?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2cc8520c530</guid>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[microchip]]></category>
            <category><![CDATA[cnt]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Thu, 25 Jun 2026 08:39:50 GMT</pubDate>
            <atom:updated>2026-06-25T08:39:50.092Z</atom:updated>
            <content:encoded><![CDATA[<p>The contemporary industrial complex is operating on borrowed time, constrained by the thermodynamic and physical limits of its foundational materials. Silicon-based microelectronics are approaching atomic scaling limits where quantum tunneling induces catastrophic leakage currents. Concurrently, traditional macro-materials like structural steel and copper vectors are failing to keep pace with the power density and weight-reduction demands of deep-tier electrification.</p><p>To bypass these systemic bottlenecks, material science must transition from top-down machining to bottom-up molecular architecture. Carbon Nanotubes (CNTs) — hollow cylinders of sp²-bonded carbon atoms — represent the primary vector for this transition. They are not merely an incremental upgrade; they are a fundamental restructuring of how humanity manipulates energy, electrons, and mechanical stress.</p><h3>1. The Atomic Architecture: Chirality and Transport Physics</h3><p>The extraordinary macroscopic properties of CNTs are directly dictated by their nanoscale geometry. A Single-Walled Carbon Nanotube (SWCNT) can be conceptualized as a graphene sheet rolled into a seamless cylinder. The direction in which this sheet is rolled is defined by the chiral vector:</p><p>$$C_h = n\hat{a}_1 + m\hat{a}_2$$</p><p>Where $(n, m)$ are integers that determine the structural symmetry. This structural variance is highly consequential:</p><ul><li>When $|n — m| = 3k$ (where $k$ is an integer), the CNT exhibits purely <strong>metallic electrical behavior</strong>.</li><li>Otherwise, the CNT functions as a <strong>semiconductor</strong> with a bandgap inversely proportional to its diameter.</li></ul><p>In metallic SWCNTs, electrons experience <strong>ballistic transport</strong>. Because the mean free path of an electron in a pristine CNT can extend to several micrometers at room temperature, electrons propagate through the carbon lattice without undergoing phonon scattering. This minimizes Joule heating, allowing CNT conductors to sustain current densities exceeding $10⁹ \text{ A/cm}²$ — roughly three orders of magnitude greater than traditional copper.</p><p>Furthermore, the carbon-carbon sp² bonds yield an intra-layer Young’s modulus of approximately $1 \text{ TPa}$ and a tensile strength averaging $60\text{–}100 \text{ GPa}$. This mechanical resilience is paired with an axial thermal conductivity ($K$) measured between $3000\text{–}6000 \text{ W/m·K}$, easily eclipsing diamond.</p><h3>2. Deep-Tech Realities: Semiconductor and Energy Applications</h3><p>The theoretical superiority of CNTs is now actively altering empirical roadmaps across critical industries.</p><h4>Next-Generation Microelectronics</h4><p>As the semiconductor industry pushes past the $2\text{nm}$ node, traditional Silicon-on-Insulator (SOI) and FinFET architectures face severe subthreshold swing degradation. Carbon Nanotube Field-Effect Transistors (CNFETs) resolve this by leveraging semiconducting SWCNTs as the channel material. Because the CNT channel is ultra-thin (typically $\sim 1\text{nm}$ in diameter), it allows for electrostatic control that vastly outperforms bulk silicon. Recent industrial fabrication runs have demonstrated that CNFETs can deliver a projected $3\times$ improvement in energy-delay product (EDP) compared to silicon baselines, operating at substantially lower supply voltages ($V_{dd}$).</p><h4>Advanced Energy Storage</h4><p>In energy storage systems, Multi-Walled Carbon Nanotubes (MWCNTs) are actively replacing legacy carbon black additives within lithium-ion battery electrodes. By incorporating highly conductive, high-aspect-ratio MWCNTs into the cathode matrix (e.g., Lithium Iron Phosphate or Nickel Manganese Cobalt chemistries), engineers can establish a highly efficient <strong>percolation network</strong> at a much lower weight percentage (often $&lt; 1\text{ wt}\%$). This structural matrix significantly lowers internal DC resistance, accelerating lithium-ion intercalation mechanics. The tangible real-world outcome is dual-faceted: a drastic reduction in electric vehicle (EV) charging times and a mitigation of thermal stress, which extends overall battery cycle life.</p><pre>[Traditional Carbon Black]          [MWCNT Percolation Network]<br>   Points of contact only              Continuous electron pathways<br>     (Higher Resistance)                    (Lower Resistance)<br>        ●   ●   ●   ●                         ───────●───────<br>        ●   ●   ●   ●                         ───────●───────</pre><h3>3. The Scalability Bottleneck: The Synthesis Challenge</h3><p>If CNTs possess such unparalleled metrics, why have they not completely replaced existing infrastructure? The answer lies in structural control and macro-scale translation.</p><p>Currently, large-scale synthesis relies heavily on <strong>Chemical Vapor Deposition (CVD)</strong>, utilizing fluidized bed reactors where hydrocarbon gases are decomposed over catalytic transition-metal nanoparticles (e.g., Fe, Co, Ni). While CVD can generate metric tons of material, it natively produces a heterogeneous mixture of metallic and semiconducting tubes, varying in diameter and alignment. For microelectronics, a purity level of $99.9999\%$ semiconducting SWCNTs is mandatory; any residual metallic tubes cause catastrophic source-to-drain shorts.</p><p>Furthermore, translating nanoscale properties to macroscale structural materials remains a critical engineering hurdle. When CNTs are spun into yarns or sheets, the bulk material properties degrade by orders of magnitude due to inter-tube sliding and <strong>Stone-Wales defects</strong> (localized pentagon-heptagon pairs in the hexagonal lattice).</p><h3>Moving Forward</h3><p>The primary mandate for this generation of material scientists is clear: we must optimize catalyst design to achieve absolute chiral selectivity during synthesis, and develop functionalization techniques that prevent inter-tube slippage without disrupting the ballistic transport pathways of the carbon lattice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q-P9viZ4MUXtpn90VA5zEQ.png" /></figure><p>Subsequent entries in this series will isolate and dissect these specific domains, beginning with a deep look into the structural chemistry required to synthesize single-chirality arrays at scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2cc8520c530" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I’m Building Vex: A Systems Language That Actually Understands Your Code]]></title>
            <link>https://medium.com/@meftunca/why-im-building-vex-a-systems-language-that-actually-understands-your-code-64be3c08f0bb?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/64be3c08f0bb</guid>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 13:31:09 GMT</pubDate>
            <atom:updated>2026-01-23T13:31:09.426Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve spent the last three months building a programming language. Not because the world desperately needed another one, but because I got tired of the same tradeoffs we’ve been making for decades.</p><p>You know the drill: Want safety? Here’s Rust, but good luck explaining lifetimes to your team. Want simplicity? Go’s great, until you need generics or zero-cost abstractions. Want performance? C++ will give you rope, and you’ll hang yourself with it.</p><p>I wanted something different. I wanted a language that’s actually <em>smarter</em> than me.</p><h3>The Core Problem Nobody Talks About</h3><p>Here’s a dirty secret about LLVM (the compiler backend that powers Rust, Clang, Swift, and dozens of other languages): it’s dumb. Not in a bad way — it’s incredibly good at what it does. But it operates on a low-level intermediate representation where all the rich semantic information from your source code has been stripped away.</p><p>When you write this in Rust:</p><pre>fn add_points(a: &amp;Point, b: &amp;Point) -&gt; Point {<br>    Point { x: a.x + b.x, y: a.y + b.y }<br>}</pre><p>By the time LLVM sees it, it doesn’t know that a and b are immutable references. It doesn&#39;t know they can&#39;t alias. It has to <em>prove</em> these things through expensive analysis passes, and often it can&#39;t.</p><p>The compiler knows more than LLVM. We just throw that knowledge away.</p><h3>What If We Didn’t?</h3><p>Vex is my answer to that question. It’s a systems programming language where the compiler leverages everything it knows about your code to generate better machine code than you could write by hand.</p><p>Let me show you what I mean. Here’s a simple function in Vex:</p><pre>fn add_points(a: &amp;Point, b: &amp;Point): Point {<br>    return Point { x: a.x + b.x, y: a.y + b.y }<br>}</pre><p>The compiler sees &amp;Point—immutable borrows. It knows these pointers:</p><ul><li>Cannot alias (borrow checker guarantee)</li><li>Cannot be null (not Option&lt;&amp;Point&gt;)</li><li>Will not be written to during this call</li></ul><p>So it tells LLVM: “This function is pure. Always inline it. These pointers don’t capture anything.” The result:</p><pre>; Function Attrs: alwaysinline mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)<br>define %Point @add_points(ptr noalias readonly %a, ptr noalias readonly %b) {<br>  %1 = load &lt;2 x i64&gt;, ptr %a, align 8<br>  %2 = load &lt;2 x i64&gt;, ptr %b, align 8<br>  %3 = add &lt;2 x i64&gt; %1, %2    ; Auto-vectorized!<br>  ...<br>}</pre><p>That &lt;2 x i64&gt; is SIMD. The compiler auto-vectorized a struct addition because it <em>knew</em> it was safe. No intrinsics. No explicit SIMD types. Just a regular struct with two i64 fields.</p><p>Rust can’t do this reliably. Go doesn’t even try. C++ might, if the stars align and you sacrifice the right goat.</p><h3>The VUMM: Smart Pointers That Think For Themselves</h3><p>Every Rust programmer knows the dance: Do I need Box? Rc? Arc? Will this cross thread boundaries? Should I use RefCell or Mutex?</p><p>In Vex, you write Box(value) and the compiler figures it out:</p><pre>let data = Box(MyStruct { ... })</pre><p>The <strong>Vex Unified Memory Model (VUMM)</strong> analyzes how you use this value:</p><ul><li>Only one owner, never cloned? → Zero-overhead unique pointer</li><li>Shared within a single thread? → Non-atomic reference counting</li><li>Crosses thread boundaries? → Atomic reference counting</li></ul><p>You don’t decide. The compiler decides, based on actual usage patterns. And if it picks atomic refcounting, it also tells the optimizer “don’t inline this function — it has atomic operations that will mess up your loop optimizations.”</p><h3>Goroutines That Don’t Suck</h3><p>Go got concurrency right. Goroutines and channels are genuinely pleasant to use. But Go threw away memory safety to get there.</p><p>Vex keeps both:</p><pre>fn process_data(items: &amp;Vec&lt;Item&gt;) {<br>    for item in items {<br>        go {<br>            let result = await expensive_computation(item)<br>            results &lt;- result<br>        }<br>    }<br>}</pre><p>The go {} block spawns a lightweight task on an M:N scheduler (like Go). The borrow checker ensures item is safe to access. The await keyword yields at suspension points without blocking OS threads.</p><p>No data races. No runtime overhead for safety checks. Just concurrent code that works.</p><h3>The Silicon IR: Write Once, Run on Everything</h3><p>This is the part that keeps me up at night.</p><p>Modern hardware is insanely parallel. Your laptop has a GPU with thousands of cores sitting idle while your Python script maxes out one CPU core. The cloud instance you’re paying for has AVX-512, and you’re using scalar arithmetic.</p><p>Vex has a <strong>Silicon IR (SIR)</strong> — an intermediate representation designed for heterogeneous compute. When you write array operations:</p><pre>let result = a + b * c  // element-wise on arrays</pre><p>The SIR optimizer can target:</p><ul><li><strong>CPU SIMD</strong>: SSE, AVX, AVX-512, ARM NEON, RISC-V Vector</li><li><strong>GPU</strong>: Metal (Apple), CUDA (NVIDIA), ROCm (AMD), Vulkan SPIR-V</li><li><strong>Web</strong>: WebGPU via WGSL shaders</li></ul><p>Same source code. The compiler picks the best backend based on your target platform.</p><p>Is it fully implemented? No. The CPU SIMD path works. GPU offloading is in progress. But the architecture is there, and it’s not a pipe dream — it’s code that compiles today.</p><h3>What’s Actually Working (Honest Assessment)</h3><p>I’m three months in. Here’s the real status:</p><p><strong>Working well:</strong></p><ul><li>Borrow checker with non-lexical lifetimes (Polonius-style)</li><li>VUMM automatic Rc/Arc inference</li><li>Auto-vectorization through SIR</li><li>M:N async runtime with channels</li><li>LSP server with go-to-definition, completions, diagnostics</li><li>VS Code extension</li><li>737/741 tests passing (99.5%)</li></ul><p><strong>In progress:</strong></p><ul><li>GPU offloading (SIR → Metal/CUDA)</li><li>join!, select! for concurrent operations</li><li>Package manager and ecosystem</li></ul><p><strong>Not there yet:</strong></p><ul><li>Production battle-testing</li><li>Large-scale real-world usage</li><li>Comprehensive standard library</li></ul><h3>Why Should You Care?</h3><p>You probably shouldn’t — yet. Vex isn’t ready for production. The ecosystem is nonexistent. Documentation is sparse.</p><p>But here’s what I’m betting on: the era of manually optimizing code is ending. Hardware is too complex, targets are too diverse, and developer time is too valuable.</p><p>The compilers of the future won’t just translate your code. They’ll understand it. They’ll know that your function is pure, that your pointer doesn’t alias, that your loop can be parallelized. And they’ll generate code that’s better than what most of us could write by hand.</p><p>Vex is my attempt to build that future. It’s not there yet. But every time I see the compiler auto-vectorize a loop I didn’t expect, or correctly infer that a hot function should be inlined because all its parameters are immutable borrows — I know I’m on the right track.</p><p><em>Vex is open source and in active development. If you’re interested in contributing or just want to see some unconventional compiler design, check out the repository. Fair warning: it’s three months old and looks like it.</em></p><p><strong>Manifesto:</strong> <em>Every Cycle, Every Core, Every Time.</em></p><p>The compiler should squeeze every bit of performance from your hardware. Not because you asked it to. Because it knows how.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64be3c08f0bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Typescript Hard Code String Extractor (hcs)]]></title>
            <link>https://medium.com/@meftunca/typescript-hard-code-string-extractor-hcs-e873df7d582e?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/e873df7d582e</guid>
            <category><![CDATA[i18n]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Thu, 09 Oct 2025 08:55:53 GMT</pubDate>
            <atom:updated>2025-10-09T08:55:53.394Z</atom:updated>
            <content:encoded><![CDATA[<p>A command-line tool to scan your project for hardcoded strings, helping you identify text that needs to be internationalized (i18n) or managed more effectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/80/0*f3aJ8n5EsuW2IFyG" /></figure><p>Github Repo: <a href="https://github.com/meftunca/hard-code-string-extractor">https://github.com/meftunca/hard-code-string-extractor</a></p><h3>Why Use This Tool?</h3><p>Keeping track of hardcoded strings is crucial for:</p><ul><li>Internationalization (i18n): Easily spot text that needs to be moved to translation files.</li><li>Maintainability: Manage UI text and other string literals from a central or configured perspective.</li><li>Consistency: Ensure that user-facing strings are handled systematically.</li></ul><p>hard-code-string-extractor (hcs) scans your codebase based on flexible configurations and outputs a JSON report detailing the found strings and their locations.</p><h3>Features</h3><ul><li>Configurable Scanning: Define multiple scan tasks, each targeting different directories and file types.</li><li>Broad File Support: Scans JavaScript, JSX, TypeScript, and TSX files by default (configurable).</li><li>Flexible Detection Rules:</li><li>Identifies strings in JSX text content (&lt;div&gt;Hardcoded Text&lt;/div&gt;).</li><li>Finds string literals within JSX expressions (&lt;p&gt;{&quot;Hardcoded Expression&quot;}&lt;/p&gt;).</li><li>Checks for strings in configurable JSX attributes (e.g., placeholder, alt, aria-label).</li><li>Detects strings passed as arguments to specific, user-defined functions (e.g., Alert.alert(&quot;Title&quot;), enqueueSnackbar(&quot;Message&quot;)).</li><li>JSON Output: Generates a detected.json (or custom-named) file with findings, including:</li><li>File path (relative to the scanned directory).</li><li>Line and column number.</li><li>The detected hardcoded string.</li><li>Output paths are often clickable in modern terminals and IDEs like VS Code.</li><li>Configuration via hcs_config.json: Manage all your scanning profiles and rules from a single JSON configuration file.</li></ul><h3>Installation</h3><p>You can install hard-code-string-extractor globally to use the hcs command anywhere:</p><pre>npm install -g hard-code-string-extractor</pre><p>Or you can install it locally in your project:</p><pre>npm install --save-dev hard-code-string-extractor</pre><p>If installed locally, you can run it using npx hcs or by adding it to your package.json scripts.</p><p>Usage The primary way to use the tool is by defining your scan configurations in an hcs_config.json file in your project root.</p><p>Bash</p><p>hcs [taskName1 taskName2 …] If you run hcs without any arguments, it will attempt to load hcs_config.json from the current directory and execute all tasks defined within it. You can specify one or more task names as arguments to run only those specific tasks. Example:</p><p>Bash</p><h3>Run all tasks defined in hcs_config.json</h3><pre>hcs</pre><p>Run only the “FrontendScan” and “MobileScan” tasks</p><p>hcs FrontendScan MobileScan The tool will generate JSON output files as specified in each task’s configuration.</p><p>Configuration (hcs_config.json) Create an hcs_config.json file in the root of your project to define global settings and specific scan tasks.</p><p>Structure:</p><h3>JSON</h3><pre>{<br>  &quot;globalExtensions&quot;: [&quot;js&quot;, &quot;jsx&quot;, &quot;ts&quot;, &quot;tsx&quot;],<br>  &quot;globalAttributes&quot;: [&quot;placeholder&quot;, &quot;title&quot;, &quot;alt&quot;, &quot;aria-label&quot;, &quot;label&quot;, &quot;data-tooltip&quot;],<br>  &quot;globalTargetFunctions&quot;: [<br>    {<br>      &quot;functionNameForDisplay&quot;: &quot;Default: Alert.alert&quot;,<br>      &quot;calleeType&quot;: &quot;MemberExpression&quot;, &quot;objectName&quot;: &quot;Alert&quot;, &quot;propertyName&quot;: &quot;alert&quot;,<br>      &quot;argumentChecks&quot;: [<br>        { &quot;index&quot;: 0, &quot;type&quot;: &quot;StringLiteral&quot;, &quot;description&quot;: &quot;title&quot; },<br>        { &quot;index&quot;: 1, &quot;type&quot;: &quot;StringLiteral&quot;, &quot;description&quot;: &quot;message&quot; }<br>      ]<br>    }<br>  ],<br>  &quot;tasks&quot;: [<br>    {<br>      &quot;name&quot;: &quot;WebAppUI&quot;,<br>      &quot;scanDir&quot;: &quot;./src/webapp&quot;,<br>      &quot;output&quot;: &quot;reports/webapp_hardcoded.json&quot;,<br>      &quot;extensions&quot;: [&quot;jsx&quot;, &quot;tsx&quot;],<br>      &quot;attributes&quot;: [&quot;placeholder&quot;, &quot;aria-label&quot;, &quot;title&quot;],<br>      &quot;targetFunctions&quot;: [<br>        {<br>          &quot;functionNameForDisplay&quot;: &quot;enqueueSnackbar (notistack)&quot;,<br>          &quot;calleeType&quot;: &quot;Identifier&quot;, &quot;identifierName&quot;: &quot;enqueueSnackbar&quot;,<br>          &quot;argumentChecks&quot;: [<br>            { &quot;index&quot;: 0, &quot;type&quot;: &quot;StringLiteral&quot;, &quot;description&quot;: &quot;message&quot; }<br>          ]<br>        },<br>        {<br>          &quot;functionNameForDisplay&quot;: &quot;customTranslateFunction&quot;,<br>          &quot;calleeType&quot;: &quot;Identifier&quot;, &quot;identifierName&quot;: &quot;translate&quot;,<br>          &quot;argumentChecks&quot;: [<br>             // This example rule helps find if you accidentally pass a literal string<br>             // to your translate function instead of a key.<br>            { &quot;index&quot;: 0, &quot;type&quot;: &quot;StringLiteral&quot;, &quot;description&quot;: &quot;translation_key_or_default_literal&quot; }<br>          ]<br>        }<br>      ]<br>    },<br>    {<br>      &quot;name&quot;: &quot;MobileAppStrings&quot;,<br>      &quot;scanDir&quot;: &quot;./src/mobile&quot;,<br>      &quot;output&quot;: &quot;reports/mobile_hardcoded.json&quot;,<br>      // Uses globalExtensions<br>      &quot;attributes&quot;: [&quot;label&quot;, &quot;hint&quot;, &quot;accessibilityLabel&quot;], // Overrides globalAttributes<br>      &quot;targetFunctions&quot;: [<br>        // Inherits Alert.alert from globalTargetFunctions if merging logic is implemented,<br>        // or if this list is empty, globalTargetFunctions could be used by default.<br>        // Current script behavior: If task.targetFunctions exists, it&#39;s used exclusively.<br>        // If task.targetFunctions is undefined, config.globalTargetFunctions is used.<br>        // If that&#39;s also undefined, SCRIPT_DEFAULTS.targetFunctions is used.<br>        // To combine, you&#39;d explicitly list global ones here or modify the script&#39;s merging logic.<br>        // For clarity, let&#39;s assume this task wants its own specific list plus the global Alert.alert.<br>        // The script would need to be adjusted to merge globalTargetFunctions with task-specific ones if both are present.<br>        // As implemented in the provided script, if a task defines targetFunctions, it *replaces* the global/default.<br>        // To use global and add more:<br>        // &quot;targetFunctions&quot;: &quot;USE_GLOBAL_AND_ADD_MORE&quot; (requires script change) or manually copy global ones here.<br>        // Let&#39;s assume for this example, it defines its own complete list for this task:<br>        {<br>            &quot;functionNameForDisplay&quot;: &quot;Alert.alert (Mobile)&quot;, // Potentially overriding a global one with more specific checks<br>            &quot;calleeType&quot;: &quot;MemberExpression&quot;, &quot;objectName&quot;: &quot;Alert&quot;, &quot;propertyName&quot;: &quot;alert&quot;,<br>            &quot;argumentChecks&quot;: [<br>                { &quot;index&quot;: 0, &quot;type&quot;: &quot;StringLiteral&quot;, &quot;description&quot;: &quot;title&quot; },<br>                { &quot;index&quot;: 1, &quot;type&quot;: &quot;StringLiteral&quot;, &quot;description&quot;: &quot;message&quot; }<br>            ]<br>        },<br>        {<br>          &quot;functionNameForDisplay&quot;: &quot;Snackbar.show (react-native-snackbar)&quot;,<br>          &quot;calleeType&quot;: &quot;MemberExpression&quot;, &quot;objectName&quot;: &quot;Snackbar&quot;, &quot;propertyName&quot;: &quot;show&quot;,<br>          &quot;argumentChecks&quot;: [<br>            {<br>              &quot;index&quot;: 0,<br>              &quot;type&quot;: &quot;ObjectExpression&quot;,<br>              &quot;properties&quot;: [<br>                { &quot;keyName&quot;: &quot;text&quot;, &quot;valueType&quot;: &quot;StringLiteral&quot;, &quot;description&quot;: &quot;snackbar text&quot; }<br>              ]<br>            }<br>          ]<br>        }<br>      ]<br>    },<br>    {<br>      &quot;name&quot;: &quot;SharedLibraries&quot;,<br>      &quot;scanDir&quot;: &quot;./packages/shared-utils/src&quot;,<br>      &quot;output&quot;: &quot;reports/shared_libs_hardcoded.json&quot;,<br>      &quot;extensions&quot;: [&quot;js&quot;, &quot;ts&quot;]<br>      // Uses globalAttributes and globalTargetFunctions (or script defaults if globals are not set)<br>    }<br>  ]<br>}</pre><h3>Configuration Fields:</h3><ul><li>globalExtensions (Array&lt;String&gt;, optional): Default file extensions to scan if not specified per task.</li><li>globalAttributes (Array&lt;String&gt;, optional): Default JSX attributes to check for hardcoded strings if not — specified per task.</li><li>globalTargetFunctions (Array&lt;Object&gt;, optional): Default function call patterns to check if not specified per — task.</li><li>tasks (Array&lt;Object&gt;, required): An array of scan task objects.</li><li>name (String, required): A unique name for the task (used for selective execution).</li><li>scanDir (String, required): The directory to scan for this task, relative to the project root.</li><li>output (String, required): The output JSON file path for this task’s results, relative to the project root.</li><li>extensions (Array&lt;String&gt;, optional): Task-specific file extensions. Overrides globalExtensions.</li><li>attributes (Array&lt;String&gt;, optional): Task-specific JSX attributes. Overrides globalAttributes.</li><li>targetFunctions (Array&lt;Object&gt;, optional): Task-specific function call patterns. Overrides globalTargetFunctions.</li><li>Each targetFunction object has:</li><li>functionNameForDisplay (String): A descriptive name for the rule.</li><li>calleeType (String): “Identifier” (e.g., myFunc()) or “MemberExpression” (e.g., object.myFunc()).</li><li>identifierName (String, if calleeType is “Identifier”): The name of the function.</li><li>objectName (String, if calleeType is “MemberExpression”): The name of the object (e.g., “Alert”).</li><li>propertyName (String, if calleeType is “MemberExpression”): The name of the property/method (e.g., “alert”).</li><li>argumentChecks (Array&lt;Object&gt;): Rules for checking arguments.</li><li>index (Number): The 0-based index of the argument.</li><li>type (String): Expected type of the argument, e.g., “StringLiteral” or “ObjectExpression”.</li><li>properties (Array&lt;Object&gt;, if type is “ObjectExpression”): Rules for checking object properties.</li><li>keyName (String): The name of the object key.</li><li>valueType (String): Expected type of the property’s value (e.g., “StringLiteral”).</li><li>description (String, optional): A comment for the rule.</li></ul><h3>Output JSON Format</h3><p>The output is a JSON object where keys are the location of the hardcoded string and values are the detected strings themselves:</p><p>JSON</p><pre>{<br>  &quot;src/components/MyComponent.jsx:25:12&quot;: &quot;Welcome to our application!&quot;,<br>  &quot;src/pages/HomePage.tsx:10:5&quot;: &quot;Learn More&quot;,<br>  &quot;src/utils/toastHelper.js:5:22&quot;: &quot;Operation successful&quot;<br>}</pre><p>The filePath:lineNumber:columnNumber format is often clickable in IDEs like VS Code, taking you directly to the source.</p><p>Example Workflow Create hcs_config.json in your project root with your desired tasks (see example above). Run the extractor: Bash</p><h3>Run all tasks</h3><pre>hcs</pre><h3>Run a specific task</h3><pre>hcs WebAppUI</pre><p>Review the output JSON files (e.g., reports/webapp_hardcoded.json). Contributing Contributions are welcome! Please feel free to open an issue or submit a pull request. (TODO: Add contribution guidelines if you plan to open-source it formally).</p><p>License This project is licensed under the MIT License — see the LICENSE.md file for details (You would need to create a LICENSE.md file with the MIT license text).</p><p>To make hcs the short command for your CLI tool:</p><p>When you publish your package to npm, you’ll need to configure the bin field in your package.json like this:</p><pre>// package.json<br>{<br>  &quot;name&quot;: &quot;hard-code-string-extractor&quot;,<br>  &quot;version&quot;: &quot;0.3.0&quot;, // Or your current version<br>  &quot;description&quot;: &quot;A CLI tool to detect hardcoded strings in your project.&quot;,<br>  &quot;main&quot;: &quot;index.js&quot;, // Your main script file<br>  &quot;bin&quot;: {<br>    &quot;hard-code-string-extractor&quot;: &quot;./index.js&quot;,<br>    &quot;hcs&quot;: &quot;./index.js&quot;<br>  },<br>  // ... other fields like author, license, dependencies, scripts<br>}<br>This tells npm to create a symlink for hcs (and hard-code-string-extractor) to your index.js script when the package is installed globally. Make sure index.js has the shebang #!/usr/bin/env node at the very top.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e873df7d582e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JCRON: The Next-Generation Cron Expression Scheduler]]></title>
            <link>https://medium.com/@meftunca/jcron-the-next-generation-cron-expression-scheduler-5ba7839118fb?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ba7839118fb</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[cron]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Tue, 07 Oct 2025 10:03:42 GMT</pubDate>
            <atom:updated>2025-10-07T10:03:42.451Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A comprehensive guide to JCRON — the advanced cron scheduler that extends traditional cron syntax with powerful enterprise features</strong></p><h3>Introduction</h3><p>In the world of task scheduling, cron expressions have been the de facto standard for decades. However, as applications have grown more sophisticated, the limitations of traditional cron syntax have become increasingly apparent. Enter JCRON — a modern, extended cron expression language that maintains backward compatibility while adding powerful features for complex scheduling scenarios.</p><p>JCRON is available in three production-ready implementations:</p><ul><li>PostgreSQL/SQL — Native database scheduling with 10,000+ patterns/sec throughput</li><li>Node.js/TypeScript — Server-side JavaScript scheduling with full async support</li><li>Go — High-performance scheduling with goroutine-safe operations</li></ul><p>All three implementations share the same syntax and feature set, ensuring consistency across your technology stack.</p><h3>Why JCRON?</h3><h3>Traditional Cron Limitations</h3><p>Standard cron expressions suffer from several limitations:</p><ul><li>No support for “last day of month” scheduling</li><li>Cannot express “nth weekday of month” (e.g., “second Tuesday”)</li><li>No ISO 8601 week-of-year filtering</li><li>Timezone handling is external to the expression</li><li>No built-in end-of-period or start-of-period modifiers</li></ul><h3>JCRON Enhancements</h3><p>JCRON addresses these limitations while maintaining full backward compatibility:</p><ul><li>Special Syntax: L (last), # (nth), W (weekday) operators</li><li>Week of Year (WOY): ISO 8601 week-based scheduling</li><li>Timezone Support: Built-in timezone specification</li><li>Period Modifiers: End-of-day, start-of-week, etc.</li><li>Sub-second Precision: Full support for seconds field</li><li>High Performance: Optimized for production workloads (10K+ ops/sec)</li></ul><h3>Core Syntax</h3><h3>Standard 6-Field Format</h3><p>JCRON uses a 6-field cron expression format:</p><pre>second minute hour day month day-of-week</pre><p>Each field can contain:</p><ul><li>Asterisk (*): Any value</li><li>Number: Specific value</li><li>Range (-): Range of values (e.g., 1–5)</li><li>List (,): Multiple values (e.g., 1,15,30)</li><li>Step (/*): Step values (e.g., */5 for every 5 units)</li></ul><h3>Field Value Ranges</h3><p>FieldRangeSpecial ValuesSecond0–59*/5, */10, */15, */30Minute0–59*/5, */10, */15, */30Hour0–23*/2, */3, */4, */6, */12Day1–31L (last), W (weekday), 1–31Month1–12*/3, */6 (quarterly, semi-annual)Day of Week0–6L (last), # (nth), 0=Sunday</p><h3>Basic Scheduling Patterns</h3><h3>Time-Based Schedules</h3><p>Every Minute:</p><ul><li>0 * * * * * - Every minute on the minute</li><li>30 * * * * * - Every minute at 30 seconds past</li></ul><p>Hourly Schedules:</p><ul><li>0 0 * * * * - Top of every hour</li><li>0 15 * * * * - 15 minutes past every hour</li><li>0 0 */2 * * * - Every 2 hours</li><li>0 0 */6 * * * - Every 6 hours (4 times daily)</li></ul><p>Daily Schedules:</p><ul><li>0 0 0 * * * - Midnight every day</li><li>0 0 9 * * * - 9 AM daily</li><li>0 0 12 * * * - Noon daily</li><li>0 30 14 * * * - 2:30 PM daily</li></ul><p>Interval Schedules:</p><ul><li>0 */5 * * * * - Every 5 minutes</li><li>0 */15 * * * * - Every 15 minutes</li><li>0 */30 * * * * - Every 30 minutes</li><li>0 0 */3 * * * - Every 3 hours</li></ul><h3>Day-Based Schedules</h3><p>Weekday Patterns:</p><ul><li>0 0 9 * * 1-5 - Weekdays at 9 AM (Monday-Friday)</li><li>0 0 17 * * 1-5 - Weekdays at 5 PM</li><li>0 0 10 * * 0,6 - Weekends at 10 AM (Saturday-Sunday)</li><li>0 0 9 * * 1 - Every Monday at 9 AM</li><li>0 0 17 * * 5 - Every Friday at 5 PM</li></ul><p>Specific Days:</p><ul><li>0 0 9 * * 2,4 - Tuesday and Thursday at 9 AM</li><li>0 0 12 * * 1,3,5 - Monday, Wednesday, Friday at noon</li><li>0 0 0 15 * * - 15th of every month at midnight</li><li>0 0 0 1 * * - First day of every month</li></ul><p>Monthly Patterns:</p><ul><li>0 0 0 1 1,4,7,10 * - First day of each quarter</li><li>0 0 0 1 */3 * - First day every 3 months</li><li>0 0 0 1 1,7 * - January 1st and July 1st (semi-annual)</li></ul><h3>Advanced Special Syntax</h3><h3>The L (Last) Operator</h3><p>The L operator represents “last” and has powerful applications:</p><p>Last Day of Month:</p><ul><li>0 0 0 L * * - Last day of every month at midnight</li><li>0 0 23 L * * - Last day of month at 11 PM</li><li>0 0 9 L * * - Last day of month at 9 AM</li></ul><p>Last Weekday of Month:</p><ul><li>0 0 17 * * 5L - Last Friday of month at 5 PM</li><li>0 0 9 * * 1L - Last Monday of month at 9 AM</li><li>0 0 12 * * 3L - Last Wednesday of month at noon</li></ul><p>This is particularly useful for:</p><ul><li>Month-end financial reports</li><li>Last-Friday deployment windows</li><li>End-of-month batch processing</li><li>Payroll on last working day</li></ul><h3>The # (Nth) Operator</h3><p>The # operator specifies the nth occurrence of a weekday:</p><p>Nth Weekday of Month:</p><ul><li>0 0 9 * * 1#1 - First Monday at 9 AM</li><li>0 0 9 * * 1#2 - Second Monday at 9 AM</li><li>0 0 9 * * 2#3 - Third Tuesday at 9 AM</li><li>0 0 14 * * 5#2 - Second Friday at 2 PM</li></ul><p>Common use cases:</p><ul><li>“First Monday” board meetings</li><li>“Second Tuesday” patch updates</li><li>“Third Thursday” training sessions</li><li>“Fourth Friday” team events</li></ul><h3>The W (Weekday) Operator</h3><p>The W operator adjusts to the nearest weekday:</p><p>Nearest Weekday:</p><ul><li>0 0 0 15W * * - Nearest weekday to 15th</li><li>0 0 0 1W * * - Nearest weekday to 1st</li><li>0 0 0 LW * * - Last weekday of month</li></ul><p>Perfect for:</p><ul><li>Payroll (must be weekday)</li><li>Business-day-only operations</li><li>Avoiding weekend deployments</li></ul><h3>Week of Year (WOY) Scheduling</h3><p>One of JCRON’s most powerful features is ISO 8601 week-based scheduling:</p><h3>WOY Syntax</h3><p>Format: pattern WOY:week-spec</p><p>Examples:</p><ul><li>0 0 0 * * * WOY:1 - Week 1 of year (early January)</li><li>0 0 0 * * * WOY:1,2,3 - First 3 weeks of year</li><li>0 0 0 * * * WOY:10,20,30 - Weeks 10, 20, 30</li><li>0 0 0 * * * WOY:52,53 - Last weeks of year</li><li>0 0 0 * * * WOY:1,13,26,39,52 - Quarterly weeks</li></ul><h3>WOY Use Cases</h3><p>Annual Planning:</p><ul><li>Sprint planning in specific weeks</li><li>Quarterly review weeks</li><li>Year-end closing procedures</li></ul><p>Seasonal Operations:</p><ul><li>Summer maintenance (weeks 22–35)</li><li>Holiday preparation (weeks 48–52)</li><li>Tax season processing (weeks 1–16)</li></ul><p>Compliance &amp; Reporting:</p><ul><li>Weekly compliance checks in audit weeks</li><li>Monthly reporting in specific weeks</li><li>Quarterly board meeting weeks</li></ul><p>Project Management:</p><ul><li>Two-week sprint cycles (WOY:1,3,5,7…)</li><li>Monthly milestone reviews</li><li>Phase-based project schedules</li></ul><h3>Timezone Support</h3><p>JCRON includes built-in timezone support, eliminating external timezone conversion:</p><h3>Timezone Syntax</h3><p>Format: TZ:timezone pattern</p><p>Examples:</p><ul><li>TZ:America/New_York 0 0 9 * * 1-5 - New York business hours</li><li>TZ:Europe/London 0 0 0 * * * - London midnight</li><li>TZ:Asia/Tokyo 0 0 17 * * 5 - Tokyo Friday 5 PM</li><li>TZ:UTC 0 0 0 1 * * - UTC first of month</li></ul><h3>Global Operations</h3><p>Multi-Region Scheduling:</p><ul><li>US East Coast office hours: TZ:America/New_York 0 0 9-17 * * 1-5</li><li>European office hours: TZ:Europe/Paris 0 0 9-17 * * 1-5</li><li>Asia-Pacific business hours: TZ:Asia/Singapore 0 0 9-17 * * 1-5</li></ul><p>Follow-the-Sun Support: Different patterns for different regions ensure 24/7 coverage while respecting local business hours.</p><p>Compliance: Execute reports at specific times in regulatory timezones (e.g., UTC for financial markets, local time for GDPR).</p><h3>Period Modifiers (EOD/SOD)</h3><p>JCRON supports end-of-period and start-of-period modifiers:</p><h3>Modifier Syntax</h3><p>End of Period (E):</p><ul><li>E1D - End of day (23:59:59.999)</li><li>E1W - End of week (Sunday 23:59:59.999)</li><li>E1M - End of month (last day 23:59:59.999)</li></ul><p>Start of Period (S):</p><ul><li>S1D - Start of day (00:00:00.000)</li><li>S1W - Start of week (Monday 00:00:00.000)</li><li>S1M - Start of month (1st day 00:00:00.000)</li></ul><h3>Combined Examples</h3><p>With Cron Patterns:</p><ul><li>0 0 0 * * * E1D - Daily at end of day</li><li>0 0 9 * * 1 S1W - Monday 9 AM (start of week)</li><li>0 0 0 L * * E1M - Last moment of last day of month</li><li>0 0 0 1 * * S1M - First moment of first day of month</li></ul><h3>Use Cases</h3><p>Cutoff Times:</p><ul><li>End-of-day batch processing</li><li>Daily cutoff for order processing</li><li>Month-end financial close</li></ul><p>Reporting:</p><ul><li>Start-of-week reports</li><li>Month-end summaries</li><li>Quarter-end statements</li></ul><p>Data Archival:</p><ul><li>End-of-month data snapshots</li><li>Weekly backup at week end</li><li>Daily log rotation</li></ul><h3>Complex Pattern Combinations</h3><p>JCRON’s true power emerges when combining features:</p><h3>Business Operations</h3><p>Quarterly Board Meetings:</p><ul><li>0 0 9 * * 1#2 WOY:13,26,39,52 - Second Monday of quarterly weeks</li></ul><p>Month-End Processing:</p><ul><li>TZ:UTC 0 0 0 L * * E1M - Last moment of month in UTC</li></ul><p>Sprint Planning:</p><ul><li>0 0 10 * * 1 WOY:1,3,5,7,9,11 - Every other week Monday</li></ul><p>Financial Close:</p><ul><li>TZ:America/New_York 0 0 17 LW * * E1D - Last weekday, end of day, EST</li></ul><h3>DevOps &amp; Maintenance</h3><p>Weekly Maintenance:</p><ul><li>0 0 2 * * 0 S1W - Sunday 2 AM at start of week</li></ul><p>Monthly Deployments:</p><ul><li>0 0 20 * * 5#2 - Second Friday 8 PM</li></ul><p>Quarterly Audits:</p><ul><li>0 0 0 1 1,4,7,10 * S1M - First day of quarter</li></ul><p>Year-End Procedures:</p><ul><li>0 0 0 31 12 * WOY:52,53 E1M - Year-end in final weeks</li></ul><h3>Data Management</h3><p>Daily Backups:</p><ul><li>TZ:UTC 0 0 1 * * * E1D - 1 AM UTC end-of-day backup</li></ul><p>Weekly Archival:</p><ul><li>0 0 3 * * 0 E1W - Sunday 3 AM end-of-week archive</li></ul><p>Monthly Retention:</p><ul><li>0 0 0 L * * E1M - Month-end retention policy</li></ul><p>Quarterly Cleanup:</p><ul><li>0 0 4 1 1,4,7,10 * S1M - Quarter-start cleanup</li></ul><h3>Real-World Scheduling Scenarios</h3><h3>Financial Services</h3><p>Trading Hours:</p><ul><li>TZ:America/New_York 0 30 9 * * 1-5 - Market open (9:30 AM EST)</li><li>TZ:America/New_York 0 0 16 * * 1-5 - Market close (4:00 PM EST)</li></ul><p>Settlement Processing:</p><ul><li>TZ:UTC 0 0 22 * * 1-5 - T+2 settlement at 10 PM UTC</li></ul><p>Regulatory Reports:</p><ul><li>TZ:UTC 0 0 0 LW * * E1D - Last business day of month</li></ul><p>Audit Logs:</p><ul><li>TZ:UTC 0 0 0 * * * E1D - Daily audit log at day end</li></ul><h3>E-Commerce</h3><p>Flash Sales:</p><ul><li>TZ:America/Los_Angeles 0 0 9 * * 5 - Friday 9 AM PST flash sale</li></ul><p>Inventory Sync:</p><ul><li>0 */15 * * * * - Every 15 minutes inventory update</li></ul><p>Order Processing:</p><ul><li>0 0 */2 * * * - Every 2 hours order batch</li></ul><p>Price Updates:</p><ul><li>TZ:UTC 0 0 0 * * * - Midnight UTC price updates</li></ul><h3>SaaS Platforms</h3><p>User Notifications:</p><ul><li>TZ:America/New_York 0 0 9 * * 1-5 - Business hours notifications</li></ul><p>Trial Expiration:</p><ul><li>0 0 0 * * * - Daily trial check at midnight</li></ul><p>Subscription Renewal:</p><ul><li>0 0 6 * * * - Early morning renewals (6 AM)</li></ul><p>Usage Metering:</p><ul><li>0 0 * * * * - Hourly usage calculation</li></ul><h3>Data &amp; Analytics</h3><p>ETL Pipelines:</p><ul><li>TZ:UTC 0 0 1 * * * - 1 AM UTC daily ETL</li></ul><p>Report Generation:</p><ul><li>0 0 0 1 * * S1M - Monthly reports on 1st</li></ul><p>Data Warehouse Sync:</p><ul><li>0 0 3 * * 0 - Sunday 3 AM warehouse sync</li></ul><p>Analytics Refresh:</p><ul><li>0 0 */4 * * * - Every 4 hours analytics update</li></ul><h3>DevOps &amp; Infrastructure</h3><p>Health Checks:</p><ul><li>0 */5 * * * * - Every 5 minutes health check</li></ul><p>Log Rotation:</p><ul><li>0 0 0 * * * E1D - Daily log rotation at day end</li></ul><p>Backup Jobs:</p><ul><li>0 0 2 * * * - 2 AM daily backup</li></ul><p>Certificate Renewal:</p><ul><li>0 0 0 25 * * - 25th of month cert check</li></ul><p>Security Scans:</p><ul><li>0 0 3 * * 0 - Sunday 3 AM security scan</li></ul><h3>Performance Characteristics</h3><h3>PostgreSQL Implementation</h3><p>The PostgreSQL port delivers exceptional performance:</p><ul><li>Throughput: 10,000+ patterns per second</li><li>Latency: Sub-0.1ms average response time</li><li>Simple Patterns: 11,435 patterns/sec (0.087ms avg)</li><li>Timezone Patterns: 14,871 patterns/sec (0.067ms avg)</li><li>Success Rate: 97%+ on production workloads</li></ul><p>Optimizations include:</p><ul><li>IMMUTABLE function caching</li><li>PARALLEL SAFE for concurrent execution</li><li>Bitwise operations for field matching</li><li>Compiled pattern caching</li><li>Zero external dependencies</li></ul><h3>Node.js Implementation</h3><p>The Node.js/TypeScript port provides:</p><ul><li>Native async/await support</li><li>Promise-based API</li><li>Event-driven scheduling</li><li>Memory-efficient pattern caching</li><li>TypeScript type safety</li></ul><h3>Go Implementation</h3><p>The Go port offers:</p><ul><li>Goroutine-safe operations</li><li>Zero-allocation hot paths</li><li>Concurrent pattern evaluation</li><li>Native timezone support</li><li>Memory pooling</li></ul><p>All implementations maintain identical behavior and pass the same test suite of 1000+ production-like patterns.</p><h3>Migration from Traditional Cron</h3><h3>Backward Compatibility</h3><p>JCRON is fully backward compatible with standard 5-field cron. Simply add a seconds field:</p><p>Standard Cron → JCRON:</p><ul><li>0 9 * * * → 0 0 9 * * * (add seconds)</li><li>*/15 * * * * → 0 */15 * * * * (add seconds)</li><li>0 0 1 * * → 0 0 0 1 * * (add seconds)</li></ul><h3>Gradual Adoption</h3><ol><li>Phase 1: Add seconds field to existing patterns</li><li>Phase 2: Introduce timezone support where needed</li><li>Phase 3: Leverage special syntax (L, #, W)</li><li>Phase 4: Adopt WOY and period modifiers</li></ol><h3>Testing</h3><p>All JCRON implementations include:</p><ul><li>Comprehensive test suites (1000+ patterns)</li><li>Benchmark tools for performance validation</li><li>Migration utilities</li><li>Validation functions</li></ul><h3>Best Practices</h3><h3>Pattern Design</h3><p>Keep It Simple:</p><ul><li>Start with basic patterns</li><li>Add complexity only when needed</li><li>Document non-obvious patterns</li></ul><p>Test Thoroughly:</p><ul><li>Validate patterns before deployment</li><li>Test edge cases (month boundaries, leap years)</li><li>Verify timezone handling</li></ul><p>Monitor Performance:</p><ul><li>Track pattern evaluation time</li><li>Monitor scheduler overhead</li><li>Alert on missed executions</li></ul><h3>Production Considerations</h3><p>Idempotency:</p><ul><li>Design jobs to be safely re-runnable</li><li>Handle duplicate execution scenarios</li><li>Implement proper locking</li></ul><p>Error Handling:</p><ul><li>Catch and log all exceptions</li><li>Implement retry logic</li><li>Alert on persistent failures</li></ul><p>Observability:</p><ul><li>Log execution times</li><li>Track success/failure rates</li><li>Monitor queue depths</li></ul><p>Resource Management:</p><ul><li>Limit concurrent executions</li><li>Implement backpressure</li><li>Use connection pooling</li></ul><h3>Use Case Matrix</h3><p>ScenarioPattern TypeExampleReal-time monitoringHigh frequency0 */5 * * * *Business hours opsWeekday + timezoneTZ:UTC 0 0 9-17 * * 1-5Month-end processingSpecial syntax0 0 0 L * *Sprint planningWOY0 0 9 * * 1 WOY:1,3,5Compliance reportingComplexTZ:UTC 0 0 0 LW * * E1MGlobal operationsMulti-timezoneTZ:Asia/Tokyo 0 0 9 * * *Seasonal tasksWOY range0 0 0 * * * WOY:22-35Quarterly reviewsCombined0 0 9 * * 1#2 WOY:13,26,39,52</p><h3>Future Roadmap</h3><h3>Planned Features</h3><ul><li>Duration expressions (e.g., “for 2 hours”)</li><li>Exclusion patterns (run except during maintenance)</li><li>Dynamic scheduling (adjust based on load)</li><li>Pattern optimization (automatic simplification)</li><li>Visual pattern builder (web-based tool)</li></ul><h3>Community</h3><p>JCRON is open source and welcomes contributions:</p><ul><li><a href="https://github.com/meftunca/jcron">GitHub repository with active development</a></li><li>Comprehensive documentation</li><li>Example implementations</li><li>Benchmark suites</li><li>Test generators</li></ul><h3>Conclusion</h3><p>JCRON represents the evolution of cron expressions for modern applications. By maintaining backward compatibility while adding powerful enterprise features, it enables sophisticated scheduling scenarios that were previously complex or impossible.</p><p>Whether you’re scheduling financial batch jobs, managing global operations, or orchestrating DevOps workflows, JCRON provides the expressiveness and performance needed for production systems.</p><p>With implementations in PostgreSQL, Node.js, and Go, JCRON integrates seamlessly into any technology stack, bringing consistent scheduling capabilities across your entire infrastructure.</p><p>The combination of intuitive syntax, powerful features, and proven performance makes JCRON the ideal choice for next-generation task scheduling.</p><h3>Getting Started</h3><h3>Resources</h3><ul><li>Documentation: Complete syntax reference and API docs</li><li>Examples: 100+ real-world scheduling patterns</li><li>Benchmarks: Performance testing tools and results</li><li>Migration Guides: Step-by-step migration from traditional cron</li></ul><h3>Implementation Links</h3><ul><li>PostgreSQL: Native SQL functions, 10K+ ops/sec</li><li>Node.js: npm package(@devloops/jcron) with TypeScript support</li><li>Go: High-performance library with zero dependencies</li></ul><h3>Community &amp; Support</h3><ul><li>GitHub repository for issues and contributions</li><li>Comprehensive test suite for validation</li><li>Benchmark tools for performance testing</li><li>Active community support</li></ul><p>Start scheduling smarter with JCRON today.</p><p><em>Version: 4.0 | Last Updated: October 2025</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ba7839118fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write your own nosql database?]]></title>
            <link>https://medium.com/@meftunca/how-to-write-a-nosql-database-d5d40f54e795?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5d40f54e795</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[database-development]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 23:31:29 GMT</pubDate>
            <atom:updated>2022-12-06T22:26:37.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r-tbI4YItMHbZLTYor78TQ.jpeg" /></figure><p>Due to their nature, databases are data control structures that process multiple tasks in a synchronized manner, distribute data into reliable blocks and make them easily accessible. With this explanation, we can determine all the necessary needs in our simple database example and set up the necessary structures.</p><p><strong>What builds are you talking about exactly?</strong></p><p>In our example project, we will create a nosql database. I will tell you the basic requirements of this structure with the following steps. Also, let’s take the firebase firestore project as an example nosql database.</p><p><strong>Steps</strong><br>1. Receive data via websocket or rest-api in accordance with Collection/Document data model<br>2. If the collection specified in the incoming creation request does not exist, create it and then add the data received in the request.<br>3. Create read/write/delete/update actions<br>4. Automatically get the id of the document that belongs to the parent as the main relative in subcollection structures.<br>5. Basically includes time-series index feature and create new index data on user’s request</p><p>In the light of the explanations above, we can determine our basic project structure and the technologies we will use.</p><p>In terms of being a simple project, we will write the project with typescript using either nodejs or bun.sh technologies. And we will do a performance comparison for the two technologies in the future.</p><p><strong>Requirements<br></strong>Nodejs or bun.sh<br>typescript<br>radash</p><pre>curl -fsSL https://bun.sh/install | bash</pre><pre>cd ~/Desktop;<br>mkdir basic_db;<br>cd basic_db;<br>bun init;<br>bun add radash;<br>mkdir -p Data/collections Data/system;<br>touch Data/system/users.json Data/system/permissions.json Data/system/roles.json</pre><p><strong>Directory structure for data blocks</strong></p><p>/Data/collections/{collectionName}<br>/Data/collections/{collectionName}/blocks (all data is naively added here)<br>/Data/collections/{collectionName}/indexes (index files will be in this directory)<br>/Data/collections/{collectionName}/fields.json<br>/Data/collections/{collectionName}/indexing_rules.json<br>/Data/system<br>/Data/users.json (contains the user information that can access the database)<br>/Data/permissions.json (read-only)<br>/Data/roles.json (sets the roles that can be assigned to users)</p><p>Now that we have outlined the project, we can start building the project in the next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5d40f54e795" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#JavaScript Dizi Fonksiyonları [1. Bölüm]]]></title>
            <link>https://medium.com/@meftunca/javascript-dizi-fonksiyonlar%C4%B1-1-b%C3%B6l%C3%BCm-20e997acee03?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/20e997acee03</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[array-methods]]></category>
            <category><![CDATA[arrays]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Fri, 25 Sep 2020 15:30:40 GMT</pubDate>
            <atom:updated>2020-09-25T21:55:22.074Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ZBLdFgXvPnzJLp07fFQQpw@2x.png" /></figure><blockquote><strong><em>Uyarı</em></strong>: <em>Bu yazı öğrenme aşamasındaki kişiler içindir. Kullanılan dil öğrenme aşamasındaki insanların anlaması için basit ve örnekli anlatım içerecektir.</em></blockquote><p><em>Örnek bir </em><strong><em>JavaScript</em></strong><em> dizisi…</em></p><pre>const dizi = [1, 2, 3, 4];<br>// Veya bu şekilde tanımlayabiliriz<br>const dizi = new Array(1,2,3,4)</pre><p>İlk önce diziler nedir ve neden kullanılır sorusunu cevaplayalım. Aslında diziler günlük hayatımızda etrafımızdaki bir çok materyalin yazılımdaki tasviri olarak kullanabileceğiniz bir ifade olabilir.</p><p>Mesela bir kitap, bir dizi tasviri olabilir. Nasıl diye sorarsanız kitap içindeki her yaprak aslında kitap kapağına bağlıdır değil mi ? Dizilerde aynı mantıkla elemanlarını kendi içinde barındırır ve kapsar. Nasıl ki bir kitap içindeki sayfa sayısıyla uzunluğu ölçülüyorsa dizilerde içindeki elemanlarının adeti ile uzunluğu ölçülür.</p><h4>Uzunluğu nasıl alınır?</h4><pre>//Dizilerin uzunluğu .length methodu ile alınır<br>const dizininUzunlugu = dizi.length;</pre><h4>Peki dizinin belli elemanlarını almak için ne yapmalıyız ?</h4><p>Kitap tasviriyle paralel götürebilmek için dizi elemanı almayı sayfayı okumak metaforuna eşitleyelim. Yani dizinin 1. elemanını almak bizim metaforumuzda kitabın ilk sayfasını okumaya eşit olacaktır. Ve <strong><em>JavaScript</em></strong> ile bunu aşağıdaki örnekteki gibi yapıyoruz…</p><pre>const ilkEleman = dizi[0]</pre><p>Evet 1 değil sıfır kullandık. Çünkü bunun sebebi yazılım dillerinde dizi sayma işlemleri 1’den değil 0’dan başlar</p><h4>Peki Dizileri Nasıl filtrelerim ?</h4><p>Tabii ki kitap örneğinden devam ederek sayfanın yırtılabilmesini metafor olarak alalım. Kitabın 5. sayfasını almak için kitabın 5. dalı olan sayfayı yırtarız değil mi ? Dizilerde de aynı işlemi aşağıdaki şekilde yapabiliriz…</p><pre>const ilkElemanıSilinenDizi = dizi.filter(function(eleman,elemaninIndisDegeri){</pre><pre>//ilk dizi elamının indisine eşit değilse<br>return elemaninIndisDegeri !== 0<br>})</pre><p>Bu şekilde dizinin ilk elemanı hariç diğer elemanlarını almış olduk.</p><p>Ve son olarak anlaşılmadıysa *<strong>filter</strong>* fonksiyonunu kitap örneğiyle tasvir edelim. <strong>Filter</strong> fonksiyonu tamamen sizin sayfayı çevirip yırtmak istediğiniz sayfayı aramanızı yazılım tarafında yapan fonksiyon. Nasıl yani diyecek olursanız yırtmak istediğiniz sayfayı bulmak için eliniz ile sayfayı çevirirsiniz değil mi? Aynı mantıkla filter fonksiyonuda tek tek dizinin elemanlarına bakarak *<strong><em>[1,2,3,4]</em></strong>.<strong>filter</strong>(<strong><em>function</em></strong><em>(</em><strong><em>eleman,elemaninIndisDegeri</em></strong><em>){</em><strong><em>return true</em></strong><em>}</em>)* içine yazdığınız fonksiyona baktığı elemanı ve indis değerini vererek return değerinde *<strong>0, null, undefined, false, NaN</strong>* harici değer döndüren sonuçtaki elemanları listeler ve *<strong>0, null, undefined, false, NaN</strong>* dönüşü veren değerleri döndürmez.</p><p>Şimdilik yazıyı burada bırakıyorum ve aynı dilde dizileri ve fonksiyonlarını anlatmamı isterseniz yorum bırakabilirsiniz.</p><p>Anlaşılması için ufak bir not:</p><ul><li><strong>0</strong> değeri sayı sistemlerindende bildiğiniz gibi etkisiz elemandır ve bu yüzden *filter* fonksiyonunda false gibi anlaşılır</li><li><strong>NaN(Not-A-Number) </strong>tipi numeric(sayısal) değerlerin undefined(tanımsız) karşılığı gibi düşünebilirsiniz. Örnek 10*”a” derseniz NaN dönüşü alırsınız. Çünkü Javascript’te sayısal operatörler sadece sayılarda matematik işlemlerini ve string işlemlerinde *+* operatörü ile stringleri birleştirmek için kullanılır. Ne demek bu derseniz *10x10* veya *”a”+”b”* bu iki ifade doğru iken *10+”a”* ifadesi yanlış olur sebebi türlerin aynı olmaması.</li><li><strong>undefined</strong>(<strong>Tanımsız,tanımlanmamış</strong>) genel olarak değişken tipi olmayan ifadelerdir.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20e997acee03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Projeleri #1 Basit Bir Global State Yapımı (Sadece Web)]]></title>
            <link>https://medium.com/@meftunca/react-projeleri-1-basit-bir-global-state-yap%C4%B1m%C4%B1-sadece-web-8d56dd883d9d?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d56dd883d9d</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-state]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[global-state]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Wed, 10 Jul 2019 19:10:29 GMT</pubDate>
            <atom:updated>2019-12-18T14:18:04.111Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*raStsWROxb4-TLEY.png" /></figure><p>Merhaba, bugün <a href="https://mobx.js.org/">mobx</a>, <a href="https://redux.js.org/">redux</a> ve diğer state yönetim kütüphanelerine benzemeyen ve sadece <a href="https://developer.mozilla.org/tr/docs/Web/API/Window">window</a> nesnesi üzerinde çalışan basit bir global state oluşturacağız. <strong><em>Bu yapının hiçbir projede kullanımı veya testleri yapılmamıştır.</em></strong> Sadece öğrenme aşamasında standart yollar yerine yeni yolları kullanabileceğimizi göstermek için yazdım.</p><h4>Projede neler kullanılıyor ?</h4><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">Proxy</a></li><li><a href="https://developer.mozilla.org/tr/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object</a></li></ul><p>İlk önce yapıyı anlamanız için <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">Proxy</a> ve <a href="https://developer.mozilla.org/tr/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object’i</a> <a href="https://developer.mozilla.org/en-US/">developer mozilla</a> veya benzeri sitelerden incelemenizi öneririm.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/385c02f2dd459641913515f5990f72b8/href">https://medium.com/media/385c02f2dd459641913515f5990f72b8/href</a></iframe><p>window.globalStore nesnesine yeni bir özellik ekleyelim. Bu özellik sayesinde nesnenin güncellendiğinde yeni değerleri alacağız</p><p>Basit bir nesne oluşturalım…</p><p><a href="https://developer.mozilla.org/tr/docs/Web/API/Window">window</a> nesnesine globalStore anahtar değeri oluşturup değer olarak yapımızın bel kemiği Proxy ile yapıyı inşa edelim. Burada “get” değeri ile person sınıfındaki değerleri alırken “set” ile person sınıfındaki değerler güncellendiğinde değişen anahtar ve değeri yukarıda oluşturduğumuz “onChangeListener” metoduyla alıyoruz.</p><p>Yukarıda bahsettiğim gibi bu yapı devamlı kullanım için test edilmedi ve eksiği çok. Yapıyı sadece global state için örnek olarak sizlere sunuyorum. Aşağıda çalışan örneğini görebilirsiniz.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fgifted-murdock-8sgjy%3Ffontsize%3D14%26moduleview%3D1&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fgifted-murdock-8sgjy%3Ffontsize%3D14%26moduleview%3D1&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2F8sgjy%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7f3210990edc70915b8498f5f12f6f4/href">https://medium.com/media/c7f3210990edc70915b8498f5f12f6f4/href</a></iframe><blockquote><strong><em>Okuduğunuz için teşekkür ederim :)</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d56dd883d9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JS Sınıf Yapısını anlamak #2 Basit Depolama Sınıfı Yazalım]]></title>
            <link>https://medium.com/@meftunca/js-s%C4%B1n%C4%B1f-yap%C4%B1s%C4%B1n%C4%B1-anlamak-2-basit-depolama-s%C4%B1n%C4%B1f%C4%B1-yazal%C4%B1m-4174764410b7?source=rss-6929ff7b8864------2</link>
            <guid isPermaLink="false">https://medium.com/p/4174764410b7</guid>
            <category><![CDATA[babeljs]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[es6-classes]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[ecmascript-6]]></category>
            <dc:creator><![CDATA[Muhammed Burak Şentürk]]></dc:creator>
            <pubDate>Sun, 07 Jul 2019 14:12:32 GMT</pubDate>
            <atom:updated>2019-07-07T14:13:07.051Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRgqxhl9eY1tiyLTsHEMvw.jpeg" /></figure><p>Başlamadan önce ihtiyaçlarımızı belirleyelim. Aşağıdaki adımları izleyeceğiz.</p><h4>Adımlarımız</h4><ol><li>Oluşturucu fonksiyon ile depolama adını al</li><li>Sınıf içinde erişilebilir nesne oluştur</li><li>Oluşturulan nesneye değer ata ve güncelle</li><li>Oluşturulan nesneye ait değeri sil</li><li>Oluşturulan nesneyi sil</li><li>Önceden oluşturulan tüm nesneleri sil</li></ol><blockquote><strong><em>Oluşturulan yapıyı aşağıdan inceleyip açıklamalara geçebilirsiniz.</em></strong></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fbold-snyder-dzo9u%3Ffrom-embed&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fbold-snyder-dzo9u%3Ffrom-embed&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fdzo9u%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8e5abea43cdbdb9a2fabf48ba569a68/href">https://medium.com/media/b8e5abea43cdbdb9a2fabf48ba569a68/href</a></iframe><h4>Adım 1</h4><pre>constructor(CollectionName = “@collection/” + Date.now()) {</pre><pre>…</pre><pre>}</pre><p>Nedir bu oluşturucu(constructor) methodu derseniz eğer “<strong><em>sınıfın ilk oluşturulma anında sınıf içinde sınıfla ilgili düzenlemelerin yapıldığı sınıf fonksiyonudur</em></strong><em>”</em> diye özetleyebilirim.</p><p><strong>Nasıl çağırılır bu constructor?</strong></p><p>Örnek olarak Test adında bir sınıfımız olsun ve bu sınıfı çağıralım</p><pre>class Test{}</pre><pre>let test = new Test()</pre><p>Sınıfı bu şekilde çağırabilirsiniz ama ön tanımlı bir değer veremezsiniz(hata vermez ama verdiğiniz değer hiçbir işe yaramaz). Şimdi de örnek ile görelim constructor’ı :)</p><pre>class Test{<br>  constructor(ad,soyad){ <br>    console.log(ad,soyad);<br>  }</pre><pre>}</pre><pre>let test = new Test(“Muhammed Burak”,”Şentürk”)</pre><p>Eğer yukarıdaki kodu denerseniz sınıfı çağırdığınız anda benim adım tarayıcının konsolunda gözükecektir.</p><p>Biz tabikide constructor’ı bu basit işler için kullanmayacağız. Kullanacağımız alanlar genelde sınıfla ilgili verileri saklama, ilk eylemleri belirleme veya ön tetikleme yapmak için olabilir.</p><p>Yukarıda yazdığım depolama sınıfında ise kullanım amacı global nesne ve sınıf içindeki nesneyi ayarlamakla görevli. Aşağıdaki kodu ve açıklamaları okursanız yapıyı kolaylıkla anlayabilirsiniz.</p><pre>constructor(CollectionName = &quot;@collection/&quot; + Date.now()) {</pre><pre><em>// database i saracak global nesneyi oluştur veya oluşturulmuşsa kullan</em></pre><pre>  this.globalStorage = window.globalStorage || {};</pre><pre><em><br>/**<br>* Koleksiyon</em></pre><pre><em>* Önceden oluşturulduysa eski değeri ata</em></pre><pre><em>* YADA</em></pre><pre><em>* Oluşturulan global nesneye koleksiyonumuz için ön tanımlı değer ata</em></pre><pre><em>*/</em></pre><pre>  this.globalStorage[CollectionName] =</pre><pre>     this.globalStorage[CollectionName] || {};</pre><pre><em>// koleksiyon adını sakla</em></pre><pre>   this.collectionName = CollectionName;</pre><pre><em>// local kullanım için koleksiyon değeri al</em></pre><pre>   this.collection = this.globalStorage[CollectionName];</pre><pre>}</pre><p>Diğer methodları tek tek açıklamak yerine sizin üzerinde uğraşmanızı öneririm. (üşendim :) ) sadece methodların nasıl kullanılacağını gösterip bu yazıyı burada bitiriyorum.</p><h4><strong>Örnek Kullanımlar</strong></h4><p><strong>Veri Ekleme Veya Önceki Değeri Güncelleme</strong></p><pre>db.set(&quot;ad”, &quot;Muhammed Burak”).save();</pre><h4>Verileri Alma</h4><pre>db.get(“ad”);</pre><h4>Tüm Değerleri Alma</h4><pre>db.getAll();</pre><h4>Tüm Databese’i Alma</h4><pre>db.getGlobalStorage();</pre><h4>Varolan Değeri Silme</h4><pre>db.delete(“ad”).save();</pre><h4>Koleksiyonda Değeri Sorgulama</h4><pre>db.has(“test”);</pre><h4>Tüm Koleksiyonu Temizleme</h4><pre>db.clear().save();</pre><h4>Tüm Database’i Temizleme</h4><pre>db.clearGlobalStorage().save();</pre><p>Gördüğünüz gibi sınıf yapısıyla 58 satırda basit bir database oluşturduk. Evet şimdilik bu kadar yeterli gibi. Bu yapıyı daha fazla geliştirmek size kalmış. Yazının bir sonraki kısmında dekoratörlere giriş yapacağım.</p><blockquote><em>İnsan anlamlandıramadıklarını anlattıkça öğrenir ve ben anlatmayı seviyorum :)</em></blockquote><h4><em>Buraya kadar okuduğunuz için teşekkür ederim :)</em></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4174764410b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>