<script type='text/javascript'>
  /* global google */
  /* global MarkerClusterer */
  // eslint-disable-next-line no-unused-vars
  var jekyllMaps = (function() {
  'use strict'
  var clusterSettings = {}
  var clusterReady = false
  var mapReady = false
  var options = {}
  var data = []
  var maps = []

  return {
    initializeMap: initializeMap,
    initializeCluster: initializeCluster,
    register: register
  }

  /**
   * Setup Google Maps options and call renderer.
   */
  function initializeMap() {
    options = {
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: new google.maps.LatLng(0, 0),
      styles: []
    }
    mapReady = true
    render()
  }

  /**
   * Register map data to be rendered once Google Maps API is loaded.
   *
   * @param string id
   * @param Array locations
   * @param Object settings
   */
  function register(id, locations, options) {
    data.push({ id: id, locations: locations, options: options })
    render()
  }

  /**
   * Render maps data if Google Maps API is loaded.
   */
  function render() {
    if (!mapReady) return

    while (data.length > 0) {
      var item = data.pop()
      var bounds = new google.maps.LatLngBounds()
      var mapOptions = Object.assign({}, options, item.options)
      var map = new google.maps.Map(
        document.getElementById(item.id),
        mapOptions
      )
      var infoWindow = new google.maps.InfoWindow()
      var markers = item.locations.map(createMarker)

      map.fitBounds(bounds)
      google.maps.event.addListenerOnce(map, 'idle', function() {
        if (this.customZoom) this.setZoom(this.customZoom)
      })
      if (mapOptions.useCluster) {
        maps.push({ map: map, markers: markers })
        processCluster()
      }
    }

    function createMarker(location) {
      var position = new google.maps.LatLng(
        location.latitude,
        location.longitude
      )
      bounds.extend(position)
      if (!mapOptions.showMarker) return false

      var marker = new google.maps.Marker({
        position: position,
        title: location.title,
        image: location.image,
        popup_html: location.popup_html,
        icon: location.icon || mapOptions.markerIcon,
        url: markerUrl(mapOptions.baseUrl, location.url),
        url_text: location.url_text,
        map: map
      })
      if (mapOptions.showMarkerPopup) marker.addListener('click', markerPopup)

      return marker
    }

    function markerUrl(baseUrl, url) {
      if (/^(https?|\/\/)/.test(url)) return url

      return url.length > 0 ? baseUrl + url : ''
    }

    function markerPopup() {
      var content = '<div class="map-info-window"><h5>' + this.title + '</h5>'
      if (this.popup_html.length > 0) {
        content += this.popup_html
      }
      else {
        var imageTag =
          this.image.length > 0 &&
          '<img src="' + this.image + '" alt="' + this.title + '"/>'
        if (this.url.length > 0) {
          var linkContent = imageTag || this.url_text || 'View'
          content += '<a href="' + this.url + '">' + linkContent + '</a>'
        } else if (imageTag) {
          content += imageTag
        }
      }
      content += '</div>'
      infoWindow.setContent(content)
      infoWindow.open(map, this)
    }
  }

  function initializeCluster(settings) {
    clusterReady = true
    clusterSettings = settings || {}
    processCluster()
  }

  function processCluster() {
    if (!clusterReady) return

    while (maps.length > 0) {
      var obj = maps.pop()
      // eslint-disable-next-line no-new
      new MarkerClusterer(obj.map, obj.markers, {
        gridSize: clusterSettings.grid_size || 25,
        imagePath:
          'https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/images/m'
      })
    }
  }
  })()
  /* Object.assign polyfill */
  if (typeof Object.assign !== 'function') {
  Object.assign = function(target) {
    'use strict'
    if (target == null) {
      throw new TypeError('Cannot convert undefined or null to object')
    }

    target = Object(target)
    for (var index = 1; index < arguments.length; index++) {
      var source = arguments[index]
      if (source != null) {
        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key]
          }
        }
      }
    }
    return target
  }
  }
</script>
<script type='text/javascript'>
  /* global google */
  /* global MarkerClusterer */
  // eslint-disable-next-line no-unused-vars
  var jekyllMaps = (function() {
  'use strict'
  var clusterSettings = {}
  var clusterReady = false
  var mapReady = false
  var options = {}
  var data = []
  var maps = []

  return {
    initializeMap: initializeMap,
    initializeCluster: initializeCluster,
    register: register
  }

  /**
   * Setup Google Maps options and call renderer.
   */
  function initializeMap() {
    options = {
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: new google.maps.LatLng(0, 0),
      styles: []
    }
    mapReady = true
    render()
  }

  /**
   * Register map data to be rendered once Google Maps API is loaded.
   *
   * @param string id
   * @param Array locations
   * @param Object settings
   */
  function register(id, locations, options) {
    data.push({ id: id, locations: locations, options: options })
    render()
  }

  /**
   * Render maps data if Google Maps API is loaded.
   */
  function render() {
    if (!mapReady) return

    while (data.length > 0) {
      var item = data.pop()
      var bounds = new google.maps.LatLngBounds()
      var mapOptions = Object.assign({}, options, item.options)
      var map = new google.maps.Map(
        document.getElementById(item.id),
        mapOptions
      )
      var infoWindow = new google.maps.InfoWindow()
      var markers = item.locations.map(createMarker)

      map.fitBounds(bounds)
      google.maps.event.addListenerOnce(map, 'idle', function() {
        if (this.customZoom) this.setZoom(this.customZoom)
      })
      if (mapOptions.useCluster) {
        maps.push({ map: map, markers: markers })
        processCluster()
      }
    }

    function createMarker(location) {
      var position = new google.maps.LatLng(
        location.latitude,
        location.longitude
      )
      bounds.extend(position)
      if (!mapOptions.showMarker) return false

      var marker = new google.maps.Marker({
        position: position,
        title: location.title,
        image: location.image,
        popup_html: location.popup_html,
        icon: location.icon || mapOptions.markerIcon,
        url: markerUrl(mapOptions.baseUrl, location.url),
        url_text: location.url_text,
        map: map
      })
      if (mapOptions.showMarkerPopup) marker.addListener('click', markerPopup)

      return marker
    }

    function markerUrl(baseUrl, url) {
      if (/^(https?|\/\/)/.test(url)) return url

      return url.length > 0 ? baseUrl + url : ''
    }

    function markerPopup() {
      var content = '<div class="map-info-window"><h5>' + this.title + '</h5>'
      if (this.popup_html.length > 0) {
        content += this.popup_html
      }
      else {
        var imageTag =
          this.image.length > 0 &&
          '<img src="' + this.image + '" alt="' + this.title + '"/>'
        if (this.url.length > 0) {
          var linkContent = imageTag || this.url_text || 'View'
          content += '<a href="' + this.url + '">' + linkContent + '</a>'
        } else if (imageTag) {
          content += imageTag
        }
      }
      content += '</div>'
      infoWindow.setContent(content)
      infoWindow.open(map, this)
    }
  }

  function initializeCluster(settings) {
    clusterReady = true
    clusterSettings = settings || {}
    processCluster()
  }

  function processCluster() {
    if (!clusterReady) return

    while (maps.length > 0) {
      var obj = maps.pop()
      // eslint-disable-next-line no-new
      new MarkerClusterer(obj.map, obj.markers, {
        gridSize: clusterSettings.grid_size || 25,
        imagePath:
          'https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/images/m'
      })
    }
  }
  })()
  /* Object.assign polyfill */
  if (typeof Object.assign !== 'function') {
  Object.assign = function(target) {
    'use strict'
    if (target == null) {
      throw new TypeError('Cannot convert undefined or null to object')
    }

    target = Object(target)
    for (var index = 1; index < arguments.length; index++) {
      var source = arguments[index]
      if (source != null) {
        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key]
          }
        }
      }
    }
    return target
  }
  }
</script>
<?xml version="1.0" encoding="utf-8"?>
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
      <title>Randomwits - Articles</title>
      <description>Increasing the entropy of the universe</description>
      <link>https://randomwits.com</link>
    <item>
      <title>Cribsheet for Heap data structure</title>
      <description>&lt;p&gt;A quick reference guide for heap data structures, algorithms, and common interview patterns. Covers max/min heaps, heapsort, priority queues, and practical implementations in Java and Python.&lt;!-- truncate_here --&gt;&lt;/p&gt;
        &lt;p&gt;A heap is a specialized tree-based data structure that satisfies the &lt;strong&gt;heap property&lt;/strong&gt;: for every node $i$ other than the root, $A[\text{parent}(i)] \ge A[i]$ (Max-Heap) or $A[\text{parent}(i)] \le A[i]$ (Min-Heap).&lt;/p&gt;
        &lt;h3 id=&quot;core-properties&quot;&gt;Core Properties&lt;/h3&gt;
        &lt;ul&gt;
        &lt;li&gt;&lt;strong&gt;Structure:&lt;/strong&gt; A nearly complete binary tree.&lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;Height:&lt;/strong&gt; A heap of $n$ nodes has height $h = \lfloor \log n \rfloor$.
        &lt;ul&gt;
        &lt;li&gt;&lt;em&gt;Bounds:&lt;/em&gt; $2^h \le n \le 2^{h+1} - 1$.&lt;/li&gt;
        &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;Representation (Array):&lt;/strong&gt; Usually implemented as a 1-indexed array.
        &lt;ul&gt;
        &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Root&lt;/code&gt;: $A[1]$&lt;/li&gt;
        &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Parent(i)&lt;/code&gt;: $\lfloor i/2 \rfloor$&lt;/li&gt;
        &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Left(i)&lt;/code&gt;: $2i$&lt;/li&gt;
        &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Right(i)&lt;/code&gt;: $2i + 1$&lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;Fact:&lt;/strong&gt; The leaves are the nodes indexed by $\lfloor n/2 \rfloor + 1, \dots, n$.&lt;/li&gt;
        &lt;/ul&gt;
        &lt;/li&gt;
        &lt;/ul&gt;
        &lt;h3 id=&quot;key-algorithms&quot;&gt;Key Algorithms&lt;/h3&gt;
        &lt;h4 id=&quot;1-max-heapify-olog-n&quot;&gt;1. Max-Heapify ($O(\log n)$)&lt;/h4&gt;
        &lt;p&gt;Assumes the left and right subtrees of node $i$ are already max-heaps, but $A[i]$ might be smaller than its children. It &quot;bubbles down&quot; $A[i]$ to its correct position.&lt;/p&gt;
        &lt;h4 id=&quot;2-build-max-heap-on&quot;&gt;2. Build-Max-Heap ($O(n)$)&lt;/h4&gt;
        &lt;p&gt;Converts an unordered array into a max-heap by calling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Max-Heapify&lt;/code&gt; on all non-leaf nodes in bottom-up order (from $n/2$ down to $1$).&lt;/p&gt;
        &lt;ul&gt;
        &lt;li&gt;&lt;strong&gt;Why $O(n)$?&lt;/strong&gt; While $O(n \log n)$ is an upper bound, the tight bound is $O(n)$ because most nodes are near the leaves and only travel a small distance. The sum of heights is a convergent series: $\sum_{h=0}^{\lfloor \log n \rfloor} \frac{n}{2^{h+1}} O(h) = O(n)$.&lt;/li&gt;
        &lt;/ul&gt;
        &lt;h4 id=&quot;3-heapsort-on-log-n&quot;&gt;3. Heapsort ($O(n \log n)$)&lt;/h4&gt;
        &lt;ol&gt;
        &lt;li&gt;Build a max-heap from the array.&lt;/li&gt;
        &lt;li&gt;Swap the root (max element) with the last element of the heap.&lt;/li&gt;
        &lt;li&gt;Reduce &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;heapsize&lt;/code&gt; and call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Max-Heapify&lt;/code&gt; on the new root.&lt;/li&gt;
        &lt;li&gt;Repeat until the heap is empty.&lt;/li&gt;
        &lt;/ol&gt;
        &lt;h3 id=&quot;priority-queue-api&quot;&gt;Priority Queue API&lt;/h3&gt;
        &lt;p&gt;A Max-Priority Queue maintains a set $S$ and supports:&lt;/p&gt;
        &lt;ul&gt;
        &lt;li&gt;&lt;strong&gt;Insert(S, x):&lt;/strong&gt; Adds element $x$ ($O(\log n)$).&lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;Maximum(S):&lt;/strong&gt; Returns the max element ($O(1)$).&lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;Extract-Max(S):&lt;/strong&gt; Removes and returns the max element ($O(\log n)$).&lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;Increase-Key(S, x, k):&lt;/strong&gt; Increases $x$&apos;s value to $k$ ($O(\log n)$).&lt;/li&gt;
        &lt;/ul&gt;
        &lt;h3 id=&quot;using-standard-libraries&quot;&gt;Using Standard Libraries&lt;/h3&gt;
        &lt;div class=&quot;tab-container&quot;&gt;
        &lt;ul&gt;
        &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
        &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
        &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
        &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Min Heap (Default)&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;PriorityQueue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;minHeap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;PriorityQueue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// Max Heap&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;PriorityQueue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;maxHeap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;PriorityQueue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Collections&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reverseOrder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// Operations&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;minHeap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;offer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;// Insert - O(log n)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;minHeap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;peek&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;// Maximum - O(1)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;minHeap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;poll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;// Extract-Min - O(log n)&lt;/span&gt;
        &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
        &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;heapq&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# Min Heap (Default)
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;min_heap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;heapq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;heapify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;min_heap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# O(n)
        &lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# Operations
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;heapq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;heappush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;min_heap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Insert - O(log n)
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;heapq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;heappop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;min_heap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;# Extract-Min - O(log n)
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;min_heap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;                    &lt;span class=&quot;c1&quot;&gt;# Minimum - O(1)
        &lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# Max Heap: Use negative values
        &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
        &lt;/div&gt;
        &lt;/div&gt;
        &lt;h3 id=&quot;common-patterns&quot;&gt;Common Patterns&lt;/h3&gt;
        &lt;ol&gt;
        &lt;li&gt;&lt;strong&gt;Top K Elements:&lt;/strong&gt; Use a Min-Heap of size $K$.&lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;Median from Stream:&lt;/strong&gt; Use a Max-Heap (lower half) and a Min-Heap (upper half).&lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;Greedy with Cooldown:&lt;/strong&gt; Use a Max-Heap for the next best item and a Queue for items in cooldown.&lt;/li&gt;
        &lt;/ol&gt;
      </description>
      <pubDate>2026-04-11T00:00:00+00:00</pubDate>
      <link>https://randomwits.com/blog/cribsheet-for-heap</link>
    <guid isPermaLink="true">https://randomwits.com/blog/cribsheet-for-heap</guid>
  </item>
  <item>
    <title>Building and Testing Canton Smart Contracts Locally</title>
    <description>&lt;p&gt;Building on Canton requires fast feedback loops. Testing locally before deploying to a testnet saves time and costs. This guide walks through a complete workflow: create a contract, build it, spin up a sandbox, and verify it works via the JSON API.&lt;!-- truncate_here --&gt;&lt;/p&gt;
      &lt;p&gt;Building on Canton requires fast feedback loops. Testing locally before deploying to a testnet saves time and costs. This guide walks through a complete workflow: create a contract, build it, spin up a sandbox, and verify it works via the JSON API.&lt;/p&gt;
      &lt;h2 id=&quot;step-1-initialize-your-project&quot;&gt;Step 1: Initialize Your Project&lt;/h2&gt;
      &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; testContract
      &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;testContract
      daml init
      &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;p&gt;This creates the boilerplate:&lt;/p&gt;
      &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;testContract/
      ├── daml.yaml         # Project metadata
      └── daml/
      └── Main.daml     # Smart contract code
      &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;h2 id=&quot;step-2-write-a-simple-asset-contract&quot;&gt;Step 2: Write a Simple Asset Contract&lt;/h2&gt;
      &lt;p&gt;Create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;daml/Main.daml&lt;/code&gt;:&lt;/p&gt;
      &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9913b68c100405cd70c77baaa4333f9f.js?file=Main.daml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
      &lt;p&gt;&lt;strong&gt;What this does:&lt;/strong&gt;&lt;/p&gt;
      &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;Template Asset&lt;/strong&gt;: Represents an asset with owner, name, and value&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;signatory owner&lt;/strong&gt;: Only the owner can authorize contract creation&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;choice Transfer&lt;/strong&gt;: Lets the owner transfer the asset to someone else&lt;/li&gt;
      &lt;/ul&gt;
      &lt;h2 id=&quot;step-3-build-the-contract&quot;&gt;Step 3: Build the Contract&lt;/h2&gt;
      &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;daml build
      &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;p&gt;Output:&lt;/p&gt;
      &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2026-04-07 20:17:41.33 [INFO] [build]
      Created .daml/dist/testContract-1.0.0.dar
      &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.dar&lt;/code&gt; file (DAML ARchive) is like a JAR—it bundles your compiled smart contract.&lt;/p&gt;
      &lt;h2 id=&quot;step-4-automate-with-a-makefile&quot;&gt;Step 4: Automate with a Makefile&lt;/h2&gt;
      &lt;p&gt;Create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt; at the project root:&lt;/p&gt;
      &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9913b68c100405cd70c77baaa4333f9f.js?file=Makefile&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
      &lt;h2 id=&quot;step-5-run-the-sandbox&quot;&gt;Step 5: Run the Sandbox&lt;/h2&gt;
      &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make start
      &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;p&gt;This builds your contract and spins up:&lt;/p&gt;
      &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;Ledger API&lt;/strong&gt; on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:6865&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;JSON API&lt;/strong&gt; on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:7575&lt;/code&gt;&lt;/li&gt;
      &lt;/ul&gt;
      &lt;h2 id=&quot;step-6-verify-it-works&quot;&gt;Step 6: Verify It Works&lt;/h2&gt;
      &lt;p&gt;Test the JSON API health check:&lt;/p&gt;
      &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl http://localhost:7575/readyz
      &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;p&gt;Response:&lt;/p&gt;
      &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] ledger ok &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SERVING&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
      readyz check passed
      &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;p&gt;Check the version:&lt;/p&gt;
      &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl http://localhost:7575/v2/version
      &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;p&gt;You&apos;ll get detailed ledger capabilities. If both curl commands succeed, your sandbox is live.&lt;/p&gt;
    </description>
    <pubDate>2026-04-07T00:00:00+00:00</pubDate>
    <link>https://randomwits.com/blog/canton-blockchain-local-setup-makefile</link>
  <guid isPermaLink="true">https://randomwits.com/blog/canton-blockchain-local-setup-makefile</guid>
</item>
<item>
  <title>Fixing Canton Validator OAuth2 Authentication Errors</title>
  <description>&lt;p&gt;Onboarding a &lt;strong&gt;Canton validator&lt;/strong&gt; to &lt;strong&gt;devnet, testnet, or mainnet&lt;/strong&gt; can be challenging. One error that kept me stuck was integrating OAuth2 with the Canton node—specifically, the missing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;access_token&lt;/code&gt; error.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Onboarding a &lt;strong&gt;Canton validator&lt;/strong&gt; to &lt;strong&gt;devnet, testnet, or mainnet&lt;/strong&gt; can be challenging. One error that kept me stuck was integrating OAuth2 with the Canton node—specifically, the missing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;access_token&lt;/code&gt; error.&lt;/p&gt;
    &lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;
    &lt;p&gt;Canton is a privacy-enabled blockchain network. Unlike public blockchains, only authorized parties can read ledger data. To interact with Canton, you deploy a participant node and a validator node.&lt;/p&gt;
    &lt;p&gt;The issue I hit was the validator failing to authenticate with this error:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex1.json&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;the-problem&quot;&gt;The Problem&lt;/h2&gt;
    &lt;p&gt;OAuth2 requires a bearer token in request headers. How you get that token is up to you. We use Okta as our identity provider with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;client_credentials&lt;/code&gt; grant type for machine-to-machine auth.&lt;/p&gt;
    &lt;p&gt;First, verify you can get a token from your OAuth provider:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex2.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Get these values from your Okta admin. You should see a response like:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex3.json&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;the-fix&quot;&gt;The Fix&lt;/h2&gt;
    &lt;h3 id=&quot;1-extract-the-sub-field&quot;&gt;1. Extract the Sub Field&lt;/h3&gt;
    &lt;p&gt;The JWT contains a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sub&lt;/code&gt; (subject) claim that identifies the client. Canton needs this for authentication. Decode the token:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex4.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;You&apos;ll see something like:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex5.json&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sub&lt;/code&gt; value in your validator&apos;s Kubernetes configuration:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex6.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;2-add-default-scope&quot;&gt;2. Add Default Scope&lt;/h3&gt;
    &lt;p&gt;This was the missing piece. Canton&apos;s OAuth client needs the scope explicitly configured:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex7.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Here&apos;s the full configuration in context:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex8.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;3-grant-user-rights&quot;&gt;3. Grant User Rights&lt;/h3&gt;
    &lt;p&gt;After the validator is onboarded, grant it ledger access rights via the Canton Ledger API:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;POST /v2/users/&amp;lt;SUB_FIELD&amp;gt;/rights
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Request body:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca7aaa51d77717ebcb835eeb87abe8a6.js?file=ex9.json&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2026-03-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/canton-validator-oauth2-authentication-error-fix</link>
<guid isPermaLink="true">https://randomwits.com/blog/canton-validator-oauth2-authentication-error-fix</guid>
</item>
<item>
  <title>Handling Kafka Poison Pills in Reactive Spring Boot Applications</title>
  <description>&lt;p&gt;A single malformed Kafka message can silently halt your entire consumer group. If you&apos;ve ever been paged at 2 AM because messages stopped processing and your consumer lag was climbing, there&apos;s a good chance you were dealing with a poison pill. Here&apos;s how to handle it in a reactive Spring Boot application.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;A single malformed Kafka message can silently halt your entire consumer group. If you&apos;ve ever been paged at 2 AM because messages stopped processing and your consumer lag was climbing, there&apos;s a good chance you were dealing with a poison pill. Here&apos;s how to handle it in a reactive Spring Boot application.&lt;/p&gt;
    &lt;h2 id=&quot;whats-a-kafka-poison-pill&quot;&gt;What&apos;s a Kafka Poison Pill?&lt;/h2&gt;
    &lt;p&gt;A poison pill is a message that a consumer can never successfully process. The most common cause is a &lt;strong&gt;deserialization failure&lt;/strong&gt; — a producer sends malformed JSON, an incompatible schema version, or raw bytes where structured data was expected.&lt;/p&gt;
    &lt;p&gt;Here&apos;s what makes it deadly: Kafka&apos;s offset commit model means a consumer won&apos;t advance past a message it can&apos;t process. The deserializer throws an exception &lt;strong&gt;before&lt;/strong&gt; the reactive stream even starts, so your reactive error handlers (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doOnError&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;onErrorResume&lt;/code&gt;) never trigger. The consumer re-fetches the same broken message indefinitely, blocking every subsequent message in that partition. Consumer lag climbs, alerts fire, and your pipeline is effectively dead.&lt;/p&gt;
    &lt;h2 id=&quot;project-setup&quot;&gt;Project Setup&lt;/h2&gt;
    &lt;p&gt;Let&apos;s understand this by creating a simple Spring Boot application from &lt;a href=&quot;https://start.spring.io/&quot;&gt;Spring Initializr&lt;/a&gt;.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7587b587e54e745365eb89f31b45cc76.js?file=build.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;model-the-kafka-message&quot;&gt;Model the Kafka Message&lt;/h2&gt;
    &lt;p&gt;Create a &lt;strong&gt;KafkaMessage&lt;/strong&gt; record that we will be receiving from Kafka:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7587b587e54e745365eb89f31b45cc76.js?file=KafkaMessage.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Next, define the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application.yaml&lt;/code&gt; configuration for Kafka:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7587b587e54e745365eb89f31b45cc76.js?file=application.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We need two additional profile-specific YAML files. First, create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application-basic.yaml&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7587b587e54e745365eb89f31b45cc76.js?file=application-basic.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Next, create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application-errorhandling.yaml&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7587b587e54e745365eb89f31b45cc76.js?file=application-errorhandling.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;kafka-configuration&quot;&gt;Kafka Configuration&lt;/h2&gt;
    &lt;p&gt;Create a configuration class to set up the Kafka receiver options:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7587b587e54e745365eb89f31b45cc76.js?file=KafkaConfig.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;basic-consumer-service-demonstrates-the-problem&quot;&gt;Basic Consumer Service (Demonstrates the Problem)&lt;/h2&gt;
    &lt;p&gt;First, let&apos;s create a consumer service for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;basic&lt;/code&gt; profile that demonstrates the poison pill problem:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7587b587e54e745365eb89f31b45cc76.js?file=KafkaService.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;consumer-service-with-error-handling-the-solution&quot;&gt;Consumer Service with Error Handling (The Solution)&lt;/h2&gt;
    &lt;p&gt;Now let&apos;s create the solution that properly handles poison pills:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7587b587e54e745365eb89f31b45cc76.js?file=KafkaServiceWithErrorHandling.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;testing-the-basic-profile-problem-demonstration&quot;&gt;Testing the Basic Profile (Problem Demonstration)&lt;/h2&gt;
    &lt;p&gt;First, let&apos;s start the application with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;basic&lt;/code&gt; profile to see the poison pill problem in action:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./gradlew bootRun &lt;span class=&quot;nt&quot;&gt;--args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;--spring.profiles.active=basic&apos;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Send a valid JSON message:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{&quot;message&quot;: &quot;Hello World&quot;, &quot;id&quot;: 1}&apos;&lt;/span&gt; | &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; localhost:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; test-topic
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The message is processed successfully. Now send a malformed JSON with a trailing comma:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{&quot;message&quot;: &quot;Hello World&quot;, &quot;id&quot;: 2,}&apos;&lt;/span&gt; | &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; localhost:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; test-topic
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You&apos;ll see an error like this:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tools.jackson.core.exc.StreamReadException: Unexpected character (&apos;}&apos; (code 125)):
    was expecting double-quote to start property name
    at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled);
    byte offset: #UNKNOWN]
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;The critical issue&lt;/strong&gt;: try sending another valid message:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{&quot;message&quot;: &quot;Hello World&quot;, &quot;id&quot;: 3}&apos;&lt;/span&gt; | &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; localhost:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; test-topic
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;The consumer is now stuck&lt;/strong&gt;. This valid message won&apos;t be processed because the consumer keeps retrying the poison pill at offset 2. Your consumer lag will start climbing, and no subsequent messages will be consumed.&lt;/p&gt;
    &lt;h2 id=&quot;testing-with-error-handling-the-solution&quot;&gt;Testing with Error Handling (The Solution)&lt;/h2&gt;
    &lt;p&gt;Now let&apos;s test the solution. Restart the application with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;errorhandling&lt;/code&gt; profile:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./gradlew bootRun &lt;span class=&quot;nt&quot;&gt;--args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;--spring.profiles.active=errorhandling&apos;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Send the same malformed message:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{&quot;message&quot;: &quot;Hello World&quot;, &quot;id&quot;: 2,}&apos;&lt;/span&gt; | &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; localhost:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; test-topic
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This time, you&apos;ll see the error handler in action:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2026-02-28T17:51:55.716-05:00 ERROR 61935 --- [poisonPill] [on-pill-demo-1]
    c.e.p.s.KafkaServiceWithErrorHandling : POISON PILL detected at offset 2,
    partition 0: Unexpected character (&apos;}&apos; (code 125)): was expecting double-quote
    to start property name
    2026-02-28T17:51:55.716-05:00 ERROR 61935 --- [poisonPill] [on-pill-demo-1]
    c.e.p.s.KafkaServiceWithErrorHandling : Raw message: {&quot;message&quot;: &quot;Hello World&quot;, &quot;id&quot;: 2,}
    2026-02-28T17:51:55.716-05:00  INFO 61935 --- [poisonPill] [on-pill-demo-1]
    c.e.p.s.KafkaServiceWithErrorHandling : Skipping poison pill and continuing...
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Send valid messages after the poison pill:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{&quot;message&quot;: &quot;Hello World&quot;, &quot;id&quot;: 3}&apos;&lt;/span&gt; | &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; localhost:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; test-topic
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{&quot;message&quot;: &quot;Hello World&quot;, &quot;id&quot;: 4}&apos;&lt;/span&gt; | &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; localhost:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; test-topic
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{&quot;message&quot;: &quot;Hello World&quot;, &quot;id&quot;: 5}&apos;&lt;/span&gt; | &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; localhost:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; test-topic
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Success!&lt;/strong&gt; All subsequent messages are processed normally:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2026-02-28T17:51:55.716-05:00  INFO 61935 --- [poisonPill] [on-pill-demo-1]
    c.e.p.s.KafkaServiceWithErrorHandling : Received: key=null, message=Hello World, id=3
    2026-02-28T17:51:55.716-05:00  INFO 61935 --- [poisonPill] [on-pill-demo-1]
    c.e.p.s.KafkaServiceWithErrorHandling : Received: key=null, message=Hello World, id=4
    2026-02-28T17:51:55.716-05:00  INFO 61935 --- [poisonPill] [on-pill-demo-1]
    c.e.p.s.KafkaServiceWithErrorHandling : Received: key=null, message=Hello World, id=5
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;key-takeaways&quot;&gt;Key Takeaways&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Reactive error handlers only catch errors inside the stream&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doOnError()&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;onErrorResume()&lt;/code&gt; won&apos;t catch deserialization failures that occur before the reactive stream starts.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The solution: manual deserialization&lt;/strong&gt;: By using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StringDeserializer&lt;/code&gt; and deserializing manually within the reactive stream, you can catch and handle deserialization errors gracefully.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Always acknowledge the offset&lt;/strong&gt;: Even when skipping poison pills, remember to acknowledge the offset so the consumer can move forward.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Production considerations&lt;/strong&gt;: In production, you might want to:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Send poison pills to a dead-letter queue for later analysis&lt;/li&gt;
    &lt;li&gt;Add metrics to track poison pill frequency&lt;/li&gt;
    &lt;li&gt;Alert when poison pills are detected&lt;/li&gt;
    &lt;li&gt;Implement a retry mechanism with exponential backoff for transient errors&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
  </description>
  <pubDate>2026-02-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/handling-kafka-poison-pills-reactive-spring-boot-applications</link>
<guid isPermaLink="true">https://randomwits.com/blog/handling-kafka-poison-pills-reactive-spring-boot-applications</guid>
</item>
<item>
  <title>Monkey Patching Claude commit for AWS Bedrock</title>
  <description>&lt;p&gt;When AI is writing code, there&apos;s no reason not to have AI write the commit message too. I tried the handy tool &lt;a href=&quot;https://github.com/JohannLai/claude-commit&quot;&gt;claude-commit&lt;/a&gt;, but ran into two issues when using Claude via AWS Bedrock on Python 3.14: a compatibility error with Rich&apos;s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Console.print()&lt;/code&gt; and missing Bedrock credentials.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When AI is writing code, there&apos;s no reason not to have AI write the commit message too. I tried the handy tool &lt;a href=&quot;https://github.com/JohannLai/claude-commit&quot;&gt;claude-commit&lt;/a&gt;, but ran into two issues when using Claude via AWS Bedrock on Python 3.14: a compatibility error with Rich&apos;s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Console.print()&lt;/code&gt; and missing Bedrock credentials.&lt;/p&gt;
    &lt;h2 id=&quot;initial-installation&quot;&gt;Initial Installation&lt;/h2&gt;
    &lt;p&gt;First, install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-commit&lt;/code&gt; using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pipx&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pipx &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;claude-commit
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;problems-encountered&quot;&gt;Problems Encountered&lt;/h2&gt;
    &lt;h3 id=&quot;1-typeerror-with-consoleprint&quot;&gt;1. TypeError with Console.print()&lt;/h3&gt;
    &lt;p&gt;When running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-commit&lt;/code&gt; you may see this error:&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;TypeError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;got&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;an&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unexpected&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;keyword&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;argument&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Root cause&lt;/strong&gt;: Python 3.14 compatibility issue with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rich&lt;/code&gt; library&apos;s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Console.print()&lt;/code&gt; method. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;file&lt;/code&gt; parameter is no longer supported in newer versions.&lt;/p&gt;
    &lt;h3 id=&quot;2-authentication-issues&quot;&gt;2. Authentication Issues&lt;/h3&gt;
    &lt;p&gt;Even after fixing the TypeError, authentication fails because &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-commit&lt;/code&gt; doesn&apos;t automatically pick up AWS Bedrock credentials from Claude Code&apos;s configuration file (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.claude/settings.json&lt;/code&gt;).&lt;/p&gt;
    &lt;h2 id=&quot;the-solution-creating-a-patched-wrapper&quot;&gt;The Solution: Creating a Patched Wrapper&lt;/h2&gt;
    &lt;p&gt;Create a a monkey-patched wrapper script that fixes both issues.&lt;/p&gt;
    &lt;h3 id=&quot;step-1-create-the-wrapper-script&quot;&gt;Step 1: Create the Wrapper Script&lt;/h3&gt;
    &lt;p&gt;Create a file at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.local/bin/claude-commit-patch&lt;/code&gt; with the following content.
    The script does two things: load environment variables from your Claude Code settings and monkey-patch &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rich.Console.print&lt;/code&gt; to drop the unsupported &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;file&lt;/code&gt; argument.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7ef971334d27308e5299add3bd74d9ab.js?file=monkey-patch.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Shebang notes&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;If you want the wrapper to use the exact &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pipx&lt;/code&gt; virtualenv Python, use the absolute path to that Python as the shebang (example below). This is the most reliable way to ensure the wrapper runs with the same environment that installed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-commit&lt;/code&gt;.&lt;/li&gt;
    &lt;li&gt;For portability, you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#!/usr/bin/env python3&lt;/code&gt; — it will pick the first &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python3&lt;/code&gt; on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PATH&lt;/code&gt;. Make sure that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python3&lt;/code&gt; is the one that has access to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-commit&lt;/code&gt; and its dependencies.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Find the pipx venv python with:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; ~/.local/pipx/venvs/claude-commit/bin/python
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Example shebang options:&lt;/p&gt;
    &lt;p&gt;Absolute (reliable):&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#!/Users/youruser/.local/pipx/venvs/claude-commit/bin/python
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Portable (uses PATH):&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env python3
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; ~/.local/pipx/venvs/claude-commit/bin/python
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;step-2-make-it-executable&quot;&gt;Step 2: Make It Executable&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x ~/.local/bin/claude-commit-patch
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;step-3-update-git-configuration&quot;&gt;Step 3: Update Git Configuration&lt;/h3&gt;
    &lt;p&gt;Add convenient aliases to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.gitconfig&lt;/code&gt; (adjust paths for your home):&lt;/p&gt;
    &lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;[alias]&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;claude&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;!/Users/tushar/.local/bin/claude-commit-patch&quot;&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;claude-auto&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;!/Users/tushar/.local/bin/claude-commit-patch --commit&quot;&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;claude-all&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;!/Users/tushar/.local/bin/claude-commit-patch --all&quot;&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;claude-copy&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;!/Users/tushar/.local/bin/claude-commit-patch --copy&quot;&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;cc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;!/Users/tushar/.local/bin/claude-commit-patch --commit&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Update the path to match your home directory.&lt;/p&gt;
    &lt;h2 id=&quot;how-it-works&quot;&gt;How It Works&lt;/h2&gt;
    &lt;p&gt;What the wrapper does&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Loads AWS Bedrock credentials from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.claude/settings.json&lt;/code&gt; and sets them in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;os.environ&lt;/code&gt; so &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-commit&lt;/code&gt; can authenticate with Bedrock.&lt;/li&gt;
    &lt;li&gt;Monkey-patches &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rich.Console.print()&lt;/code&gt; to remove the unsupported &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;file&lt;/code&gt; kwarg that causes a TypeError on Python 3.14.&lt;/li&gt;
    &lt;li&gt;Imports and runs &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;claude-commit&lt;/code&gt; from the environment the script is executed in.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;
    &lt;p&gt;With &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alias g=&apos;git&apos;&lt;/code&gt; in your shell (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.zshrc&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.bashrc&lt;/code&gt;):&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Preview commit message&lt;/span&gt;
    g claude
    &lt;span class=&quot;c&quot;&gt;# Auto-commit with AI-generated message&lt;/span&gt;
    g cc
    &lt;span class=&quot;c&quot;&gt;# Include all untracked files&lt;/span&gt;
    g claude-all
    &lt;span class=&quot;c&quot;&gt;# Copy message to clipboard (no commit)&lt;/span&gt;
    g claude-copy
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Or run directly:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;claude-commit-patch
    claude-commit-patch &lt;span class=&quot;nt&quot;&gt;--commit&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;verification&quot;&gt;Verification&lt;/h2&gt;
    &lt;p&gt;Test that it works:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /path/to/your/repo
    claude-commit-patch
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Expected output (example):&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Claude is analyzing your changes...
    ✨ Analysis complete!
    ╭─── 📝 Generated Commit Message ───╮
    │                                   │
    │  your commit message here         │
    │                                   │
    ╰───────────────────────────────────╯
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;/h2&gt;
    &lt;h3 id=&quot;troubleshooting-1&quot;&gt;Troubleshooting&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;Script location: ensure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.local/bin&lt;/code&gt; (or wherever you put it) is in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PATH&lt;/code&gt;:
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;which claude-commit-patch
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;/li&gt;
    &lt;li&gt;Shebang: confirm the first line of the script is the interpreter you expect:
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt; ~/.local/bin/claude-commit-patch
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;/li&gt;
    &lt;li&gt;AWS/BEDROCK env: ensure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.claude/settings.json&lt;/code&gt; includes an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;env&lt;/code&gt; object, for example:
    &lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;env&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;CLAUDE_CODE_USE_BEDROCK&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;AWS_REGION&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;us-east-1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;AWS_PROFILE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;default&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2026-02-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/use-claude-commit-with-aws-bedrock</link>
<guid isPermaLink="true">https://randomwits.com/blog/use-claude-commit-with-aws-bedrock</guid>
</item>
<item>
  <title>Setting up Claude Code with AWS Bedrock and SSO Authentication</title>
  <description>&lt;p&gt;Install Claude Code quickly and configure it with SSO and AWS Bedrock.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Install Claude Code quickly and configure it with SSO and AWS Bedrock.&lt;/p&gt;
    &lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h2&gt;
    &lt;p&gt;Before starting, ensure you have:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;AWS CLI installed and configured&lt;/li&gt;
    &lt;li&gt;Node.js (version 16 or higher)&lt;/li&gt;
    &lt;li&gt;An AWS account with Bedrock access&lt;/li&gt;
    &lt;li&gt;Access to your organization&apos;s SSO/Okta configuration&lt;/li&gt;
    &lt;li&gt;Appropriate permissions to invoke Claude models in Bedrock&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
    &lt;p&gt;Install Claude Code using the official installation script:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://claude.ai/install.sh | bash
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;After installation, verify it&apos;s working by running:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;claude &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;
    &lt;p&gt;Create a configuration file at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.claude/settings.json&lt;/code&gt; to customize Claude Code&apos;s behavior:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/174307115d1e04e103acde93bd56ffb3.js?file=settings.json&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;configuration-options-explained&quot;&gt;Configuration Options Explained&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;CLAUDE_CODE_USE_BEDROCK&lt;/strong&gt;: Enables AWS Bedrock as the model provider&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;AWS_REGION&lt;/strong&gt;: Specifies the AWS region for Bedrock API calls (ensure your chosen models are available in this region)&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;CLAUDE_CODE_ENABLE_TELEMETRY&lt;/strong&gt;: Disables telemetry collection for privacy&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;ANTHROPIC_MODEL&lt;/strong&gt;: The primary Claude model ID as it appears in AWS Bedrock&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;ANTHROPIC_SMALL_FAST_MODEL&lt;/strong&gt;: A faster Haiku model for quick operations and lightweight tasks&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;AWS_PROFILE&lt;/strong&gt;: The AWS profile to use for authentication (typically &quot;default&quot;)&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;CLAUDE_CODE_MAX_OUTPUT_TOKENS&lt;/strong&gt;: Sets maximum tokens for model responses&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;MAX_THINKING_TOKENS&lt;/strong&gt;: Limits tokens used for internal reasoning&lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;: When using Bedrock, you must use the exact model IDs as they appear in your AWS Bedrock console. Model availability varies by AWS region and account permissions. Verify these models are accessible in your AWS account before using them.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;sso-authentication-setup&quot;&gt;SSO Authentication Setup&lt;/h2&gt;
    &lt;p&gt;For enterprise environments using SSO (like Okta), you&apos;ll need to authenticate to get temporary AWS credentials. Use a command similar to this, replacing the placeholders with your organization&apos;s specific values:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/174307115d1e04e103acde93bd56ffb3.js?file=okta.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Replace &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;your-org.okta.com&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;YOUR_OIDC_CLIENT_ID&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;YOUR_AWS_FEDERATION_APP_ID&lt;/code&gt; with your organization&apos;s actual values. Contact your IT administrator if you don&apos;t have these details.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--session-duration 36000&lt;/code&gt; parameter sets the session to last for 10 hours, reducing the need for frequent re-authentication.&lt;/p&gt;
    &lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;
    &lt;p&gt;Once configured and authenticated, start Claude Code by simply running:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;claude
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will open an interactive session where you can chat with Claude, execute code, and perform various development tasks.&lt;/p&gt;
    &lt;h2 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;/h2&gt;
    &lt;h3 id=&quot;self-signed-certificate-issues&quot;&gt;Self-Signed Certificate Issues&lt;/h3&gt;
    &lt;p&gt;If you encounter SSL certificate errors like:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;platform.claude.com: SELF_SIGNED_CERT_IN_CHAIN
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This typically occurs in corporate environments with SSL inspection. You can temporarily bypass this by setting:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NODE_TLS_REJECT_UNAUTHORIZED&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&lt;strong&gt;Security Warning&lt;/strong&gt;: Only use this workaround in trusted corporate environments. It disables SSL certificate verification and should not be used in production or untrusted networks.&lt;/p&gt;
    &lt;/blockquote&gt;
  </description>
  <pubDate>2026-01-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/setup-claud-code-aws-bedrock-sso-auth</link>
<guid isPermaLink="true">https://randomwits.com/blog/setup-claud-code-aws-bedrock-sso-auth</guid>
</item>
<item>
  <title>Exposing Canton Ledger API via Spring Cloud Gateway</title>
  <description>&lt;p&gt;Exposing the Canton Ledger API from Kubernetes Pods Using Spring Cloud Gateway. &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Exposing the Canton Ledger API from Kubernetes Pods Using Spring Cloud Gateway.&lt;/p&gt;
    &lt;h2 id=&quot;the-problem&quot;&gt;The Problem&lt;/h2&gt;
    &lt;p&gt;The Canton Ledger API (also known as the JSON API) provides a RESTful interface to interact with the Canton distributed ledger. By default, it runs on port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;7575&lt;/code&gt; inside the pod.&lt;/p&gt;
    &lt;p&gt;You can verify it&apos;s working by executing a shell into the pod and running:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5ed82057f90f950fbf4aa5b9c3f2e031.js?file=curl.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This returns a JSON response with version and feature information:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5ed82057f90f950fbf4aa5b9c3f2e031.js?file=payload.json&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;the-challenge-accessing-the-service-externally&quot;&gt;The Challenge: Accessing the Service Externally&lt;/h2&gt;
    &lt;p&gt;How do you access this service from outside the pod? There are two main approaches:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Expose port 7575 directly&lt;/strong&gt; - This is often not feasible because most non-standard ports are blocked for security reasons.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Use Spring Cloud Gateway&lt;/strong&gt; - Route traffic through the gateway on port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;8080&lt;/code&gt;, which is typically already exposed.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;The second approach is more secure and flexible, so let&apos;s implement that.&lt;/p&gt;
    &lt;h2 id=&quot;solution-configure-spring-cloud-gateway&quot;&gt;Solution: Configure Spring Cloud Gateway&lt;/h2&gt;
    &lt;p&gt;Add the following route configuration to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scg.yaml&lt;/code&gt; file:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5ed82057f90f950fbf4aa5b9c3f2e031.js?file=scg.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;understanding-the-configuration&quot;&gt;Understanding the Configuration&lt;/h3&gt;
    &lt;p&gt;Let&apos;s break down each part:&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Property&lt;/th&gt;
    &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;A unique identifier for this route&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uri&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;The internal Kubernetes service URL where the JSON API is running (see note below)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;predicates&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;Conditions that must match for the route to be used. Here, any request starting with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/json-api/&lt;/code&gt; will match&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;filters&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;Transformations applied to the request. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewritePath&lt;/code&gt; removes the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/json-api&lt;/code&gt; prefix before forwarding&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&lt;strong&gt;What is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;svc.cluster.local&lt;/code&gt;?&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Kubernetes provides built-in DNS for service discovery. Every service gets a DNS name following the pattern:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;service-name&amp;gt;.&amp;lt;namespace&amp;gt;.svc.cluster.local
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;svc&lt;/code&gt; indicates this is a Service resource&lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cluster.local&lt;/code&gt; is the default cluster domain&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;This allows pods to communicate with services by name without hardcoding IP addresses. The DNS is only resolvable from within the Kubernetes cluster.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h3 id=&quot;how-it-works&quot;&gt;How It Works&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;A request comes in to the gateway: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET /json-api/v2/version&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;The predicate matches because the path starts with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/json-api/&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RewritePath&lt;/code&gt; filter transforms &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/json-api/v2/version&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/v2/version&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;The gateway forwards the request to the internal service on port 7575&lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;testing-the-route&quot;&gt;Testing the Route&lt;/h3&gt;
    &lt;p&gt;After deploying the configuration, you can access the JSON API through the gateway:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5ed82057f90f950fbf4aa5b9c3f2e031.js?file=curl2.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This will return the same version information as before, but now accessible from outside the pod.&lt;/p&gt;
  </description>
  <pubDate>2026-01-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/exposing-canton-ledger-api-spring-gateway</link>
<guid isPermaLink="true">https://randomwits.com/blog/exposing-canton-ledger-api-spring-gateway</guid>
</item>
<item>
  <title>Calling Stored Procedure in Spring using jdbc vs r2dbc</title>
  <description>&lt;p&gt;Calling stored procedures from Spring Boot? You have two paths: JDBC (blocking) or R2DBC (reactive).&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Calling stored procedures from Spring Boot? You have two paths: JDBC (blocking) or R2DBC (reactive).&lt;/p&gt;
    &lt;h2 id=&quot;whats-a-stored-procedure&quot;&gt;What&apos;s a stored procedure&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;it&apos;s a sql code that&apos;s saved and executed on database server&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;it&apos;s like a resuable function that has business logic&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;can accept input parameter, produce output parameters&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;e.g.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=store.sql&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;the-two-paths-jdbc-vs-r2dbc&quot;&gt;The Two Paths: JDBC vs R2DBC&lt;/h2&gt;
    &lt;p&gt;There are two distinct stacks for database access in Java:&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt; &lt;/th&gt;
    &lt;th&gt;**JDBC (Blocking)**&lt;/th&gt;
    &lt;th&gt;**R2DBC (Reactive)**&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**Driver**&lt;/td&gt;
    &lt;td&gt;JDBC Driver&lt;/td&gt;
    &lt;td&gt;R2DBC Driver&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Connection**&lt;/td&gt;
    &lt;td&gt;DataSource&lt;/td&gt;
    &lt;td&gt;ConnectionFactory&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Client API**&lt;/td&gt;
    &lt;td&gt;JdbcTemplate, SimpleJdbcCall&lt;/td&gt;
    &lt;td&gt;DatabaseClient&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**ORM**&lt;/td&gt;
    &lt;td&gt;Spring Data JPA&lt;/td&gt;
    &lt;td&gt;Spring Data R2DBC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Annotation**&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Query&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;&lt;strong&gt;Key insight&lt;/strong&gt;: These are separate stacks. You can&apos;t mix them - &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JdbcTemplate&lt;/code&gt; only works with JDBC drivers, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatabaseClient&lt;/code&gt; only works with R2DBC drivers.&lt;/p&gt;
    &lt;div style=&quot;text-align: center;&quot;&gt;
    &lt;img class=&quot;plantuml&quot; src=&quot;http://www.plantuml.com/plantuml/svg/~h407374617274756d6c0a736b696e706172616d206261636b67726f756e64436f6c6f72207472616e73706172656e740a736b696e706172616d2064656661756c74466f6e744e616d6520417269616c0a736b696e706172616d2072656374616e676c65207b0a20202020526f756e64436f726e65722031300a20202020426f72646572436f6c6f7220233535353535350a7d0a0a646174616261736520222a2a44415441424153452a2a2220617320646220233338384533430a72656374616e676c6520222a2a50726f746f636f6c2a2a5c6e506f73746772657320576972652050726f746f636f6c222061732070726f746f636f6c20233443414635300a0a72656374616e676c6520222a2a4a444243204472697665722a2a5c6e28426c6f636b696e672922206173206a64626320233145383845350a72656374616e676c6520222a2a5232444243204472697665722a2a5c6e285265616374697665292220617320723264626320234642384330300a0a72656374616e676c6520222a2a44617461536f757263652a2a5c6e48696b6172694350202f204472697665724d616e616765722220617320647320233432413546350a72656374616e676c6520222a2a436f6e6e656374696f6e466163746f72792a2a5c6e523244424320506f6f6c2220617320636620234646413732360a0a72656374616e676c6520222a2a4a64626354656d706c6174652a2a5c6e53696d706c654a64626343616c6c22206173206a7420233634423546360a72656374616e676c6520222a2a4461746162617365436c69656e742a2a2220617320646320234646423734440a0a72656374616e676c6520222a2a4a5041202f2048696265726e6174652a2a5c6e2846756c6c204f524d29222061732068696265726e61746520233135363543300a72656374616e676c6520222a2a4261736963204d617070696e672a2a5c6e284e6f204f524d29222061732062617369634d617070696e6720234635374330300a0a72656374616e676c6520222a2a537072696e672044617461204a50412a2a5c6e4050726f63656475726522206173206a706120233930434146390a72656374616e676c6520222a2a537072696e6720446174612052324442432a2a5c6e405175657279222061732072326462635265706f20234646434338300a0a6462202d646f776e2d3e2070726f746f636f6c0a70726f746f636f6c202d646f776e2d3e206a6462630a70726f746f636f6c202d646f776e2d3e2072326462630a6a646263202d646f776e2d3e2064730a7232646263202d646f776e2d3e2063660a6473202d646f776e2d3e206a740a6366202d646f776e2d3e2064630a6a74202d646f776e2d3e2068696265726e6174650a6463202d646f776e2d3e2062617369634d617070696e670a68696265726e617465202d646f776e2d3e206a70610a62617369634d617070696e67202d646f776e2d3e2072326462635265706f0a40656e64756d6c&quot; /&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;where-does-hibernate-fit&quot;&gt;Where Does Hibernate Fit?&lt;/h2&gt;
    &lt;p&gt;In the JDBC stack, there&apos;s an important layer between JdbcTemplate and Spring Data JPA:&lt;/p&gt;
    &lt;div style=&quot;text-align: center;&quot;&gt;
    &lt;img class=&quot;plantuml&quot; src=&quot;http://www.plantuml.com/plantuml/svg/~h407374617274756d6c0a736b696e706172616d206261636b67726f756e64436f6c6f72207472616e73706172656e740a736b696e706172616d2064656661756c74466f6e744e616d6520417269616c0a736b696e706172616d2072656374616e676c65207b0a20202020526f756e64436f726e65722031300a20202020426f72646572436f6c6f7220233535353535350a7d0a0a72656374616e676c6520222a2a537072696e672044617461204a50412a2a5c6e4050726f6365647572652c207265706f7369746f72696573222061732073646a706120233930434146390a72656374616e676c6520222a2a4a50412a2a5c6e53706563696669636174696f6e202d206a75737420696e746572666163657322206173206a706120233634423546360a72656374616e676c6520222a2a48696265726e6174652a2a5c6e496d706c656d656e746174696f6e202d2061637475616c20636f6465222061732068696265726e61746520233432413546350a72656374616e676c6520222a2a4a4442432a2a5c6e4c6f772d6c6576656c2064617461626173652061636365737322206173206a64626320233145383845350a0a73646a7061202d646f776e2d3e206a70610a6a7061202d646f776e2d3e2068696265726e6174650a68696265726e617465202d646f776e2d3e206a6462630a40656e64756d6c&quot; /&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;JPA&lt;/strong&gt; (Java Persistence API) is just a &lt;em&gt;specification&lt;/em&gt; - interfaces that define what an ORM should do. No actual code.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Hibernate&lt;/strong&gt; is an &lt;em&gt;implementation&lt;/em&gt; of JPA - the actual code that does the work. EclipseLink is another implementation.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Hibernate does NOT work with R2DBC.&lt;/strong&gt; It&apos;s built on JDBC (blocking). That&apos;s why &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt; only exists in the JDBC stack.&lt;/p&gt;
    &lt;h2 id=&quot;orm-vs-repository&quot;&gt;ORM vs Repository&lt;/h2&gt;
    &lt;p&gt;These are different concepts:&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Repository&lt;/strong&gt; = A pattern for abstracting data access (find, save, delete). Both stacks have this.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;ORM&lt;/strong&gt; (Object-Relational Mapping) = Maps Java objects ↔ database tables with advanced features:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Class → Table mapping&lt;/li&gt;
    &lt;li&gt;Relationships (OneToMany, ManyToOne)&lt;/li&gt;
    &lt;li&gt;Lazy loading&lt;/li&gt;
    &lt;li&gt;Caching&lt;/li&gt;
    &lt;li&gt;Dirty checking (tracking changes)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Feature&lt;/th&gt;
    &lt;th&gt;JDBC + Hibernate&lt;/th&gt;
    &lt;th&gt;R2DBC&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**Repository**&lt;/td&gt;
    &lt;td&gt;JpaRepository&lt;/td&gt;
    &lt;td&gt;ReactiveCrudRepository&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**ORM**&lt;/td&gt;
    &lt;td&gt;Hibernate (full)&lt;/td&gt;
    &lt;td&gt;None&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Entity mapping**&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Entity&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@OneToMany&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Table&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Id (basic)&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Lazy loading**&lt;/td&gt;
    &lt;td&gt;Yes&lt;/td&gt;
    &lt;td&gt;No&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Relationships**&lt;/td&gt;
    &lt;td&gt;Automatic&lt;/td&gt;
    &lt;td&gt;Manual&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Caching**&lt;/td&gt;
    &lt;td&gt;Yes&lt;/td&gt;
    &lt;td&gt;No&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;R2DBC is more &quot;direct&quot; - it talks to the database through drivers without a heavy ORM layer. Less magic, more control, but more manual work for complex scenarios.&lt;/p&gt;
    &lt;h2 id=&quot;how-to-tell-which-stack-youre-using&quot;&gt;How to Tell Which Stack You&apos;re Using&lt;/h2&gt;
    &lt;p&gt;Quick ways to identify the stack in code:&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;See this?&lt;/th&gt;
    &lt;th&gt;You&apos;re using&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DataSource&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;JDBC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ConnectionFactory&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;R2DBC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Entity&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;JPA/Hibernate (JDBC)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Table&lt;/code&gt; (without &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Entity&lt;/code&gt;)&lt;/td&gt;
    &lt;td&gt;R2DBC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JdbcTemplate&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;JDBC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatabaseClient&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;R2DBC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JpaRepository&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;JPA/Hibernate (JDBC)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReactiveCrudRepository&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;R2DBC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;JPA (JDBC only)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Returns &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mono&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Flux&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;R2DBC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;&lt;strong&gt;Connection management is different:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;JDBC uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DataSource&lt;/code&gt; (blocking connection pool like HikariCP)&lt;/li&gt;
    &lt;li&gt;R2DBC uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ConnectionFactory&lt;/code&gt; (reactive connection pool)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;You cannot use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DataSource&lt;/code&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatabaseClient&lt;/code&gt; - they&apos;re from different worlds.&lt;/p&gt;
    &lt;h2 id=&quot;drivermanager-vs-datasource&quot;&gt;DriverManager vs DataSource&lt;/h2&gt;
    &lt;p&gt;Both are ways to get a database connection, but &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DataSource&lt;/code&gt; is the modern choice.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;DriverManager&lt;/strong&gt; (JDBC 1.0) - the old way:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=DriverManager.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;DataSource&lt;/strong&gt; (JDBC 2.0+) - the preferred way:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=DataSource.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Why &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DataSource&lt;/code&gt; is preferred:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Connection pooling&lt;/strong&gt; - reuses connections instead of creating new ones&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Configuration externalized&lt;/strong&gt; - connection details in properties, not code&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Transparent to application&lt;/strong&gt; - switch databases without code changes&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Health monitoring&lt;/strong&gt; - pools can validate connections before use&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;In Spring Boot, just add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spring.datasource.*&lt;/code&gt; properties and you get a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HikariDataSource&lt;/code&gt; automatically.&lt;/p&gt;
    &lt;h2 id=&quot;connectionfactory-r2dbc&quot;&gt;ConnectionFactory (R2DBC)&lt;/h2&gt;
    &lt;p&gt;For R2DBC, you use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ConnectionFactory&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DataSource&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=ConnectionFactory.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In Spring Boot, just add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spring.r2dbc.*&lt;/code&gt; properties:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=application.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Spring Boot auto-configures &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ConnectionFactory&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatabaseClient&lt;/code&gt; for you.&lt;/p&gt;
    &lt;h2 id=&quot;jdbc-stack-blocking&quot;&gt;JDBC Stack (Blocking)&lt;/h2&gt;
    &lt;p&gt;Everything in this stack &lt;strong&gt;blocks the thread&lt;/strong&gt; while waiting for the database.&lt;/p&gt;
    &lt;h3 id=&quot;raw-jdbctemplate&quot;&gt;Raw JdbcTemplate&lt;/h3&gt;
    &lt;p&gt;Full control, but verbose:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=JdbcTemplate.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Why &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;registerOutParameter&lt;/code&gt;? The JDBC driver needs to know which parameters are outputs &lt;strong&gt;before&lt;/strong&gt; execution. After the call completes, it retrieves the value from that registered position.&lt;/p&gt;
    &lt;h3 id=&quot;simplejdbccall&quot;&gt;SimpleJdbcCall&lt;/h3&gt;
    &lt;p&gt;Declarative, less boilerplate:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=SimpleJdbcCall.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;spring-data-jpa-procedure&quot;&gt;Spring Data JPA &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt;&lt;/h3&gt;
    &lt;p&gt;The cleanest - but &lt;strong&gt;only works with JDBC&lt;/strong&gt; (blocking):&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=MathRepository.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt; is a JPA annotation. JPA is built on JDBC, so it&apos;s inherently blocking. There&apos;s no reactive equivalent.&lt;/p&gt;
    &lt;h2 id=&quot;r2dbc-stack-reactive&quot;&gt;R2DBC Stack (Reactive)&lt;/h2&gt;
    &lt;p&gt;Everything in this stack is &lt;strong&gt;non-blocking&lt;/strong&gt; and returns &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mono&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Flux&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;Two ways to execute queries - same pattern as JDBC:&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt; &lt;/th&gt;
    &lt;th&gt;**Programmatic (Client)**&lt;/th&gt;
    &lt;th&gt;**Declarative (Repository)**&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**JDBC**&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JdbcTemplate.query()&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Query&lt;/code&gt; in JpaRepository&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**R2DBC**&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatabaseClient.sql()&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Query&lt;/code&gt; in ReactiveCrudRepository&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;databaseclientsql---programmatic&quot;&gt;DatabaseClient.sql() - Programmatic&lt;/h3&gt;
    &lt;p&gt;The reactive equivalent of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JdbcTemplate&lt;/code&gt;. You write code to build and execute queries manually:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=DatabaseClient.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Use this when you need full control - dynamic queries, complex mappings, or operations that don&apos;t fit the repository pattern.&lt;/p&gt;
    &lt;h3 id=&quot;query-in-repository---declarative&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Query&lt;/code&gt; in Repository - Declarative&lt;/h3&gt;
    &lt;p&gt;You annotate a method and Spring generates the implementation:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ca33ddf1335fdc8c63f4fc23f2dd6ef1.js?file=Query.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Same SQL, but Spring handles the binding and execution. You just call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mathRepository.addNumbers(2, 3)&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;No &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt; in R2DBC&lt;/strong&gt; - Spring Data R2DBC doesn&apos;t have a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt; annotation because R2DBC drivers don&apos;t have standardized stored procedure support like JDBC&apos;s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CallableStatement&lt;/code&gt;. You must use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Query&lt;/code&gt; with native SQL instead.&lt;/p&gt;
    &lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Want to…&lt;/th&gt;
    &lt;th&gt;Use&lt;/th&gt;
    &lt;th&gt;Driver&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;Call stored procedures with annotations&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt; (JPA)&lt;/td&gt;
    &lt;td&gt;JDBC (blocking)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Call stored procedures with full control&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JdbcTemplate&lt;/code&gt; / &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SimpleJdbcCall&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;JDBC (blocking)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Reactive database access&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatabaseClient&lt;/code&gt; / &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Query&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;R2DBC (non-blocking)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Reactive stored procedures&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatabaseClient&lt;/code&gt; with native SQL&lt;/td&gt;
    &lt;td&gt;R2DBC (limited support)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;If you need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Procedure&lt;/code&gt;, you&apos;re using JDBC. If you need reactive/non-blocking, you&apos;re using R2DBC and will need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Query&lt;/code&gt; with native SQL instead.&lt;/p&gt;
  </description>
  <pubDate>2026-01-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/calling-stored-procedure-spring-jdbc-vs-r2dbc</link>
<guid isPermaLink="true">https://randomwits.com/blog/calling-stored-procedure-spring-jdbc-vs-r2dbc</guid>
</item>
<item>
  <title>Reading - Agent Tools &amp; Interoperability with MCP</title>
  <description>&lt;p&gt;Reading - Agent Tools &amp;amp; Interoperability with MCP.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Reading - Agent Tools &amp;amp; Interoperability with MCP&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;whats-a-tool&quot;&gt;What&apos;s a tool&lt;/h2&gt;
    &lt;p&gt;A &lt;strong&gt;tool&lt;/strong&gt; is an external function or service that a language model can invoke at runtime to perform actions beyond its static training data.&lt;/p&gt;
    &lt;p&gt;OpenAI introduced &lt;strong&gt;function calling&lt;/strong&gt; (circa mid-2023), which allows models to invoke external code. Modern &lt;strong&gt;tools&lt;/strong&gt; are built on top of this function-calling capability.&lt;/p&gt;
    &lt;h2 id=&quot;tool-definition&quot;&gt;Tool definition&lt;/h2&gt;
    &lt;p&gt;A tool definition is a &lt;strong&gt;contract&lt;/strong&gt; between the model and the client. This contract must include:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;a &lt;strong&gt;clear, unambiguous function name&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;a &lt;strong&gt;descriptive docstring&lt;/strong&gt; explaining what the tool does and when it should be used&lt;/li&gt;
    &lt;li&gt;a &lt;strong&gt;strictly typed schema&lt;/strong&gt; for input arguments&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Example:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/e2b6e04b2d04d37de6ce6014be357177.js?file=example.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;n--m-integration-problem&quot;&gt;N × M Integration Problem&lt;/h2&gt;
    &lt;p&gt;Consider a system with &lt;strong&gt;N&lt;/strong&gt; AI models and &lt;strong&gt;M&lt;/strong&gt; tools. Without standardization, each model requires a custom integration for each tool—resulting in &lt;strong&gt;N × M&lt;/strong&gt; point-to-point connectors.&lt;/p&gt;
    &lt;p&gt;This quickly becomes unmanageable as both models and tools scale.&lt;/p&gt;
    &lt;h3 id=&quot;lsp&quot;&gt;LSP&lt;/h3&gt;
    &lt;p&gt;Before LSP, each code editor needed a separate plugin for each programming language. With 10 editors and 10 languages, that meant 100 plugins.&lt;/p&gt;
    &lt;p&gt;Microsoft introduced the &lt;strong&gt;Language Server Protocol (LSP)&lt;/strong&gt;. It provided:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;a client–server architecture with a JSON-RPC–based message interface&lt;/li&gt;
    &lt;li&gt;a language server that implements language-specific logic (parsing, diagnostics, completions)&lt;/li&gt;
    &lt;li&gt;servers advertising the capabilities they support&lt;/li&gt;
    &lt;li&gt;clients connecting to servers and consuming those capabilities&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;mcp&quot;&gt;MCP&lt;/h3&gt;
    &lt;p&gt;MCP follows a similar architectural pattern to LSP. It provides:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;an &lt;strong&gt;MCP host&lt;/strong&gt;, which advertises the tools it exposes&lt;/li&gt;
    &lt;li&gt;communication via &lt;strong&gt;JSON-RPC 2.0&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;a standardized way for clients to discover and invoke tools&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Tool discovery example:&lt;/p&gt;
    &lt;p&gt;&lt;img class=&quot;mermaid&quot; src=&quot;https://mermaid.ink/svg/eyJjb2RlIjoic2VxdWVuY2VEaWFncmFtXG5wYXJ0aWNpcGFudCBDbGllbnRcbnBhcnRpY2lwYW50IE1DUF9TZXJ2ZXIgYXMgTUNQIFNlcnZlclxuJSUtXG5DbGllbnQtPj5NQ1BfU2VydmVyOiB0b29scy9saXN0XG5NQ1BfU2VydmVyLS0-PkNsaWVudDogVG9vbCBzY2hlbWFzXG4lJS1cbkNsaWVudC0-PkNsaWVudDogTExNIHNlbGVjdHMgYXBwcm9wcmlhdGUgdG9vbFxuJSUtXG5DbGllbnQtPj5NQ1BfU2VydmVyOiB0b29scy9jYWxsKG5hbWUsIGFyZ3VtZW50cylcbk1DUF9TZXJ2ZXItLT4-Q2xpZW50OiBUb29sIHJlc3VsdCIsIm1lcm1haWQiOm51bGx9&quot; /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;tool-invocation&quot;&gt;Tool Invocation&lt;/h3&gt;
    &lt;p&gt;User query: “What’s the weather in New York?”
    The LLM decides to call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;get_weather(city=&quot;NY&quot;)&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/e2b6e04b2d04d37de6ce6014be357177.js?file=json-rpc.json&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The server executes the function and returns the result, which the client feeds back into the model’s context.&lt;/p&gt;
    &lt;h2 id=&quot;sampling&quot;&gt;Sampling&lt;/h2&gt;
    &lt;p&gt;Sometimes a tool needs LLM assistance to complete its task—for example, summarizing a large document before returning a result.&lt;/p&gt;
    &lt;p&gt;Flow:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;MCP server receives a request (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fetch_and_summarize_pdf&lt;/code&gt;)&lt;/li&gt;
    &lt;li&gt;it retrieves the raw PDF&lt;/li&gt;
    &lt;li&gt;instead of processing it locally, it issues a &lt;strong&gt;sampling request&lt;/strong&gt; back to the client:
    “Please summarize this 50-page document using your LLM.”&lt;/li&gt;
    &lt;li&gt;the client runs the summarization and returns the result to the server&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;This keeps the server lightweight while still leveraging model intelligence.&lt;/p&gt;
    &lt;h2 id=&quot;elicitation-tool--human&quot;&gt;Elicitation (Tool → Human)&lt;/h2&gt;
    &lt;p&gt;When a tool lacks critical information—such as confirmation for a destructive action—it can &lt;strong&gt;elicit input from a human operator&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt;Example:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;a tool attempts to delete a file&lt;/li&gt;
    &lt;li&gt;deletion requires a 2FA code or explicit confirmation&lt;/li&gt;
    &lt;li&gt;the tool pauses execution and requests human input&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;best-practices-for-designing-agent-tools&quot;&gt;Best Practices for Designing Agent Tools&lt;/h2&gt;
    &lt;p&gt;&lt;strong&gt;Describe intent, not implementation&lt;/strong&gt;
    Prefer: “Create a high-priority bug ticket in Jira”
    Avoid: “POST to /rest/api/3/issue with JSON payload…”&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Granularity matters&lt;/strong&gt;
    Each tool should perform one atomic action. Compose complex workflows by chaining simple tools.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Minimize output payloads&lt;/strong&gt;
    Never return megabytes of raw data to the LLM. If output is large:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;store it externally (object storage, cache)&lt;/li&gt;
    &lt;li&gt;return a reference instead (URL, ID, hash)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;strong&gt;Validate inputs strictly&lt;/strong&gt;
    Enforce type and domain constraints (e.g., brightness ∈ [0,100]) to prevent runtime errors.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Idempotency &amp;amp; safety&lt;/strong&gt;
    Design tools to be safe on retries (e.g., idempotency keys for financial or destructive operations).&lt;/p&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.kaggle.com/whitepaper-agent-tools-and-interoperability-with-mcp&quot;&gt;Agent Tools &amp;amp; Interoperability with MCP&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2026-01-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/reading-agent-tools-interoperability-mcp</link>
<guid isPermaLink="true">https://randomwits.com/blog/reading-agent-tools-interoperability-mcp</guid>
</item>
<item>
  <title>Fix MicroSD Card Not Detected on Steam Deck</title>
  <description>&lt;p&gt;I recently got a new &lt;a href=&quot;https://www.amazon.com/dp/B0CWPPMD8W&quot;&gt;512GB MicroSD card&lt;/a&gt; for my Steam Deck. After inserting it, SteamOS didn&apos;t recognize it. Here&apos;s how I fixed it via SSH.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I recently got a new &lt;a href=&quot;https://www.amazon.com/dp/B0CWPPMD8W&quot;&gt;512GB MicroSD card&lt;/a&gt; for my Steam Deck. After inserting it, SteamOS didn&apos;t recognize it. Here&apos;s how I fixed it via SSH.&lt;/p&gt;
    &lt;h2 id=&quot;step-1-connect-via-ssh&quot;&gt;Step 1: Connect via SSH&lt;/h2&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9427a75117b3cb551f0f049e2e0e774d.js?file=ex1.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Replace it with your Steam Deck&apos;s IP address. For informaiton on how to find it &lt;a href=&quot;https://randomwits.com/blog/add-non-steam-games-to-steam-deck&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;step-2-identify-the-sd-card&quot;&gt;Step 2: Identify the SD Card&lt;/h2&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9427a75117b3cb551f0f049e2e0e774d.js?file=ex2.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Look for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mmcblk0&lt;/code&gt; device:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mmcblk0      477.5G disk
    └─mmcblk0p1  477.5G part
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mmcblk0&lt;/code&gt; - the SD card device&lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mmcblk0p1&lt;/code&gt; - the partition&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;step-3-create-partition-table&quot;&gt;Step 3: Create Partition Table&lt;/h2&gt;
    &lt;p&gt;Wipe and create a fresh GPT partition table:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9427a75117b3cb551f0f049e2e0e774d.js?file=ex3.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;step-4-format-as-ext4&quot;&gt;Step 4: Format as ext4&lt;/h2&gt;
    &lt;p&gt;SteamOS requires ext4 for game storage:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9427a75117b3cb551f0f049e2e0e774d.js?file=ex4.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Verify the filesystem:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9427a75117b3cb551f0f049e2e0e774d.js?file=ex5.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;You should see &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ext4&lt;/code&gt; with label &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;steamdeck&lt;/code&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;step-5-mount-using-udisks&quot;&gt;Step 5: Mount Using udisks&lt;/h2&gt;
    &lt;p&gt;SteamOS uses udisks for mounting, not &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/fstab&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9427a75117b3cb551f0f049e2e0e774d.js?file=ex6.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The card mounts to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/run/media/deck/steamdeck&lt;/code&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;step-6-add-to-steam-library&quot;&gt;Step 6: Add to Steam Library&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;Switch to &lt;strong&gt;Desktop Mode&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;Open &lt;strong&gt;Steam&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;Go to &lt;strong&gt;Steam → Settings → Storage&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;Click &lt;strong&gt;Add Drive&lt;/strong&gt; (or the + button)&lt;/li&gt;
    &lt;li&gt;Browse to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/run/media/deck/steamdeck&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Click &lt;strong&gt;Add&lt;/strong&gt;&lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;verify-in-game-mode&quot;&gt;Verify in Game Mode&lt;/h2&gt;
    &lt;p&gt;Return to Game Mode and check &lt;strong&gt;Settings → Storage&lt;/strong&gt;. You should now see both:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Internal SSD&lt;/li&gt;
    &lt;li&gt;SD Card (~477 GB)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Your SD card is ready for installing games.&lt;/p&gt;
  </description>
  <pubDate>2026-01-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/micro-sd-card-steam-deck-not-detected</link>
<guid isPermaLink="true">https://randomwits.com/blog/micro-sd-card-steam-deck-not-detected</guid>
</item>
<item>
  <title>Fix jekyll jolt plugin using monkey patching</title>
  <description>&lt;p&gt;My existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll&lt;/code&gt; website started failing newer jekyll version: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4.4.1&lt;/code&gt;. I had to do a &lt;strong&gt;monkey patch&lt;/strong&gt; to resolve this error.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;My existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll&lt;/code&gt; website started failing with newer jekyll version: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4.4.1&lt;/code&gt;. I had to do a &lt;strong&gt;monkey patch&lt;/strong&gt; to resolve this error.&lt;/p&gt;
    &lt;p&gt;The build started failing&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  Liquid Exception: undefined method `=~&apos; for 1:Integer in _posts
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The post responsible for the error uses &lt;a href=&quot;https://github.com/helpscout/jekyll-jolt&quot;&gt;jekyll-jolt&lt;/a&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;monkey-patching&quot;&gt;Monkey Patching&lt;/h2&gt;
    &lt;p&gt;A &lt;strong&gt;monkey patch&lt;/strong&gt; is a technique in dynamic languages (like Ruby) where you modify or extend existing code at runtime without changing the original source files. The name comes from the idea of &quot;monkey-wrenching&quot; your way into existing code—it&apos;s a quick and sometimes crude fix.&lt;/p&gt;
    &lt;h3 id=&quot;key-characteristics&quot;&gt;Key Characteristics&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Runtime modification&lt;/strong&gt;: Changes are applied when the code runs, not during compilation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;No source changes&lt;/strong&gt;: You don&apos;t modify the original library files&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Permanent for the session&lt;/strong&gt;: The modifications persist throughout your application&apos;s runtime&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Global scope&lt;/strong&gt;: Changes affect all code using that class/module&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;the-problem&quot;&gt;The Problem&lt;/h3&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll-jolt&lt;/code&gt; gem has a method called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prop?&lt;/code&gt; that checks if a string matches a certain pattern. However, it doesn&apos;t handle integer values properly—it assumes all input is a string. When an integer is passed, the method crashes because integers don&apos;t respond to the regex matching operation.&lt;/p&gt;
    &lt;h3 id=&quot;the-solution-the-monkey-patch&quot;&gt;The Solution: The Monkey Patch&lt;/h3&gt;
    &lt;p&gt;Create a file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_plugins/jekyll_jolt_fix.rb&lt;/code&gt;. Jekyll automatically loads all &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.rb&lt;/code&gt; files in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_plugins/&lt;/code&gt; directory. When this file loads, Ruby reopens the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Jekyll::Tags::TemplateBlock&lt;/code&gt; class and replaces the buggy &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prop?&lt;/code&gt; method with our fixed version. From that point forward, any call to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prop?&lt;/code&gt; uses our improved implementation.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b31870337e3c92ff9128e34822dcdbb9.js?file=jekyll_jolt_fix.rb&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2026-01-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/jekyll-jolt-monkey-patching</link>
<guid isPermaLink="true">https://randomwits.com/blog/jekyll-jolt-monkey-patching</guid>
</item>
<item>
  <title>Claude-Mem - Long Term memory for Claude code</title>
  <description>&lt;p&gt;Claude Code is my de facto AI coding tool. But it has one fundamental limitation: it forgets everything when you restart it. Every session starts fresh, forcing you to re-establish context, re-explain architectural decisions, and watch Claude re-analyze the same files repeatedly.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Claude Code is my de facto AI coding tool. But it has one fundamental limitation: it forgets everything when you restart it. Every session starts fresh, forcing you to re-establish context, re-explain architectural decisions, and watch Claude re-analyze the same files repeatedly.&lt;/p&gt;
    &lt;p&gt;The traditional workaround is &lt;strong&gt;CLAUDE.md&lt;/strong&gt;—a markdown file where you inject instructions and context. This helps, but it&apos;s manual and limited.&lt;/p&gt;
    &lt;h2 id=&quot;the-native-solution-claudemd&quot;&gt;The Native Solution: CLAUDE.md&lt;/h2&gt;
    &lt;p&gt;You can create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/CLAUDE.md&lt;/code&gt; (or project-specific &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.claude/CLAUDE.md&lt;/code&gt;) with instructions like:&lt;/p&gt;
    &lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gh&quot;&gt;# Project Guidelines&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;
    -&lt;/span&gt; Follow reactive functional paradigm in Java
    &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; Use repository pattern for data access
    &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; Write tests for all business logic
    &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; API responses must follow RFC 7807 for error handling
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Claude reads this at session start. It&apos;s useful for coding standards and preferences, but it misses the dynamic aspects of your project:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;What files you edited yesterday and why&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;What files you edited yesterday and why&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;What bugs you already fixed and how&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Architectural decisions you made during implementation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Context from previous conversations about specific features&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Tool usage patterns and command outputs&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CLAUDE.md&lt;/code&gt; is static. Your project evolves. You need memory that evolves with it.&lt;/p&gt;
    &lt;h2 id=&quot;claude-mem-plugin&quot;&gt;Claude-Mem Plugin&lt;/h2&gt;
    &lt;p&gt;Claude-Mem is a plugin that automatically captures everything Claude does during your coding sessions and makes that knowledge available to future sessions.&lt;/p&gt;
    &lt;h3 id=&quot;what-it-captures&quot;&gt;What It Captures&lt;/h3&gt;
    &lt;h4 id=&quot;prompts-and-intent&quot;&gt;Prompts and Intent:&lt;/h4&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Your questions and requests&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;The problems you&apos;re trying to solve&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h4 id=&quot;tool-usage&quot;&gt;Tool Usage:&lt;/h4&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;File reads, writes, and edits&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Shell command executions and their outputs&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Search queries and results&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;API calls and responses&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;installation&quot;&gt;Installation&lt;/h3&gt;
    &lt;p&gt;Install directly from the Claude Code plugin marketplace:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5cf466a92f5753c8b13d9ee32bf58995.js?file=plugin.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Restart Claude Code.&lt;/p&gt;
    &lt;p&gt;Verify the worker service is running:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5cf466a92f5753c8b13d9ee32bf58995.js?file=check_worker.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;If the worker isn&apos;t running, start it manually:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5cf466a92f5753c8b13d9ee32bf58995.js?file=start_worker.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The worker service provides a web UI at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost:37777&lt;/code&gt; where you can browse your session history, search observations, and view the timeline.&lt;/p&gt;
    &lt;h2 id=&quot;privacy-and-data-storage&quot;&gt;Privacy and Data Storage&lt;/h2&gt;
    &lt;p&gt;All data is stored in ` ~/.claude-mem/`&lt;/p&gt;
    &lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~/.claude-mem/
    ├── claude-mem.db          # SQLite database
    ├── logs/                  # Worker service logs
    ├── settings.json          # Configuration
    └── chroma/                # Vector embeddings
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Override the lcoation if you need&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5cf466a92f5753c8b13d9ee32bf58995.js?file=export_path.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;handling-sensitive-data&quot;&gt;Handling Sensitive Data&lt;/h2&gt;
    &lt;p&gt;Wrap sensitive content in **&lt;private&gt;** tags:&lt;/private&gt;&lt;/p&gt;
    &lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;private&amp;gt;&lt;/span&gt;
    API_KEY=sk-super-secret-key-12345
    DATABASE_PASSWORD=P@ssw0rd!
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/private&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;clear-command&quot;&gt;Clear command&lt;/h2&gt;
    &lt;p&gt;When you run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/clear&lt;/code&gt; in Claude Code, you might expect it to wipe memory. It doesn&apos;t.&lt;/p&gt;
    &lt;p&gt;What /clear does:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Clears the current conversation context&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Re-injects fresh observations from Claude-Mem&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Continues tracking the same session&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;You get a clean slate in the conversation without losing project memory. This is useful when context gets cluttered or you want to shift focus.&lt;/p&gt;
    &lt;h2 id=&quot;advanced-direct-database-queries&quot;&gt;Advanced: Direct Database Queries&lt;/h2&gt;
    &lt;p&gt;Claude-Mem uses SQLite under the hood. You can query it directly:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5cf466a92f5753c8b13d9ee32bf58995.js?file=start_sqlite.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;example queries&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5cf466a92f5753c8b13d9ee32bf58995.js?file=sample.sql&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
    &lt;p&gt;This plugin feels like a  muscle memory for your claude code. Install it. Forget about it. Let Claude remember.&lt;/p&gt;
  </description>
  <pubDate>2026-01-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/claude-mem-long-term-memory-claude-code</link>
<guid isPermaLink="true">https://randomwits.com/blog/claude-mem-long-term-memory-claude-code</guid>
</item>
<item>
  <title>Taking Care of Your Eyes While Using a Computer</title>
  <description>&lt;p&gt;Spending long hours in front of a computer screen is part of my daily routine, and over time, I&apos;ve noticed the strain it puts on my eyes. Blue light from displays can disrupt sleep and cause discomfort, but there are practical ways to mitigate this. Here&apos;s what I&apos;ve learned and implemented.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;understanding-blue-light&quot;&gt;Understanding Blue Light&lt;/h2&gt;
    &lt;p&gt;Computer screens emit blue light, a high-energy visible (HEV) light that helps regulate alertness and circadian rhythm during the day. At night, excessive exposure can suppress melatonin, making it harder to fall asleep and reducing sleep quality. Prolonged exposure also contributes to digital eye strain, which can manifest as:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Dry or irritated eyes&lt;/li&gt;
    &lt;li&gt;Headaches&lt;/li&gt;
    &lt;li&gt;Blurred or unfocused vision&lt;/li&gt;
    &lt;li&gt;A general sense of visual fatigue&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;follow-the-20-20-20-rule&quot;&gt;Follow the 20-20-20 Rule&lt;/h2&gt;
    &lt;p&gt;For every 20 minutes of screen time, look at something 20 feet away for at least 20 seconds. This gives your eyes a break and helps reduce strain. I set a timer on my phone to remind me.&lt;/p&gt;
    &lt;h2 id=&quot;use-software-to-reduce-blue-light&quot;&gt;Use Software to Reduce Blue Light&lt;/h2&gt;
    &lt;p&gt;Apps like &lt;strong&gt;f.lux&lt;/strong&gt; automatically adjust your screen&apos;s color temperature based on the time of day, reducing blue light in the evening.&lt;/p&gt;
    &lt;h2 id=&quot;macos-specific-tweaks&quot;&gt;macOS-Specific Tweaks&lt;/h2&gt;
    &lt;p&gt;You can enable &lt;strong&gt;Night Shift&lt;/strong&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;System Settings &amp;gt; Displays&lt;/code&gt;. This built-in feature helps reduce blue light by warming screen colors in the evening.&lt;/p&gt;
    &lt;p&gt;On Apple Silicon Macs, macOS uses temporal dithering to simulate more colors. This may cause subtle eye fatigue over long sessions. More details on this are &lt;a href=&quot;/blog/stillcolors-in-mac&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
    &lt;p&gt;Additionally, you can enable &lt;a href=&quot;https://support.apple.com/guide/mac-help/turn-on-screen-distance-mchle20721bd/mac&quot;&gt;Screen Distance&lt;/a&gt;, a macOS feature that alerts you if you sit too close to the screen for extended periods.&lt;/p&gt;
    &lt;h2 id=&quot;consider-blue-light-blocking-glasses&quot;&gt;Consider Blue Light Blocking Glasses&lt;/h2&gt;
    &lt;p&gt;Wearing glasses with blue light filters can block a significant portion of HEV light. If you have a doctor&apos;s prescription, you can use your HSA to purchase them.&lt;/p&gt;
    &lt;h2 id=&quot;try-an-e-ink-monitor&quot;&gt;Try an E-Ink Monitor&lt;/h2&gt;
    &lt;p&gt;Consider an &lt;strong&gt;e-ink&lt;/strong&gt; monitor as a second display, like the &lt;strong&gt;DASUNG 13.3&quot; E-ink Monitor (Paperlike HD-F)&lt;/strong&gt;. It connects via USB-C and feels like a Kindle for your computer—great for text-heavy work without blue light.&lt;/p&gt;
    &lt;h2 id=&quot;final-thoughts&quot;&gt;Final Thoughts&lt;/h2&gt;
    &lt;p&gt;Eye health is cumulative, so small changes add up. Start with the 20-20-20 rule and software adjustments—they&apos;re free and effective. If symptoms persist, consult an eye doctor.&lt;/p&gt;
  </description>
  <pubDate>2025-12-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/take-care-of-your-eyes-while-using-computer</link>
<guid isPermaLink="true">https://randomwits.com/blog/take-care-of-your-eyes-while-using-computer</guid>
</item>
<item>
  <title>Ode to Cashew  - Guinea pig</title>
  <description>&lt;p&gt;Ode to Cashew, our Guinea Pig. Rest in Peace.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;cashew&quot; class=&quot;album&quot;&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_2600,f_auto,q_auto/v1766543294/IMG_0015_lxdrp5.jpg&quot; class=&quot;album-image&quot; title=&quot;I am losing weight 🐖&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_200,f_auto,q_auto/v1766543294/IMG_0015_lxdrp5.jpg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_2600,f_auto,q_auto/v1766543812/IMG_9489_xlq5xw.jpg&quot; class=&quot;album-image&quot; title=&quot;I am playing hide and seek 🫣&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_200,f_auto,q_auto/v1766543294/IMG_9489_xlq5xw.jpg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_2600,f_auto,q_auto/v1766547575/01660A73-BB0B-4A65-B503-82334A61DC96_mrmuk7.jpg&quot; class=&quot;album-image&quot; title=&quot;I can pose 😎&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_200,f_auto,q_auto/v1766547575/01660A73-BB0B-4A65-B503-82334A61DC96_mrmuk7.jpg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_2600,f_auto,q_auto/v1766547579/bc7d699e-c446-47ed-88dd-31b86557134c_cfffuc.jpg&quot; class=&quot;album-image&quot; title=&quot;Secret tunnel 🤫&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_200,f_auto,q_auto/v1766547579/bc7d699e-c446-47ed-88dd-31b86557134c_cfffuc.jpg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_2600,f_auto,q_auto/v1766547867/D9E66DF2-616F-4241-B052-AFE0C0927989_sudu46.jpg&quot; class=&quot;album-image&quot; title=&quot;Merry christmas 🎅&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_200,f_auto,q_auto/v1766547867/D9E66DF2-616F-4241-B052-AFE0C0927989_sudu46.jpg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_2600,f_auto,q_auto/v1766548116/IMG_2474_q3ulsb.jpg&quot; class=&quot;album-image&quot; title=&quot;It was not me 😠&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_200,f_auto,q_auto/v1766548116/IMG_2474_q3ulsb.jpg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_2600,f_auto,q_auto/v1766588087/PHOTO-2025-12-24-01-46-07_pf08s8.jpg&quot; class=&quot;album-image&quot; title=&quot;To live in the hearts we leave behind is to live forever&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://res.cloudinary.com/dlazo0sj2/image/upload/w_300,h_200,c_fit,f_auto,q_auto/v1766588087/PHOTO-2025-12-24-01-46-07_pf08s8.jpg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;a id=&quot;album-left&quot; href=&quot;#&quot;&gt;&amp;lsaquo;&lt;/a&gt;
    &lt;a id=&quot;album-right&quot; href=&quot;#&quot;&gt;&amp;rsaquo;&lt;/a&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/RsOQSsqzCMk?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/RsOQSsqzCMk?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/RsOQSsqzCMk/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Cashew Munching&quot;&gt;&lt;/iframe&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/rDLV-Dnl5m4?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/rDLV-Dnl5m4?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/rDLV-Dnl5m4/hqdefault.jpg alt=&apos;Pushup with cashew&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Pushups with cashew&quot;&gt;&lt;/iframe&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/TmjiZkQ-oH4/?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/TmjiZkQ-oH4/?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/TmjiZkQ-oH4/hqdefault.jpg alt=&apos;Richu with Cashew&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Richu with Cashew&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;Epitaph of Cashew:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Fat as a piggy,&lt;br /&gt;
    yet fast like thunder,&lt;br /&gt;
    he squeaked for carrots,&lt;br /&gt;
    and munched on hay like a snack.&lt;/p&gt;
    &lt;p&gt;He liked to cuddle,&lt;br /&gt;
    obedient as a cow,&lt;br /&gt;
    never made a mess,&lt;br /&gt;
    was cute until he crossed the rainbow bridge&lt;/p&gt;
    &lt;/blockquote&gt;
  </description>
  <pubDate>2025-12-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/ode-to-cashew-guine-pig</link>
<guid isPermaLink="true">https://randomwits.com/blog/ode-to-cashew-guine-pig</guid>
</item>
<item>
  <title>Canton Cribsheet</title>
  <description>&lt;p&gt;What if blockchains could talk to each other while keeping secrets? That&apos;s Canton.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;whats-canton&quot;&gt;What&apos;s Canton?&lt;/h2&gt;
    &lt;p&gt;Canton is a &lt;strong&gt;private permissioned blockchain&lt;/strong&gt; built by Digital Asset. But wait—what do those words actually mean?&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Private&lt;/strong&gt;: Unlike Bitcoin where anyone can see every transaction, Canton hides transaction details. Only parties involved in a deal see it. Your competitor won&apos;t know you just bought 10,000 widgets.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Permissioned&lt;/strong&gt;: Bitcoin lets anyone run a node and mine blocks. Canton says &quot;not so fast.&quot; You need approval to join. Only validated nodes can write to the ledger. Why? Because financial institutions don&apos;t want anonymous strangers validating their trades.&lt;/p&gt;
    &lt;p&gt;Canton isn&apos;t &lt;em&gt;one&lt;/em&gt; blockchain. It&apos;s a &lt;strong&gt;network of synchronized domains&lt;/strong&gt; that can interoperate. Think of domains as separate rooms where transactions happen—but parties can walk between rooms while maintaining consistency.&lt;/p&gt;
    &lt;h2 id=&quot;how-do-you-write-canton-apps&quot;&gt;How Do You Write Canton Apps?&lt;/h2&gt;
    &lt;p&gt;You write smart contracts in &lt;strong&gt;DAML&lt;/strong&gt; (Digital Asset Modeling Language). It looks like Haskell because it &lt;em&gt;is&lt;/em&gt; based on Haskell—a functional language designed to avoid bugs through strong typing.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab daml&quot;&gt;&lt;a href=&quot;#daml&quot;&gt;daml&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample daml&quot; id=&quot;daml&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/c1eda9f78bda146edc3835ff102dc7de.js?file=example.hs&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/c1eda9f78bda146edc3835ff102dc7de.js?file=Example.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;p&gt;The key difference? In Java, authorization is just data you check at runtime. In DAML, it&apos;s enforced by the compiler and the ledger—you literally cannot submit a transaction where an unauthorized party exercises a choice.&lt;/p&gt;
    &lt;p&gt;What&apos;s happening here?&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;template&lt;/strong&gt;: A blueprint for contracts (like a class in OOP)&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Party&lt;/strong&gt;: An identity on the ledger—could be a person, company, or system&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;signatory&lt;/strong&gt;: Who must authorize this contract&apos;s creation? The organizer. Without their signature, no contract.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;observer&lt;/strong&gt;: Who can &lt;em&gt;see&lt;/em&gt; this contract but didn&apos;t sign it? The buyer. They&apos;re watching.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;choice&lt;/strong&gt;: An action that can transform or consume this contract. Here, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Accept&lt;/code&gt; lets the buyer turn the offer into an agreement.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;controller&lt;/strong&gt;: Who can trigger this choice? Only the buyer.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;DAML&apos;s superpower: &lt;strong&gt;authorization is built into the language&lt;/strong&gt;. You can&apos;t accidentally write code that lets unauthorized parties modify contracts. The compiler catches it.&lt;/p&gt;
    &lt;h3 id=&quot;from-code-to-ledger&quot;&gt;From Code to Ledger&lt;/h3&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;DAML source → daml build → DAR file → Upload to Participant Node → Execute on Ledger
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;DAR&lt;/strong&gt; (DAML Archive) is like a JAR file—compiled bytecode bundled with dependencies. The participant node&apos;s DAML engine interprets this bytecode when executing transactions.&lt;/p&gt;
    &lt;h2 id=&quot;the-governance-layer&quot;&gt;The Governance Layer&lt;/h2&gt;
    &lt;h3 id=&quot;global-synchronizer-foundation-gsf&quot;&gt;Global Synchronizer Foundation (GSF)&lt;/h3&gt;
    &lt;p&gt;Who runs this thing? Not Digital Asset alone. The &lt;strong&gt;Global Synchronizer Foundation&lt;/strong&gt; is a non-profit that:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Owns the &lt;strong&gt;sync.global&lt;/strong&gt; domain (the main synchronization domain)&lt;/li&gt;
    &lt;li&gt;Sets network rules and policies&lt;/li&gt;
    &lt;li&gt;Manages the tokenomics committee that approves new validators&lt;/li&gt;
    &lt;li&gt;Coordinates upgrades across the network&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Think of GSF as the &quot;board of directors&quot; for Canton&apos;s shared infrastructure.&lt;/p&gt;
    &lt;h3 id=&quot;super-validators-svs&quot;&gt;Super Validators (SVs)&lt;/h3&gt;
    &lt;p&gt;The heavy lifters. Large institutions like &lt;strong&gt;digitalasset.com&lt;/strong&gt;, &lt;strong&gt;cumberland.io&lt;/strong&gt;, and others run critical infrastructure:&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;What They Run&lt;/th&gt;
    &lt;th&gt;What It Does&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**Sequencer Nodes**&lt;/td&gt;
    &lt;td&gt;Order transactions globally. Without ordering, you get chaos—two parties could &quot;double-spend.&quot;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Mediator Nodes**&lt;/td&gt;
    &lt;td&gt;Coordinate transaction confirmations across participants&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Scan Nodes**&lt;/td&gt;
    &lt;td&gt;Provide APIs for querying the ledger history&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;SVs have their own security policies and must meet strict uptime requirements. They&apos;re the backbone.&lt;/p&gt;
    &lt;h3 id=&quot;regular-validators&quot;&gt;Regular Validators&lt;/h3&gt;
    &lt;p&gt;Smaller participants who validate transactions but don&apos;t run global infrastructure.&lt;/p&gt;
    &lt;p&gt;Requirements:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Must be &lt;strong&gt;sponsored by an SV&lt;/strong&gt; (no strangers allowed)&lt;/li&gt;
    &lt;li&gt;Must get &lt;strong&gt;IP allowlisted&lt;/strong&gt; by multiple SV operators (defense in depth)&lt;/li&gt;
    &lt;li&gt;Follow network compliance rules&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;key-technical-concepts&quot;&gt;Key Technical Concepts&lt;/h2&gt;
    &lt;h3 id=&quot;contracts-and-contract-ids&quot;&gt;Contracts and Contract IDs&lt;/h3&gt;
    &lt;p&gt;A &lt;strong&gt;contract&lt;/strong&gt; is a live instance of a DAML template on the ledger. When you &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;create&lt;/code&gt; in DAML, you get back a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ContractId&lt;/code&gt;—a unique reference to that specific contract instance.&lt;/p&gt;
    &lt;div class=&quot;language-haskell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;contractId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;MyTemplate&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;field1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;value&quot;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;-- contractId is now a pointer to this contract&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Contract IDs are &lt;strong&gt;content-addressed&lt;/strong&gt;: derived from the contract&apos;s contents. Same inputs = same ID (but you can&apos;t create duplicates—the ledger prevents it).&lt;/p&gt;
    &lt;p&gt;Contracts have lifecycles:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Active&lt;/strong&gt;: Created and available for use&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Archived&lt;/strong&gt;: Consumed by a choice—gone forever, but history remains&lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;domains-and-synchronization&quot;&gt;Domains and Synchronization&lt;/h3&gt;
    &lt;p&gt;A &lt;strong&gt;domain&lt;/strong&gt; is a synchronization point where transactions get ordered and confirmed. Canton can have multiple domains:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;sync.global&lt;/strong&gt;: The main domain run by GSF&lt;/li&gt;
    &lt;li&gt;Private domains: Your company could run one internally&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Transactions can span domains through &lt;strong&gt;domain transfers&lt;/strong&gt;—moving a contract from one domain to another while maintaining atomicity.&lt;/p&gt;
    &lt;h3 id=&quot;migration-id&quot;&gt;Migration ID&lt;/h3&gt;
    &lt;p&gt;A &lt;strong&gt;network-level concept&lt;/strong&gt; that tracks major protocol upgrades.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Environment&lt;/th&gt;
    &lt;th&gt;Migration ID&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;Devnet&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Testnet&lt;/td&gt;
    &lt;td&gt;varies&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Mainnet&lt;/td&gt;
    &lt;td&gt;increments with protocol upgrades&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Why does this matter? When Canton upgrades its protocol, the migration ID increments. Your application database tracks which migration it&apos;s synced to.&lt;/p&gt;
    &lt;h2 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;/h2&gt;
    &lt;h3 id=&quot;recovering-from-a-failed-upgrade&quot;&gt;Recovering from a Failed Upgrade&lt;/h3&gt;
    &lt;p&gt;When a Canton node upgrade fails mid-way, your database might be in an inconsistent state. Check what was actually ingested:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/c1eda9f78bda146edc3835ff102dc7de.js?file=checkError.sql&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;No rows returned?&lt;/strong&gt; Good news—nothing was ingested, database is clean. Roll back the binary and retry.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Rows returned?&lt;/strong&gt; The upgrade partially completed. You&apos;ll need to either:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Complete the upgrade manually&lt;/li&gt;
    &lt;li&gt;Restore from backup and retry&lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;common-gotchas&quot;&gt;Common Gotchas&lt;/h3&gt;
    &lt;p&gt;&lt;strong&gt;&quot;Party not authorized&quot;&lt;/strong&gt;: Your DAML choice&apos;s controller doesn&apos;t match who&apos;s submitting the command. Check your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;controller&lt;/code&gt; clauses.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;&quot;Contract not found&quot;&lt;/strong&gt;: Either the contract was archived, or your party can&apos;t see it (not a signatory or observer).&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;&quot;Domain disconnected&quot;&lt;/strong&gt;: Your participant lost connection to the synchronization domain. Check network, check sequencer health.&lt;/p&gt;
    &lt;h2 id=&quot;architecture-at-a-glance&quot;&gt;Architecture at a Glance&lt;/h2&gt;
    &lt;p&gt;&lt;img class=&quot;mermaid&quot; src=&quot;https://mermaid.ink/svg/eyJjb2RlIjoiZmxvd2NoYXJ0IFRCXG5zdWJncmFwaCBHU0ZbXCJHbG9iYWwgU3luY2hyb25pemVyIChzeW5jLmdsb2JhbClcIl1cblNFUVtTZXF1ZW5jZXIgTm9kZV1cbk1FRFtNZWRpYXRvciBOb2RlXVxuU0NBTltTY2FuIE5vZGVdXG5lbmRcbiUlLVxuc3ViZ3JhcGggUGFydGljaXBhbnRzXG5QQVtQYXJ0aWNpcGFudCBBPGJyLz5CYW5rIFhdXG5QQltQYXJ0aWNpcGFudCBCPGJyLz5CYW5rIFldXG5QQ1tQYXJ0aWNpcGFudCBDPGJyLz5FeGNoYW5nZV1cbmVuZFxuJSUtXG5zdWJncmFwaCBBcHBzXG5BQVtEQU1MIEFwcF1cbkFCW0RBTUwgQXBwXVxuQUNbREFNTCBBcHBdXG5lbmRcbiUlLVxuU0VRICYgTUVEICYgU0NBTiAtLT4gUEEgJiBQQiAmIFBDXG5QQSAtLT4gQUFcblBCIC0tPiBBQlxuUEMgLS0-IEFDIiwibWVybWFpZCI6bnVsbH0&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Each participant runs their own node, stores their own view of contracts they&apos;re party to, and submits transactions through the synchronizer.&lt;/p&gt;
  </description>
  <pubDate>2025-12-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/canton-cribsheet</link>
<guid isPermaLink="true">https://randomwits.com/blog/canton-cribsheet</guid>
</item>
<item>
  <title>Manage Your Dockerfiles Using Make</title>
  <description>&lt;p&gt;Managing multiple &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker-compose&lt;/code&gt; projects can become cumbersome. If you have separate services like Postgres, Kafka, and others, each with its own &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker-compose.yml&lt;/code&gt;, running commands across them can be repetitive. In this post, we&apos;ll explore a neat way to simplify this using a master &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt;.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;The idea is to have a single entry point to start and stop all your services, without having to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd&lt;/code&gt; into each directory.&lt;/p&gt;
    &lt;h3 id=&quot;project-structure&quot;&gt;Project Structure&lt;/h3&gt;
    &lt;p&gt;Let&apos;s organize our project like this:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;masterImages/
    ├── Makefile
    ├── postgres/
    │   ├── docker-compose.yml
    │   ├── init-scripts/
    │   │   └── 01-init-schema.sql
    │   └── Makefile
    └── kafka/
    ├── docker-compose.yml
    └── Makefile
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;masterImages&lt;/code&gt; directory will contain our master &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt; and subdirectories for each service.&lt;/p&gt;
    &lt;h3 id=&quot;the-master-makefile&quot;&gt;The Master Makefile&lt;/h3&gt;
    &lt;p&gt;First, create the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;masterImages&lt;/code&gt; directory and the main &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt; within it.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;masterImages
    &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;masterImages
    &lt;span class=&quot;nb&quot;&gt;touch &lt;/span&gt;Makefile
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now, add the following content to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;masterImages/Makefile&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/99fd2473fc4531b4158281654c7ff613.js?file=Makefile&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This master &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt; is the heart of our setup. It redirects &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;make&lt;/code&gt; commands to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt; inside the respective service directory. For instance, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;make postgres start&lt;/code&gt; will execute the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;start&lt;/code&gt; target in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgres/Makefile&lt;/code&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;postgres-service&quot;&gt;Postgres Service&lt;/h3&gt;
    &lt;p&gt;Now, let&apos;s set up the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgres&lt;/code&gt; service.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; postgres/init-scripts
    &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;postgres
    &lt;span class=&quot;nb&quot;&gt;touch &lt;/span&gt;Makefile docker-compose.yml init-scripts/01-init-schema.sql
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;postgres-makefile&quot;&gt;Postgres Makefile&lt;/h4&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgres/Makefile&lt;/code&gt; is simple:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/99fd2473fc4531b4158281654c7ff613.js?file=MakefilePostgres&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h4 id=&quot;postgres-docker-compose&quot;&gt;Postgres Docker Compose&lt;/h4&gt;
    &lt;p&gt;Here is the content for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgres/docker-compose.yml&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/99fd2473fc4531b4158281654c7ff613.js?file=postgress.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h4 id=&quot;postgres-init-script&quot;&gt;Postgres Init Script&lt;/h4&gt;
    &lt;p&gt;And the initialization script &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgres/init-scripts/01-init-schema.sql&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/99fd2473fc4531b4158281654c7ff613.js?file=01-init-schema.sql&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;kafka-service&quot;&gt;Kafka Service&lt;/h3&gt;
    &lt;p&gt;Similarly, for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka&lt;/code&gt; service:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;kafka
    &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;kafka
    &lt;span class=&quot;nb&quot;&gt;touch &lt;/span&gt;Makefile docker-compose.yml
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;kafka-makefile&quot;&gt;Kafka Makefile&lt;/h4&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka/Makefile&lt;/code&gt; is identical to the Postgres one:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/99fd2473fc4531b4158281654c7ff613.js?file=MakefilePostgres&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h4 id=&quot;kafka-docker-compose&quot;&gt;Kafka Docker Compose&lt;/h4&gt;
    &lt;p&gt;And the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka/docker-compose.yml&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/99fd2473fc4531b4158281654c7ff613.js?file=kafkaDockerCompose.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;usage&quot;&gt;Usage&lt;/h3&gt;
    &lt;p&gt;Now, from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;masterImages&lt;/code&gt; directory, you can manage your services like this:&lt;/p&gt;
    &lt;p&gt;To start the Postgres service:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make postgres start
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To stop the Postgres service:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make postgres stop
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To start the Kafka cluster:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make kafka start
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;And to stop it:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make kafka stop
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This approach keeps your projects organized and makes them easy to manage from a single place.&lt;/p&gt;
  </description>
  <pubDate>2025-12-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/manage-dockerfiles-using-make</link>
<guid isPermaLink="true">https://randomwits.com/blog/manage-dockerfiles-using-make</guid>
</item>
<item>
  <title>Daily Logs for Nov 28, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;us-immigration&quot;&gt;U.S. Immigration&lt;/h2&gt;
    &lt;p&gt;USCIS Director Joseph B. Edlow tweeted&lt;sup id=&quot;fnref:edlow&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:edlow&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;At the direction of &lt;span&gt;@&lt;/span&gt;POTUS, I have directed a full scale, rigorous reexamination of every Green Card for every alien from every country of concern.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Vetting for green card applications have become more stringent under Trump&apos;s second term. USCIS had earlier said that it would now interview neighbors, coworkers, or employers of naturalization applicants to confirm eligibility for U.S. citizenship&lt;sup id=&quot;fnref:uscis&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:uscis&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;5-day-ai-agents&quot;&gt;5 day AI Agents&lt;/h2&gt;
    &lt;p&gt;I saw tweet by Lenonie&lt;sup id=&quot;fnref:leonie&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:leonie&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Recently, &lt;span&gt;@&lt;/span&gt;kaggle hosted the &quot;5-day AI Agents Intensive Course&quot; and here are my study notes:&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;This is the &lt;a href=&quot;https://www.kaggle.com/learn-guide/5-day-agents&quot;&gt;official website&lt;/a&gt; on Kaggle.&lt;/p&gt;
    &lt;p&gt;I read the whitepaper on &lt;strong&gt;Introdution to Agents&lt;/strong&gt;&lt;sup id=&quot;fnref:agents&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:agents&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;. Some rough notes:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Traditionaly we used models using prompt that generated text.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Agents are LM in a loop with tools to perform tasks.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:edlow&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Joseph B. Edlow&apos;s &lt;a href=&quot;https://x.com/USCISJoe/status/1994114271844676047&quot;&gt;tweet&lt;/a&gt; &lt;a href=&quot;#fnref:edlow&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:uscis&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.boundless.com/blog/uscis-neighborhood-checks-naturalization&quot;&gt;USCIS Resumes Neighborhood Checks for Citizenship Applicants&lt;/a&gt; &lt;a href=&quot;#fnref:uscis&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:leonie&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://x.com/helloiamleonie/status/1993718895862226947&quot;&gt;Leonie on X&lt;/a&gt; &lt;a href=&quot;#fnref:leonie&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:agents&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://drive.google.com/file/d/1C-HvqgxM7dj4G2kCQLnuMXi1fTpXRdpx/view&quot;&gt;Introduction to Agents&lt;/a&gt; &lt;a href=&quot;#fnref:agents&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-11-28T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-11-28</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-11-28</guid>
</item>
<item>
  <title>Daily Logs for Nov 23, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;el-vocho-and-ambassador&quot;&gt;El Vocho and Ambassador&lt;/h2&gt;
    &lt;p&gt;I was playing Forza Horizon 5. I came to know about &lt;strong&gt;El Vocho&lt;/strong&gt;. Once very popular car in mexico. In India, we had ambassador which were ubiquitous. It was the symbol of everyday life.&lt;/p&gt;
    &lt;p&gt;Vocho were also used by taxis as it was easy to maintain. However it&apos;s no longer used in Mexico.&lt;/p&gt;
  </description>
  <pubDate>2025-11-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-11-23</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-11-23</guid>
</item>
<item>
  <title>Daily Logs for Nov 22, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;uv&quot;&gt;uv&lt;/h2&gt;
    &lt;p&gt;&lt;strong&gt;uv&lt;/strong&gt; is the package manager for python. Just like poetry. It&apos;s written in rust.&lt;/p&gt;
    &lt;p&gt;Usage&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-LsSf&lt;/span&gt; https://astral.sh/uv/install.sh | sh
    uv &lt;span class=&quot;nb&quot;&gt;sync&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# install dependencies&lt;/span&gt;
    uv run &amp;lt;script&amp;gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;dexter&quot;&gt;dexter&lt;/h2&gt;
    &lt;p&gt;it&apos;s an AI financial agent. Usage&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/virattt/dexter &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_&lt;/span&gt;
    uv &lt;span class=&quot;nb&quot;&gt;sync
    cp &lt;/span&gt;env.example .env
    &lt;span class=&quot;c&quot;&gt;# add this value inside OPENAI_API_KEY=&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# you need to add credits,  for  info https://platform.openai.com/settings/organization/billing/overview&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# get API KEYS from here https://platform.openai.com/api-keys and https://www.financialdatasets.ai/&lt;/span&gt;
    uv run dexter-agent
    What was Apple&lt;span class=&quot;s1&quot;&gt;&apos;s revenue growth over the last 4 quarters?
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2025-11-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-11-22</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-11-22</guid>
</item>
<item>
  <title>Review Book - Build a large language model</title>
  <description>&lt;p&gt;Below are my rough notes while reading the &lt;a href=&quot;/books/&quot;&gt;build-a-large-language-model-book&lt;/a&gt;.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Below are my rough notes while reading the &lt;a href=&quot;/books/&quot;&gt;build-a-large-language-model-book&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;LLM are deep neural networks trained on massive amount of text data. The &quot;large&quot; in &lt;strong&gt;LLM&lt;/strong&gt; refers to both the models&apos;s size in terms of parameters and immense dataset on which it&apos;s trained.&lt;/p&gt;
    &lt;p&gt;LLM utilize an architecture called the &lt;strong&gt;transformer&lt;/strong&gt;, which allows them to pay selective attention to different parts of the input when making predictions. Since LLM are capable pof generating text, LLM are also called generative AI. Transfer architecture was first introducted in 2017 paper called &lt;strong&gt;Attention is All You Need&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt;There are other variation of &lt;strong&gt;transformer&lt;/strong&gt; architecture like &lt;strong&gt;BERT&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt;General process of creating LLM includes &lt;strong&gt;pretraining&lt;/strong&gt; and &lt;strong&gt;fine-tuning&lt;/strong&gt;. &quot;pre&quot; in &lt;strong&gt;pretraining&lt;/strong&gt; refers to inital phase where a model like a LLM is trained on a large, diverse dataset (raw text). This pretrained model then serves as a foundation resource that can be further refined through &lt;strong&gt;fine-tuning&lt;/strong&gt;, a process where model is specifically trained on a narrow dataset for a specific task.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Fine-tuning&lt;/strong&gt; has two categories&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;instruction fine tuning&lt;/strong&gt;:  labelled dataset consist of instruction and answer pairs.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;classification fine tuning&lt;/strong&gt;: labelled dataset consist of texts and associated class label.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;GPT stands for generative pretrained transformer. &lt;strong&gt;GPT&lt;/strong&gt; models are adept at :&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Zero shot learning&lt;/strong&gt;: Generalize a completely unseen task&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Few shot learning&lt;/strong&gt;: Learning from minimal number of examples which the user provides&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
  </description>
  <pubDate>2025-11-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/review-book-build-a-large-language-model</link>
<guid isPermaLink="true">https://randomwits.com/blog/review-book-build-a-large-language-model</guid>
</item>
<item>
  <title>Kafka Consumers with Reactive OAuth2 in Non-HTTP Contexts</title>
  <description>&lt;p&gt;When integrating Kafka consumers with reactive OAuth2 for securing outbound HTTP calls, a common pitfall arises: Kafka processing typically operates in a background, non-HTTP context. This means there&apos;s no &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServerWebExchange&lt;/code&gt; available, which is a core component of the reactive web stack that exposes the current HTTP request/response and request-scoped attributes.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When integrating Kafka consumers with reactive OAuth2 for securing outbound HTTP calls, a common pitfall arises: Kafka processing typically operates in a background, non-HTTP context. This means there&apos;s no &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServerWebExchange&lt;/code&gt; available, which is a core component of the reactive web stack that exposes the current HTTP request/response and request-scoped attributes.&lt;/p&gt;
    &lt;h3 id=&quot;why-serverwebexchange-is-absent-in-kafka-consumers&quot;&gt;Why &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServerWebExchange&lt;/code&gt; is Absent in Kafka Consumers&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Kafka&apos;s Nature:&lt;/strong&gt; Kafka consumers are designed to read messages from topics. They do not inherently make or receive HTTP requests. Any HTTP API calls made by a consumer are initiated from within the consumer&apos;s processing logic, not as a direct response to an incoming HTTP request.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServerBearerExchangeFilterFunction&lt;/code&gt; Limitations:&lt;/strong&gt; While &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServerBearerExchangeFilterFunction&lt;/code&gt; might seem like a solution, it relies on the presence of a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServerWebExchange&lt;/code&gt; to extract a bearer token. It&apos;s designed for scenarios where an HTTP request is actively being processed. If your Kafka processing happens to be part of an existing HTTP request flow (which is rare), it might appear to work, but this is not its intended use for background tasks.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;the-problem-with-server-side-oauth2-helpers&quot;&gt;The Problem with Server-Side OAuth2 Helpers&lt;/h3&gt;
    &lt;p&gt;Server-side helpers like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServerOAuth2AuthorizedClientExchangeFilterFunction&lt;/code&gt; or any component that depends on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServerWebExchange&lt;/code&gt; will inevitably fail in background contexts with errors such as &quot;ServerWebExchange can&apos;t be null&quot;. This is because these components are built to operate within the lifecycle of an HTTP request.&lt;/p&gt;
    &lt;h3 id=&quot;the-solution-programmatic-client-credentials-grant&quot;&gt;The Solution: Programmatic Client Credentials Grant&lt;/h3&gt;
    &lt;p&gt;For Kafka consumers and other non-HTTP contexts, the client-credentials grant flow must be handled programmatically. This involves configuring a reactive OAuth2 client stack that can obtain and manage tokens independently of an HTTP request.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Key Components for a Reactive OAuth2 Client Stack:&lt;/strong&gt;&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReactiveClientRegistrationRepository&lt;/code&gt;&lt;/strong&gt;: Manages client registrations, providing details about OAuth2 clients (e.g., client ID, client secret, authorization grant type).&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;InMemoryReactiveOAuth2AuthorizedClientService&lt;/code&gt;&lt;/strong&gt;: Stores and retrieves &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OAuth2AuthorizedClient&lt;/code&gt; instances in memory. For production, consider a persistent store.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager&lt;/code&gt;&lt;/strong&gt;: This manager is responsible for authorizing OAuth2 clients. It uses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ReactiveClientRegistrationRepository&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;InMemoryReactiveOAuth2AuthorizedClientService&lt;/code&gt; to obtain and refresh tokens. Crucially, it needs to be configured with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clientCredentials()&lt;/code&gt; provider for non-HTTP contexts.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;&lt;strong&gt;Minimal Sketch (Reactive, Conceptual):&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;The following code snippet illustrates how to set up and use these components to obtain an OAuth2 token and attach it to a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebClient&lt;/code&gt; request:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.security.oauth2.client.AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.security.oauth2.client.InMemoryReactiveOAuth2AuthorizedClientService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.security.oauth2.client.OAuth2AuthorizeRequest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.security.oauth2.client.web.reactive.function.client.ReactiveOAuth2AuthorizedClientProviderBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.springframework.web.reactive.function.client.WebClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Assume &apos;regs&apos; is an instance of ReactiveClientRegistrationRepository,&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// configured with your client registration details (e.g., &quot;service-client&quot;).&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ReactiveClientRegistrationRepository&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;regs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Initialize the client service to store authorized clients.&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;InMemoryReactiveOAuth2AuthorizedClientService&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clientService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InMemoryReactiveOAuth2AuthorizedClientService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;regs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Configure the authorized client manager for client_credentials grant.&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;manager&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;regs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clientService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;manager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setAuthorizedClientProvider&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ReactiveOAuth2AuthorizedClientProviderBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;builder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;clientCredentials&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Create an authorization request for your service client.&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;OAuth2AuthorizeRequest&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;authReq&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OAuth2AuthorizeRequest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;withClientRegistrationId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;service-client&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;principal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;kafka-worker&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// A principal name for the authorization request&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Use the manager to obtain an OAuth2AuthorizedClient and then make a WebClient call.&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;manager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;authorize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;authReq&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;flatMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;authorizedClient&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Build your WebClient (e.g., using WebClient.builder().build())&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;WebClient&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webClient&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;WebClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;builder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;uri&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://api.example.com&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setBearerAuth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;authorizedClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getAccessToken&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getTokenValue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()))&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;retrieve&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;bodyToMono&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;API Response: &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Error calling API: &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2025-11-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/kafka-consumers-reactive-oauth2</link>
<guid isPermaLink="true">https://randomwits.com/blog/kafka-consumers-reactive-oauth2</guid>
</item>
<item>
  <title>Cribsheet for Vim</title>
  <description>&lt;p&gt;vim is a text editor that is a clone of the vi editor.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;vim is a text editor that is a clone of the vi editor.&lt;/p&gt;
    &lt;h3 id=&quot;overview&quot;&gt;Overview&lt;/h3&gt;
    &lt;p&gt;vim has two &quot;modes&quot;: COMMAND mode and INSERT mode. In COMMAND mode, you execute commands (like undo, redo, find and replace, quit, etc.). In INSERT mode, you type text. There is a third mode, VISUAL mode, that is used to highlight and edit text in bulk. To go into INSERT mode from COMMAND mode, you type i. To go back to COMMAND mode, you type the esc key. vim starts out in COMMAND mode.&lt;/p&gt;
    &lt;h3 id=&quot;reloading-a-file&quot;&gt;Reloading a file&lt;/h3&gt;
    &lt;p&gt;If a file has been changed on disk, you can reload it in Vim without closing and reopening it.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:e
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;useful-set-commands&quot;&gt;Useful &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set&lt;/code&gt; commands&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set wrap&lt;/code&gt; - This will wrap long lines of text.&lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set ai&lt;/code&gt; - This stands for &quot;autoindent&quot; and will automatically indent new lines.&lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2025-11-01T17:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/cribsheet-for-vim</link>
<guid isPermaLink="true">https://randomwits.com/blog/cribsheet-for-vim</guid>
</item>
<item>
  <title>Useful LLM Prompts</title>
  <description>&lt;p&gt;List of LLM prompts that I have found useful. I will be updating this list over time.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;List of LLM prompts that I have found useful. I will be updating this list over time.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Act as a Prompt Engineer, review the following prompt for me. optimize it to make it better and ask me any questions before proceedings: Your rough draft&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Do a dry run of the code to identify bugs, unnecessary code or we missed anything. the code is suppose to be simple  and legible&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Do a PR review of the branch x against main. First check should have look for obvious code smells , programming bugs, anti-pattern or deviation from best practices. Do a dry run with sample data and check for the logic of the application. Secondaly, check if there&apos;s a race condition or code that&apos;s not scalable.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2025-11-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/useful-llm-prompts</link>
<guid isPermaLink="true">https://randomwits.com/useful-llm-prompts</guid>
</item>
<item>
  <title>Review of Oxygen - The Molecule that made the World</title>
  <description>&lt;p&gt;These are my rough notes while reading this book.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;These are my rough notes while reading this book&lt;/p&gt;
    &lt;p&gt;Nitrates in food are used as preservatives, especially in processed meats like bacon and sausages. When these foods are deep-fried or cooked at high temperatures, the nitrates can react to form &lt;strong&gt;nitrosamines&lt;/strong&gt;, compounds known to be &lt;strong&gt;carcinogenic&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt;The saying &quot;diamonds are forever&quot; comes with a caveat. Diamonds are forever only in the &lt;strong&gt;absence of oxygen&lt;/strong&gt;. In an oxygen-rich environment and at extremely high temperatures, diamonds can &lt;strong&gt;burn and convert to carbon dioxide (CO&lt;sub&gt;2&lt;/sub&gt;)&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Lavoisier&lt;/strong&gt;, the French chemist, played a crucial role in our understanding of oxygen. He demonstrated that &lt;strong&gt;combustion&lt;/strong&gt; (burning) and &lt;strong&gt;respiration&lt;/strong&gt; (breathing) are fundamentally the same process—both involve the reaction of oxygen with other substances to release energy. He was &lt;strong&gt;executed by guillotine&lt;/strong&gt; during the French Revolution, despite his immense contributions to science.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Potassium nitrate (KNO&lt;sub&gt;3&lt;/sub&gt;)&lt;/strong&gt;, also known as saltpeter, is used in fertilizers and gunpowder. When mixed with acids, it can release nitric acid, historically called &lt;strong&gt;aqua fortis&lt;/strong&gt; or “acid of nitre.” Combined with hydrochloric acid, it forms &lt;strong&gt;aqua regia&lt;/strong&gt;, one of the few substances capable of dissolving gold.&lt;/p&gt;
    &lt;p&gt;Does oxygen accelerate aging? Oxygen is essential for life, but it’s also inherently damaging. &lt;strong&gt;Reactive oxygen species (ROS)&lt;/strong&gt;—byproducts of normal metabolism—can damage DNA, proteins, and cell membranes. This oxidative stress is a key factor in &lt;strong&gt;aging and many degenerative diseases&lt;/strong&gt;.
    Even moderate increases in oxygen concentration can harm tissues. For instance, breathing &lt;strong&gt;pure oxygen&lt;/strong&gt; for extended periods causes &lt;strong&gt;lung inflammation&lt;/strong&gt; and other toxic effects. Experiments have shown that exposure to air containing just &lt;strong&gt;33% oxygen&lt;/strong&gt; (instead of the normal 21%) can cause serious inflammation over time.&lt;/p&gt;
    &lt;p&gt;However, oxygen is also life-saving in controlled medical use. People with &lt;strong&gt;pneumonia or respiratory distress&lt;/strong&gt; benefit from supplemental oxygen because it increases the amount of oxygen available to damaged lungs. Likewise, people living at &lt;strong&gt;high altitudes&lt;/strong&gt; (where oxygen levels are lower) often develop physiological adaptations like higher red blood cell counts to compensate for reduced oxygen availability.&lt;/p&gt;
    &lt;p&gt;In the early days of diving, some rebreathers used &lt;strong&gt;pure oxygen&lt;/strong&gt;. But divers soon learned that breathing pure oxygen under pressure causes &lt;strong&gt;oxygen toxicity&lt;/strong&gt;, leading to convulsions or even death underwater. Today, scuba divers use carefully balanced &lt;strong&gt;gas mixtures&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Air (21% O₂, 78% N₂)&lt;/strong&gt; for most recreational dives.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Nitrox (32–36% O₂)&lt;/strong&gt; for extended bottom times at moderate depths.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Trimix or Heliox&lt;/strong&gt; (oxygen diluted with helium or nitrogen) for deep dives to avoid both nitrogen narcosis and oxygen toxicity.&lt;br /&gt;
    Pure oxygen is still used, but only at &lt;strong&gt;very shallow depths&lt;/strong&gt; or during &lt;strong&gt;decompression stops&lt;/strong&gt;.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;The first great mass extinction on Earth was ironically caused by oxygen. Around &lt;strong&gt;2.4 billion years ago&lt;/strong&gt;, during the &lt;strong&gt;Great Oxygenation Event&lt;/strong&gt;, photosynthetic &lt;strong&gt;cyanobacteria&lt;/strong&gt; began releasing large amounts of oxygen into the atmosphere. For most existing life—which was &lt;strong&gt;anaerobic&lt;/strong&gt; (thrived without oxygen)—this new gas was toxic. The buildup of oxygen wiped out much of early microbial life and dramatically changed Earth’s chemistry, paving the way for the evolution of more complex, aerobic organisms.&lt;/p&gt;
  </description>
  <pubDate>2025-10-27T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/review-oxygen-the-molecule-that-made-the-world</link>
<guid isPermaLink="true">https://randomwits.com/blog/review-oxygen-the-molecule-that-made-the-world</guid>
</item>
<item>
  <title>Publish / Subscribe to Kafka locally</title>
  <description>&lt;p&gt;Apache Kafka is a distributed streaming platform designed for building real-time data pipelines and streaming applications. Originally developed by LinkedIn, Kafka excels at handling high-throughput, fault-tolerant publish-subscribe messaging between systems.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Apache Kafka is a distributed streaming platform designed for building real-time data pipelines and streaming applications. Originally developed by LinkedIn, Kafka excels at handling high-throughput, fault-tolerant publish-subscribe messaging between systems.&lt;/p&gt;
    &lt;h2 id=&quot;core-concepts&quot;&gt;Core Concepts&lt;/h2&gt;
    &lt;p&gt;Before diving into the setup, let&apos;s understand Kafka&apos;s fundamental concepts:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Broker&lt;/strong&gt;: A Kafka server that stores and serves data&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Topic&lt;/strong&gt;: A logical channel for organizing messages, similar to database tables&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Partition&lt;/strong&gt;: Topics are split into partitions for scalability and parallelism&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Producer&lt;/strong&gt;: Applications that publish messages to topics&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Consumer&lt;/strong&gt;: Applications that subscribe to topics and process messages&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Zookeeper&lt;/strong&gt;: Coordinates cluster metadata and leader election (being phased out in newer versions)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;local-development-setup&quot;&gt;Local Development Setup&lt;/h2&gt;
    &lt;p&gt;For local development, we&apos;ll use Docker Compose to orchestrate Kafka and its dependencies. This approach provides isolated, reproducible environments without cluttering your system.&lt;/p&gt;
    &lt;h3 id=&quot;docker-compose-configuration&quot;&gt;Docker Compose Configuration&lt;/h3&gt;
    &lt;p&gt;Our setup includes three services:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Zookeeper&lt;/strong&gt; - Manages cluster coordination and configuration&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Kafka&lt;/strong&gt; - The main message broker&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Kafka-init&lt;/strong&gt; - Initializes topics and waits for Kafka readiness&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/73b1f793093ead650f00dbdc2d11d145.js?file=docker-compose.yml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;configuration-breakdown&quot;&gt;Configuration Breakdown&lt;/h3&gt;
    &lt;h4 id=&quot;zookeeper-service&quot;&gt;Zookeeper Service&lt;/h4&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;ZOOKEEPER_CLIENT_PORT&lt;/strong&gt;: Port for client connections (standard is 2181)&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;ZOOKEEPER_TICK_TIME&lt;/strong&gt;: Basic time unit in milliseconds for heartbeats&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Volumes&lt;/strong&gt;: Persistent storage for Zookeeper data and transaction logs&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;kafka-service&quot;&gt;Kafka Service&lt;/h4&gt;
    &lt;p&gt;Key environment variables explained:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;KAFKA_BROKER_ID&lt;/strong&gt;: Unique identifier for this broker in the cluster&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;KAFKA_ZOOKEEPER_CONNECT&lt;/strong&gt;: Connection string to Zookeeper ensemble&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;KAFKA_ADVERTISED_LISTENERS&lt;/strong&gt;: How clients should connect to this broker&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR&lt;/strong&gt;: Set to 1 for single-broker development&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;KAFKA_AUTO_CREATE_TOPICS_ENABLE&lt;/strong&gt;: Automatically creates topics when referenced&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;⚠️ &lt;strong&gt;Important&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ADVERTISED_LISTENERS&lt;/code&gt; must match how you&apos;ll access Kafka. Use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:9092&lt;/code&gt; for local development.&lt;/p&gt;
    &lt;h4 id=&quot;kafka-init-service&quot;&gt;Kafka-init Service&lt;/h4&gt;
    &lt;p&gt;This utility container:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Waits for Kafka to be fully ready&lt;/li&gt;
    &lt;li&gt;Creates the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test-topic&lt;/code&gt; with 1 partition and replication factor of 1&lt;/li&gt;
    &lt;li&gt;Exits after initialization (restart: &quot;no&quot;)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;starting-the-environment&quot;&gt;Starting the Environment&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker compose up
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Wait for all services to be ready. You should see logs indicating Kafka is accepting connections and the test-topic has been created.&lt;/p&gt;
  </description>
  <pubDate>2025-09-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/publish-subscribe-to-kafka-locally</link>
<guid isPermaLink="true">https://randomwits.com/blog/publish-subscribe-to-kafka-locally</guid>
</item>
<item>
  <title>Daily Logs for Sep 22, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;spring-boot-startup-lifecycle&quot;&gt;Spring Boot Startup Lifecycle&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Spring Boot has IoC (Inversion of Control) container that manages all the bean initialization. This is also called dependency injection — it creates beans, wires them together, and keeps them alive for you.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Next Spring Boot calls lifecycle hooks like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PostConstruct&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BeanPostProcessor&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;InitializingBean&lt;/code&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PostConstruct&lt;/code&gt; runs once per bean, right after its dependencies are set. It&apos;s NOT global — each bean gets its own &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PostConstruct&lt;/code&gt; moment.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;After &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PostConstruct&lt;/code&gt; and post-processing, Spring fires the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ContextRefreshedEvent&lt;/code&gt;. This is fired when &lt;strong&gt;Application Context&lt;/strong&gt; is fully loaded.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Right after that, if you have any &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CommandLineRunner&lt;/code&gt; beans, Spring runs them — in order, if you used &lt;strong&gt;Order&lt;/strong&gt;. This is your last chance to run code before the server starts.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If you have any beans that implement &lt;strong&gt;SmartLifecycle (and isAutoStartup() returns true)&lt;/strong&gt;, Spring will call their start() method right after ContextRefreshedEvent but BEFORE the server starts — basically around the same time as CommandLineRunner, but you can control the order with getPhase().&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;THEN — and only then — Spring starts the embedded server (Tomcat, Netty, etc). It binds to the port (like 8080), starts threads, and gets ready to accept requests.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Once the server is up and the app is truly ready to serve traffic (and health checks are green, if you’re using them), Spring fires the &lt;strong&gt;ApplicationReadyEvent&lt;/strong&gt;. This is the “green light” — your app is LIVE.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;when-to-use-what&quot;&gt;When to Use What?&lt;/h3&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Hook / Event&lt;/th&gt;
    &lt;th&gt;Vibe 💬&lt;/th&gt;
    &lt;th&gt;Best For&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@PostConstruct&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&quot;I’m a bean — I’m setting up **MYSELF**.&quot;&lt;/td&gt;
    &lt;td&gt;Bean-specific init: open connection, load config, validate deps&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SmartLifecycle&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&quot;I’m a background worker — start me when the app is ready, **but before traffic**.&quot;&lt;/td&gt;
    &lt;td&gt;Long-running services: pollers, listeners, async processors (with graceful stop)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CommandLineRunner&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&quot;I’m a **script** — run me **once**, after everything’s wired, **before the server opens**.&quot;&lt;/td&gt;
    &lt;td&gt;One-time setup: preload data, print args, warm cache, send startup log&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ApplicationReadyEvent&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&quot;**Server is live** — now do your final thing.&quot;&lt;/td&gt;
    &lt;td&gt;Final go-live tasks: call health endpoints, notify Slack, start polling external APIs&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;fluxiterable-in-java-reactive&quot;&gt;Flux.Iterable in Java Reactive&lt;/h2&gt;
    &lt;p&gt;Both of these are equivalent&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;just&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;cat&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;dog&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fromIterable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;cat&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;dog&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;For small fixed values, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Flux.just&lt;/code&gt; is fine. When working with an existing collection or a large list, prefer &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Flux.fromIterable&lt;/code&gt;, since &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Flux.just&lt;/code&gt; is not designed to take a collection directly and can lead to performance issues if used that way.&lt;/p&gt;
    &lt;h2 id=&quot;tweet-from-alexander-duncan&quot;&gt;Tweet from Alexander Duncan&lt;/h2&gt;
    &lt;p&gt;Alexander Duncan is a Republican Candidate for U.S. Senate. I saw this tweet about Hinduism:&lt;/p&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Why are we allowing a false statue of a false Hindu God to be here in Texas? We are a CHRISTIAN nation!&lt;a href=&quot;https://t.co/uAPJegLie0&quot;&gt;pic.twitter.com/uAPJegLie0&lt;/a&gt;&lt;/p&gt;&amp;mdash; Alexander Duncan (@AlexDuncanTX) &lt;a href=&quot;https://twitter.com/AlexDuncanTX/status/1969442156264689949?ref_src=twsrc%5Etfw&quot;&gt;September 20, 2025&lt;/a&gt;&lt;/blockquote&gt;
    &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2025-09-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-09-22</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-09-22</guid>
</item>
<item>
  <title>Review of Pschology of Money</title>
  <description>&lt;p&gt;These are my rough notes while reading this book.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;These are my rough notes while reading this book&lt;/p&gt;
    &lt;p&gt;Most of the premise of the book seems to be &lt;strong&gt;wait and invest&lt;/strong&gt;. Let the money grow in compound interest over years.&lt;/p&gt;
    &lt;p&gt;He is not advocating any strategy to get rich quicker? He says highest returs are usually one-off hits that can&apos;t be repeated.&lt;/p&gt;
    &lt;p&gt;Jesse Livermore made a fortune when stocks collapsed in Great Depression of 1929. He shorted the stocks. I&apos;ve yet to learn to short the stock.&lt;/p&gt;
    &lt;p&gt;Getting money requires taking risk. But staying wealthy requires opposite of taking risk. It requires frugality and acceptance of the fact that some of your success is attributed to luck which can&apos;t be repeated.&lt;/p&gt;
    &lt;p&gt;Jim Simmons achieved better investment returns than Warren Buffett. Yet he was less wealthy than Buffett. The main reason was that Warren Buffett started investing at young age, and compounded his money for decades. In contrast, Jim Simmons began investing around his 40s.&lt;/p&gt;
    &lt;p&gt;Having a six-month emergency fund and save 10% of your salary.&lt;/p&gt;
    &lt;p&gt;Bill Gates went to one of the only high schools in the world that had a computer (Lakeside School).&lt;/p&gt;
    &lt;p&gt;Economist Bhaskhar Mazumder has shown that incomes among brothers are more correlated than height or weight. If you are rich and tall, your brother is more likely to also be rich than he is tall. I think most of us intuitively know this to be true - the quality of your educations and the doors that open for you are heavily linked to your parents&apos; socio-econmomic status.&lt;/p&gt;
    &lt;p&gt;..think Mark Zuckerberg is a genius for turning down Yahoo!&apos;s 2006 $1 billion offer to buy his company. But people criticize Yahoo! for turning down buyout offer from Microsoft.&lt;/p&gt;
    &lt;p&gt;40% of all Russell 3000 stock components lost at least 70% of their value and never recovered…you have to achieved a certain level of success to become a public company and a member of Russell 3000.&lt;/p&gt;
    &lt;p&gt;No one talks about dud picks. Charlie Munger, &quot;If you remove just a few of Berkshire&apos;s top investments, its long-term track record is pretty average&quot;&lt;/p&gt;
    &lt;p&gt;Universal fuel of joy -it&apos;s that people want to control their lives.&lt;/p&gt;
    &lt;p&gt;99.9% of all companies that were created went out of business.&lt;/p&gt;
    &lt;p&gt;One study in America found that people overestimate the number of calories they burned in a workout by a factor of four.&lt;/p&gt;
    &lt;p&gt;The world is filled with people who look modest are actually wealthy and people who look rich who live at the razor&apos;s edge of insolvency.&lt;/p&gt;
    &lt;p&gt;Saving is a hedge against life&apos;s inevitable ability to surprise the hell out of you at the worst possible moment.&lt;/p&gt;
    &lt;p&gt;Day trading and picking individual stocks is not rational for most investors - the odds are heavily against your success.&lt;/p&gt;
    &lt;p&gt;Progress happens too slowly to notice, but setbacks happen tooo quickly to ignore. There are rarely overnight miracles.&lt;/p&gt;
    &lt;p&gt;B. H. Lidell Hart writes in is book &lt;strong&gt;Why Don&apos;t We learn from History ?&lt;/strong&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;[History] cannot be interpreted without the aid of imagination and intuition. The ssheer quantity of evidence is so overwhelming that selection is inevitable. Where there is selection there is art. Those who read history tend to look for what proves them right and confirms their personal opinions. They defend loyalities. They read with a purpose to affirm or to attack. They resist incovenient truth since everyone wants to be on the side of the angels. Just as we start wars to end all wars.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;We all want the complicated world we live in to make sense. So we tell ourselves stories to fill int he gaps of what are effectively bind spots.&lt;/p&gt;
    &lt;p&gt;Manage your money in a way that helps you sleep at night. Time is the most powerful force in investing. It can&apos;t neutralize luck and risk, but it pushes reusults closer to wards what people deserve.&lt;/p&gt;
    &lt;p&gt;Become OK with a  lot of things going wrong. You can be wrong half the time and still make a fortuen, because a samll minority of things account for the majority of outcomes.&lt;/p&gt;
    &lt;p&gt;Use money to gain control over your time, because not having control of yoru time is such a powerful and universal drag on happines. The ability to do what you want, when you want, with who you want, for as long as you want to, pays the highest dividend that exists in finance.&lt;/p&gt;
    &lt;p&gt;Be nicer and less flashy. No one is impressed with your possessions as much as you are. …you probably want is respect and admiration.&lt;/p&gt;
    &lt;p&gt;Save. Just save. You don&apos;t need  a specific reason to save.&lt;/p&gt;
    &lt;p&gt;Define the cost of success and be ready to pay it. Because nothing worthwhile is free.&lt;/p&gt;
    &lt;p&gt;You should like risk because it pays off over time. But you should be paranoid of ruinous risk because it prevents you from taking future risks that will pay off over time.&lt;/p&gt;
    &lt;p&gt;Half of all US mutal fund portfolia manasgers do not invest a cent of their own money in their funds, according to Morningstar. Ken Murray, a professor of medicine at USC, wrote essay &lt;strong&gt;How Doctors Die&lt;/strong&gt; that showed degree to which doctors choose different end-of-life treatments for themselves than theyh recommend for their patients.&lt;/p&gt;
    &lt;p&gt;Independence, to me, doens&apos;t mean you&apos;ll stop working. It means you only do the work you like with people you like at the times you want for as long as you want.&lt;/p&gt;
    &lt;p&gt;We&apos;ll have a high chance of meeting all our family&apos;s financial goals if we consistently invest money into a low-cost indes fund for decades… a combination of U.S. and international stocks. We max out retirment accoutns in the same funds, and contribue to our kid&apos;s 529 college savings plans.&lt;/p&gt;
    &lt;p&gt;Bendedict Evans says, &quot;The more the Internet exposes people to new points of view, the angrier people get that different views exist.&quot;&lt;/p&gt;
  </description>
  <pubDate>2025-09-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/review-book-psychology-of-money</link>
<guid isPermaLink="true">https://randomwits.com/blog/review-book-psychology-of-money</guid>
</item>
<item>
  <title>Daily Logs for Sep 12, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;glases&quot;&gt;Glases&lt;/h2&gt;
    &lt;p&gt;I hate to admit it, but I lost my glasses to my own tomfoolery. I was driving to work when it started raining. Usually, I never pull my glasses out of the bag, but I forgot Murphy’s law. I noticed some dust on them and thought, “How can I clean these?” My brain farted with a “brilliant” idea: just clean them with the rain.&lt;/p&gt;
    &lt;p&gt;So I did it—driving at 70 mph, opening the window, holding the glasses out to rinse them—only for the wind to mock me and snatch them away.&lt;/p&gt;
    &lt;p&gt;Now, I have to order my computer glasses again 🤦. Luckily, I still have a prescription from optometrist which expires this Nov. This means I can still purchase glasses with HSA.&lt;/p&gt;
    &lt;h2 id=&quot;steam-deck&quot;&gt;Steam Deck&lt;/h2&gt;
    &lt;p&gt;Previously, I was storing my non-Steam games in /home/deck/Games. This caused problems because /home/deck lives on the small root (/) partition of the Steam Deck (about ~25–30 GB). Once that partition filled up, I couldn’t install updates or other applications, even though the SSD still had plenty of space.&lt;/p&gt;
    &lt;p&gt;The fix was to move everything to:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/home/deck/.local/share/NonSteamGames
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.local/share&lt;/code&gt; path is on the large data partition where Steam normally installs its games, so it can actually use the full SSD space.&lt;/p&gt;
    &lt;p&gt;To add non-steam games, in Dolphin file explorer, press Ctrl + H to toggle hidden files/folders so you can access &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.local&lt;/code&gt;.&lt;/p&gt;
  </description>
  <pubDate>2025-09-12T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-09-12</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-09-12</guid>
</item>
<item>
  <title>Daily Logs for Sep 8, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;honda-safety-recall&quot;&gt;Honda Safety Recall&lt;/h2&gt;
    &lt;p&gt;If you ever got safety recall notice in mail, go to &lt;a href=&quot;https://owners.honda.com/service-maintenance/recalls&quot;&gt;Honda website&lt;/a&gt; and enter your VIN to verify.&lt;/p&gt;
    &lt;h2 id=&quot;kafka-listener-in-a-reactive-spring-java-app&quot;&gt;Kafka Listener in a Reactive Spring Java app&lt;/h2&gt;
    &lt;p&gt;In a traditional servlet-based Spring application, you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@KafkaListener&lt;/code&gt; to consume messages from a topic:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@KafkaListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topics&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;my-topic&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// handle message&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Spring manages this lifecycle automatically.&lt;/p&gt;
    &lt;p&gt;In a reactive application (WebFlux), there is no direct equivalent to @KafkaListener. Instead, you need to start your Kafka consumer explicitly. To understand where this fits, let’s look at Spring Boot’s lifecycle:&lt;/p&gt;
    &lt;h3 id=&quot;spring-boot-startup-order&quot;&gt;Spring Boot Startup Order&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;ApplicationContext initialization&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Spring container is created. No beans yet.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Bean creation and dependency injection&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Beans are instantiated and wired.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@PostConstruct&lt;/code&gt; methods&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Runs once after bean construction.&lt;/li&gt;
    &lt;li&gt;Good for bean setup (initialize fields, validate config).&lt;/li&gt;
    &lt;li&gt;Not for long-running tasks.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SmartLifecycle.start()&lt;/code&gt;&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Invoked on beans implementing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SmartLifecycle&lt;/code&gt;.&lt;/li&gt;
    &lt;li&gt;Best for long-running processes (e.g., Kafka consumers).&lt;/li&gt;
    &lt;li&gt;Supports clean start/stop hooks.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CommandLineRunner&lt;/code&gt; / &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ApplicationRunner&lt;/code&gt;&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Runs after the context is loaded.&lt;/li&gt;
    &lt;li&gt;Good for quick startup tasks (DB init, seed data).&lt;/li&gt;
    &lt;li&gt;Not lifecycle-managed.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ApplicationReadyEvent&lt;/code&gt; is published&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Fired when the app is ready.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Netty server fully ready&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Reactive server now accepts requests.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@EventListener(ApplicationReadyEvent.class)&lt;/code&gt;&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Runs after the app is fully ready.&lt;/li&gt;
    &lt;li&gt;Safe for startup code.&lt;/li&gt;
    &lt;li&gt;No clean shutdown support.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;using-applicationreadyevent&quot;&gt;Using ApplicationReadyEvent&lt;/h3&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@EventListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ApplicationReadyEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;consumeKafkaMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// start reactive Kafka consumer&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;:&lt;/p&gt;
    &lt;p&gt;Runs after the application is ready.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;:
    No built-in lifecycle management (no clean shutdown, no running status).&lt;/p&gt;
    &lt;h3 id=&quot;using-smartlifecycle&quot;&gt;Using SmartLifecycle&lt;/h3&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Service&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;KafkaService&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SmartLifecycle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;running&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// start Kafka consumer&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;running&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// stop Kafka consumer&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;running&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isRunning&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;running&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getPhase&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// ordering relative to other lifecycle beans&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;:&lt;/p&gt;
    &lt;p&gt;Integrates with Spring lifecycle&lt;/p&gt;
    &lt;p&gt;Supports clean startup and shutdown&lt;/p&gt;
    &lt;p&gt;Exposes running state&lt;/p&gt;
  </description>
  <pubDate>2025-09-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-09-08</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-09-08</guid>
</item>
<item>
  <title>Daily Logs for Sep 5, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot&quot;&gt;Snapshot&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A500:T508?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;opinion&quot;&gt;Opinion&lt;/h2&gt;
    &lt;h3 id=&quot;secularism&quot;&gt;Secularism&lt;/h3&gt;
    &lt;p&gt;&lt;a href=&quot;https://x.com/StateDept/status/1964008819475743179&quot;&gt;X&lt;/a&gt; post of US Department of State&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Our nation was founded on the recognition that moral virtue and a steadfast faith in God are necessary preconditions of freedom. Yet under the Biden Administration, U.S. foreign policy belittled Christianity and weaponized government against faith… That era has ended…Under POTUS’s leadership, the State Department will eradicate practices that devalue and demean the Christian faith.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Secularism is the separation of church and state. In practice, every U.S. president has been Christian and has taken the oath of office on a Bible. Many southern states are socially conservative and strongly religious.&lt;/p&gt;
    &lt;p&gt;In Alabama, part of the Bible Belt, public schools had banned yoga for decades due to its associations with Hinduism. In 2021 the state lifted the ban with conditions: only stretches and poses in English are allowed. Chanting, the sound “om,” the word “namaste,” and references to Eastern philosophy or religion remain prohibited&lt;sup id=&quot;fnref:bbc&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:bbc&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;In contrast, France follows the principle of laïcité (secularism), which establishes a stricter separation between religion and the state than in the U.S. French presidents do not swear an oath on a Bible during inauguration, and the state is prohibited from officially endorsing or opposing any particular religion.&lt;/p&gt;
    &lt;p&gt;Secularism in India is however peculiar. The Constitution of India explicitly includes secularism in its Preamble. However, the country does not have a uniform civil code — personal matters such as marriage, divorce, and inheritance, etc are different for different religion. Also, blasphemy laws exist in the Indian Penal Code, which make it an offense to deliberately insult or hurt religious beliefs. Criminal law in India, however, are uniform. Secularism in India often means &quot;Sarva Dharma Samabhava&quot; which means &quot;equal respect for all religion&quot;. This was coined by Gandhi since religion is prominent part of Indian society.&lt;/p&gt;
    &lt;p&gt;Personally I prefer laïcité since I am agnostic. However every country ultimately has the government (or the system) it deserves.&lt;/p&gt;
    &lt;h3 id=&quot;ice&quot;&gt;ICE&lt;/h3&gt;
    &lt;p&gt;ICE released video of Korean workers in Georgia’s Hyundai/ LG plant&lt;/p&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot; data-media-max-width=&quot;560&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;ICE released video of Korean workers in Georgia’s Hyundai/ LG plant being rounded up. Stunning to say the least. &lt;a href=&quot;https://t.co/79BJQEGn2d&quot;&gt;pic.twitter.com/79BJQEGn2d&lt;/a&gt;&lt;/p&gt;&amp;mdash; Jake Kwon (@therealjakekwon) &lt;a href=&quot;https://twitter.com/therealjakekwon/status/1964287207507677662?ref_src=twsrc%5Etfw&quot;&gt;September 6, 2025&lt;/a&gt;&lt;/blockquote&gt;
    &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;h2 id=&quot;refernces&quot;&gt;Refernces&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:bbc&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.bbc.com/news/57204355&quot;&gt;bbc&lt;/a&gt; &lt;a href=&quot;#fnref:bbc&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-09-06T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-09-06</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-09-06</guid>
</item>
<item>
  <title>Daily Logs for Sep 4, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;bing-images&quot;&gt;Bing Images&lt;/h2&gt;
    &lt;p&gt;How to download &lt;strong&gt;Bing&lt;/strong&gt;&apos;s background images? You can get the download url from &lt;a href=&quot;http://www.bing.com/HPImageArchive.aspx?format=js&amp;amp;idx=0&amp;amp;n=1&amp;amp;mkt=en-US&quot;&gt;JSON endpoint&lt;/a&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;project-reactor-examples&quot;&gt;Project Reactor Examples&lt;/h2&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/schananas/practical-reactor&quot;&gt;practical-reactor&lt;/a&gt; is a great repo to learn Project Reactor. First clone the repo&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Create a fork of the repo&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# Clone the repo&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;practical-reactor
    mvn clean &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next open the folder in your IDE and look at problems at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;exercises/src/test/java&lt;/code&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;notes&quot;&gt;Notes&lt;/h3&gt;
    &lt;p&gt;You can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;block&lt;/code&gt; on any publisher like&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Mono&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Mono&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;just&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// This will block until the value is available&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;  
    &lt;span class=&quot;c1&quot;&gt;// However, this is not recommended in reactive code since it blocks the thread&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// If you want to block with a timeout, do it like this:&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fooBar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Duration&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ofSeconds&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;When to use optional? Optional is mainly used to avoid &lt;strong&gt;NullPointerException&lt;/strong&gt; (NPE).&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Creates an Optional with a non-null value&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Optional&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Optional&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;someSequence&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// However, if someSequence is null, this will throw NPE&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isEmpty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Use ofNullable when the value could be null&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Optional&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Optional&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ofNullable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;someSequence&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// This won’t throw NPE&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isEmpty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;.subscribe()&lt;/strong&gt; is how you start processing a Flux or Mono. First case is &lt;strong&gt;fire and forget&lt;/strong&gt; like&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You can also handle emitted values like&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// handle each item&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You can provide up to three callbacks: Handling Items, Errors, and Completion&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/* onNext: handle each item */&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/* onError: handle errors */&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/* onComplete: handle completion */&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;fortuneTop5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;companyList:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;           &lt;span class=&quot;c1&quot;&gt;// onNext: add each item to the list&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{},&lt;/span&gt;                &lt;span class=&quot;c1&quot;&gt;// onError: do nothing&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;serviceCallCompleted&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// onComplete: set flag&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;threads-concepts-in-java&quot;&gt;Threads Concepts in Java&lt;/h2&gt;
    &lt;p&gt;Distinction between OS threads, platform threads and virtual threads?&lt;/p&gt;
    &lt;p&gt;An OS thread is managed by the kernel of the operating system. It has its own stack. To switch between threads, the OS performs a context switch, which may involve a system call. A system call is an elevated request to access kernel space, since user-space applications cannot access kernel space directly.&lt;/p&gt;
    &lt;p&gt;In Java, a platform thread is a wrapper around an OS thread. It has a 1-to-1 mapping with an OS thread. So when we create a thread:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Thread&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;thread&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{});&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;it actually creates a corresponding OS thread.&lt;/p&gt;
    &lt;p&gt;A &lt;strong&gt;virtual thread&lt;/strong&gt; (introduced with Project Loom) decouples the Java thread abstraction from platform threads. Virtual threads are scheduled by the JVM and can be multiplexed onto a smaller number of platform threads, allowing millions of virtual threads to exist efficiently while sharing the same pool of platform threads.&lt;/p&gt;
  </description>
  <pubDate>2025-09-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-09-04</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-09-04</guid>
</item>
<item>
  <title>Daily Logs for Aug 25, 2025</title>
  <description>&lt;p&gt;Dear Vishi, dear logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, dear logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;spring-data&quot;&gt;Spring Data&lt;/h2&gt;
    &lt;p&gt;Spring Data also added Reactive Streams support into the existing projects.&lt;/p&gt;
    &lt;p&gt;NoSQL support, such as Redis, MongoDB, Couchbase and Cassandra are the first-class citizen in the WebFlux world.&lt;/p&gt;
    &lt;p&gt;RDBMS support, such as JDBC and JPA are designated for blocking access will not work under the new WebFlux applications.&lt;/p&gt;
    &lt;p&gt;To resolve the problem, Spring team leads a new reactive specification R2dbc to access RDBMS. Similar to the JDBC specification, R2dbc provides a collection of standardized APIs and allow you to implement your own database drivers through r2dbc-spi. Currently, MySQL(and MariaDB), MSSQL, Oracle, H2, PostgresSQL have got support. Check the R2dbc &lt;a href=&quot;https://r2dbc.io/&quot;&gt;website&lt;/a&gt; for more info.&lt;/p&gt;
    &lt;p&gt;To create your Repository , create an interface to extend ReactiveCrudRepository or ReactiveSortingRepository or a subproject specific Repository. For example:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;PostRepository&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveCrudRepository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;PostRepository&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveSortingRepository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;PostRepository&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveMongoRepository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;a href=&quot;https://hantsy.github.io/spring-reactive-sample/start/&quot;&gt;Read more…&lt;/a&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;canton&quot;&gt;Canton&lt;/h2&gt;
    &lt;p&gt;Party ID is a logical identity in the Canton network, similar to a service account or a role in AWS IAM.&lt;/p&gt;
    &lt;p&gt;What Is a Validator Node? A validator node is essentially a container running in the network that helps upload and process DAML Archives (DARs). These DARs contain smart contracts written in DAML, which is a language for modeling business logic. Smart contracts are programs that live on the blockchain - in this case, Canton&apos;s ledger - and enforce rules automatically.&lt;/p&gt;
    &lt;p&gt;This is the prerequisite manual step before using ledger API for Canton to write to the blockchain.&lt;/p&gt;
    &lt;p&gt;Uploading DARs to a validator node is a prerequisite step before your applications can interact with the ledger via the Ledger API.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;+----------------+     1. Upload .dar     +---------------------+
    | Daml Team /    | ---------------------&amp;gt; | Canton Validator Node |
    | CI/CD Pipeline |      (daml deploy)     |                     |
    |                |                        | → DAML logic loaded  |
    |                |                        | → Rules enforced     |
    +----------------+                        +----------+----------+
    |
    | Runs Ledger API
    | (gRPC / JSON)
    |
    +----------------+     2. Use Ledger API             |
    | Your App       | ----------------------------------+
    | (Java/Rust)    |    (create contracts, query data)
    +----------------+
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;git-submodule&quot;&gt;Git SubModule&lt;/h2&gt;
    &lt;p&gt;Submodule is nice feature to refer another repo inside your own repo. However it&apos;s tied to the commit. To sycn your changes&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git submodule update &lt;span class=&quot;nt&quot;&gt;--remote&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--merge&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;online&quot;&gt;Online&lt;/h2&gt;
    &lt;h3 id=&quot;walmart&quot;&gt;Walmart&lt;/h3&gt;
    &lt;p&gt;I saw this tweet from US Senator Mike Lee&lt;sup id=&quot;fnref:lee&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:lee&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Is it time to pause H1-B visas? https://x.com/wallstreetmav/status/1959973681037226195&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;This post was based on a news article publised by &lt;a href=&quot;https://www.ctol.digital/news/walmart-fires-vp-kickbacks-terminates-1200-contractors/&quot;&gt;ctol.digital&lt;/a&gt;. I wanted to see how reputed this news organization is. On its &lt;a href=&quot;https://www.ctol.digital/contact/&quot;&gt;contact&lt;/a&gt; page, it says&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Your premier IT consultancy based in Switzerland 🇨🇭 for transformative tech solutions, unparalleled digital strategy excellence&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;This is their landing news page, now sure how much authentic it is 🤷&lt;/p&gt;
    &lt;p&gt;&lt;img align=&quot;center&quot; loading=&quot;lazy&quot; src=&quot;https://raw.githubusercontent.com/tushar-sharma/imgs/main/online/ctol.png&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Harmeet Dhillon also tweeted this&lt;sup id=&quot;fnref:harmeet&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:harmeet&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;This is deeply concerning https://x.com/wallstreetmav/status/1959973681037226195&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;This was the response from Dan Bartlett, EVP of Corporate Affairs at Walmart. &lt;sup id=&quot;fnref:walmart&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:walmart&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;To set the record straight, earlier this month, following an investigation, Walmart terminated one vendor and a small number of U.S.-based associates. This investigation had nothing to do with H-1B visas and everything to do with acting with Integrity, a core Walmart value.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;It seems now that the original &lt;a href=&quot;https://x.com/wallstreetmav/status/1959973681037226195&quot;&gt;tweet&lt;/a&gt; is deleted.&lt;/p&gt;
    &lt;h2 id=&quot;burning-of-the-flag&quot;&gt;Burning of the Flag&lt;/h2&gt;
    &lt;p&gt;Trump has issued an &lt;a href=&quot;https://www.whitehouse.gov/presidential-actions/2025/08/prosecuting-burning-of-the-american-flag/&quot;&gt;executive order&lt;/a&gt;. Burning the flag is usually protected under the First Amendment as a form of political protest. However, the order directs federal authorities to prioritize enforcement of existing laws - such as those against property damage, disorderly conduct, hate crimes, or aiding and abetting - when flag desecration occurs in connection with these offenses. Additionally, foreign nationals who desecrate the flag may face immigration consequences, including visa denial, revocation, or removal.&lt;/p&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:lee&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://x.com/BasedMikeLee/status/1959980799845126342&quot;&gt;Mike Lee&apos; tweet&lt;/a&gt; &lt;a href=&quot;#fnref:lee&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:harmeet&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://x.com/AAGDhillon/status/1960008389951402011&quot;&gt;Harmeet&apos;s tweet&lt;/a&gt; &lt;a href=&quot;#fnref:harmeet&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:walmart&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://x.com/danbartlett6/status/1960046954685382741&quot;&gt;Walmart&lt;/a&gt; &lt;a href=&quot;#fnref:walmart&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-08-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-08-25</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-08-25</guid>
</item>
<item>
  <title>Returning Steam Deck for Repair</title>
  <description>&lt;p&gt;Recently, my Steam Deck suddenly developed a display glitch — black screen of death. There was no physical damage or liquid spills. Luckily, the Steam Deck comes with a one-year warranty, and I was still covered with two months remaining.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Recently, my Steam Deck suddenly developed a display issue—the screen stayed completely black even though the device powered on and I could hear sound. There was no physical damage or signs of impact. Fortunately, the Steam Deck comes with a one-year warranty, and I was still covered with two months remaining.&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/chat.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .myheading{font-family:Georgia, &quot;Times New Roman&quot;, Times, serif;font-size:28px;margin-top:5px;margin-bottom:0;font-weight:400;color:#222}
    .mysubheading{font-family:&quot;Lucida Grande&quot;, Tahoma;font-size:10px;font-weight:lighter;font-variant:normal;text-transform:uppercase;color:#666;margin-top:10px;letter-spacing:.3em}
    &lt;/style&gt;
    &lt;h2 id=&quot;step-1-contacting-steam-support&quot;&gt;Step 1: Contacting Steam Support&lt;/h2&gt;
    &lt;p&gt;Go to &lt;a href=&quot;https://help.steampowered.com/en/&quot;&gt;Steam Support&lt;/a&gt;&lt;br /&gt;
    Select &lt;strong&gt;Steam Hardware → Steam Deck → Contact Steam Support&lt;/strong&gt;&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    My Steam Deck has suddenly stopped displaying anything on the screen. The device powers on (I can see the power light, and I sometimes hear sound), but there is no display output. The screen remains completely black from startup.
    There is no broken glass, visible damage, or drops that could have caused this. It happened suddenly during normal use.
    Could you please advise on the next steps to troubleshoot or repair? 
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Hi there, 
    I understand your concern here. No worries, let me sort this out for you.
    What we&apos;ll be doing is a systematic assessment which would lead you through a series of troubleshooting steps to rule out common causes and other factors for a proper diagnosis. So please try the steps that are to be provided even if you have tried some of them already...
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    They asked me to try troubleshooting steps, like getting into BIOS mode and making sure the fan was working, etc.
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;step-2-rma-approval-and-instructions&quot;&gt;Step 2: RMA Approval and Instructions&lt;/h2&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Hello,&lt;br /&gt;
    Thanks for the prompt response and confirming. &lt;br /&gt;
    Based on the information you have provided, we believe it is unlikely that the current issue reflects a problem with this device as it was delivered to you. It may instead be related to your particular use of the product. Regardless, we would like to offer complimentary service as a gesture of goodwill. This will not affect your remaining warranty coverage, but downtime related to the RMA process will be considered when evaluating future warranty claims. Please note that if you encounter additional issues in the future, we may request an opportunity to evaluate the device before deciding how to proceed.&lt;br /&gt;
    Steam will send you an email containing two documents - an RMA instruction sheet and a pre-paid shipping label. Please allow 24 hours for the email to be prepared and sent.
    You will receive an email notification when we&apos;ve confirmed receipt of the package. Once your device has been received it will be inspected and evaluated for repair. If we&apos;re able to repair it, we&apos;ll do so and return the original device to you. The inspection and repair process normally takes 5-7 days after receipt. If we&apos;re unable to repair any in-warranty issue, you may be sent a replacement device instead.
    Use the instructions below to prepare your return. Please review our return packaging guide to ensure your hardware remains safe in transit.
    Remove any items that were not included with your original purchase if possible, such as microSD cards, screen protectors, or third party components. In the event that we are unable to complete your repair and need to send you a new device, these items will not be returned to you. Valve is not responsible for damage that occurs to additional items during the repair process.
    If your device is functional, back up your game installs and any other data you&apos;d like to keep via a microSD card or another external storage device (Valve is not responsible for loss of any data left on your device). Then perform a factory reset on your device by pressing the Steam button and going to Settings &amp;gt; System &amp;gt; Reset to factory state.
    Note: Certain data may still be recoverable from your device after the factory reset. Your Steam Deck&apos;s SSD will be separately sanitized when it is received by our team. However, if your Steam Deck should hold any sensitive information, we recommend that you create a recovery USB key by following these instructions and use the “Reimage Steam Deck” option to separately sanitize your Steam Deck&apos;s SSD.
    Print your RMA instruction sheet.
    Print the shipping label and place it on the exterior of the box.
    Include the following items inside the box:
    RMA instruction sheet, bar code up.
    Steam Deck with serial number FYZZ43402EF6, placed inside original carrying case.
    You should only include your PSU if you are returning your device for a charging issue. Otherwise, please keep it with you.
    Failure to follow these instructions may cause processing delays. You may be asked to pay any additional shipping costs if we require additional items from you to consider your return complete.&lt;br /&gt;
    Steam Support
    Pacs 
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;step-3-packing-and-shipping&quot;&gt;Step 3: Packing and Shipping&lt;/h2&gt;
    &lt;p&gt;You will receive an email with the FedEx shipping label and RMA instructions.&lt;br /&gt;
    Here’s an article on how to &lt;a href=&quot;https://help.steampowered.com/en/faqs/view/307F-A625-1F33-3247&quot;&gt;pack your Steam Deck&lt;/a&gt; for return.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Checklist:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Remove all accessories not included with the original purchase.&lt;/li&gt;
    &lt;li&gt;Back up your data and perform a factory reset if possible.&lt;/li&gt;
    &lt;li&gt;Print and include the RMA instruction sheet.&lt;/li&gt;
    &lt;li&gt;Attach the shipping label to the box.&lt;/li&gt;
    &lt;li&gt;Pack the Steam Deck securely in its original case.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;step-4-conclusion&quot;&gt;Step 4: Conclusion&lt;/h2&gt;
    &lt;p&gt;Finally, you should get an email from &lt;strong&gt;Steam Support&lt;/strong&gt;&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Hello tshrocks2306&lt;br /&gt;
    We&apos;re preparing your items to ship.&lt;br /&gt;
    Tracking information has been created and is attached below.&lt;br /&gt;
    Cheers,
    The Steam Team 
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2025-08-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/steam-deck-return</link>
<guid isPermaLink="true">https://randomwits.com/blog/steam-deck-return</guid>
</item>
<item>
  <title>Getting Started with Oauth2</title>
  <description>&lt;p&gt;OAuth2 is an authorization framework that enables applications to access resources on behalf of a user without exposing their credentials. It is not an authentication protocol by itself — it delegates authorization securely.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;OAuth2 is an authorization framework that enables applications to access resources on behalf of a user without exposing their credentials. It is not an authentication protocol by itself — it delegates authorization securely.&lt;/p&gt;
    &lt;h3 id=&quot;why-oauth2&quot;&gt;Why OAuth2?&lt;/h3&gt;
    &lt;p&gt;Imagine an app that needs access to your Gmail. Instead of asking for your password (a security risk), it redirects you to Google’s login page. After you log in, Google issues a token to the app. The app uses this token to access your data — you never shared your password.&lt;/p&gt;
    &lt;p&gt;This is OAuth2 in action: secure, delegated access&lt;/p&gt;
    &lt;h3 id=&quot;core-oauth2-flow-authorization-code-flow&quot;&gt;Core OAuth2 Flow (Authorization Code Flow)&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;Redirect to /authorize endpoint
    The app redirects the user to the authorization server (e.g., Google, Okta).
    Example:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://accounts.google.com/oauth2/authorize?
    client_id=CLIENT_ID&amp;amp;
    redirect_uri=CALLBACK_URL&amp;amp;
    response_type=code&amp;amp;
    scope=email profile
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;User logs in and consents
    The identity provider authenticates the user and asks for permission.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Authorization server redirects with a code
    On success, it sends a one-time-use authorization code to the redirect_uri&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;App exchanges code for tokens
    The backend calls the /token endpoint:&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;POST /token
    Body: client_id, client_secret, code, redirect_uri, grant_type=authorization_code
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Response includes:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;access_token&lt;/strong&gt; – to access resources&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;id_token (if OpenID Connect)&lt;/strong&gt; – for user identity&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;refresh_token&lt;/strong&gt; – to get new access tokens&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;ol&gt;
    &lt;li&gt;Use access token
    Include in requests as:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Authorization: Bearer &amp;lt;access_token&amp;gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;key-concepts&quot;&gt;Key Concepts&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Authorization Server: Issues tokens after verifying identity (e.g., Google, Okta, Azure AD).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Resource Owner: The user who owns the data.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;JWT (JSON Web Token): (Base64URL-encoded) dot separated string like : &quot;xxx.yyy.zzz&quot; which is (header.payload.signature). Can be decoded but not modified&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Identity Provider (IdP): Service implementing OAuth2/OpenID Connect (e.g., Auth0, Okta, Entra ID).&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;oauth2-vs-openid-connect-oidc&quot;&gt;OAuth2 vs OpenID Connect (OIDC)&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;OAuth2: Authorization only (what can the app do?)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;OpenID Connect (OIDC): Adds authentication layer on top of OAuth2.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;OIDC introduces:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;id_token (a JWT containing user identity)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;/userinfo endpoint (returns user details like name, email)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;openid scope (required to trigger OIDC flow)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Always use OIDC when you need to log in users.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;common-oauth2-flows&quot;&gt;Common OAuth2 Flows&lt;/h3&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Flow&lt;/th&gt;
    &lt;th&gt;Use Case&lt;/th&gt;
    &lt;th&gt;Client Type&lt;/th&gt;
    &lt;th&gt;Security Notes&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**Authorization Code**&lt;/td&gt;
    &lt;td&gt;Web applications with a backend&lt;/td&gt;
    &lt;td&gt;Confidential&lt;/td&gt;
    &lt;td&gt;Recommended for server-side apps&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Authorization Code + PKCE**&lt;/td&gt;
    &lt;td&gt;Single-Page Apps (SPAs), mobile apps&lt;/td&gt;
    &lt;td&gt;Public&lt;/td&gt;
    &lt;td&gt;Secure against code interception; required for SPAs&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Client Credentials**&lt;/td&gt;
    &lt;td&gt;Machine-to-machine (M2M) communication&lt;/td&gt;
    &lt;td&gt;Confidential&lt;/td&gt;
    &lt;td&gt;For service accounts, not end-user access&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Implicit (Legacy)**&lt;/td&gt;
    &lt;td&gt;Older SPAs (no backend)&lt;/td&gt;
    &lt;td&gt;Public&lt;/td&gt;
    &lt;td&gt;❌ Deprecated — do not use&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Resource Owner Password Credentials**&lt;/td&gt;
    &lt;td&gt;Trusted first-party apps only&lt;/td&gt;
    &lt;td&gt;Confidential&lt;/td&gt;
    &lt;td&gt;Only if absolutely necessary; avoid in favor of OAuth2 flows&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h4 id=&quot;when-to-use-which-flow&quot;&gt;When to Use Which Flow?&lt;/h4&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;User Login (Web App)&lt;/strong&gt;: Authorization Code&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;React/Angular App&lt;/strong&gt;: Authorization Code + PKCE&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Backend Service Calling API&lt;/strong&gt;: Client Credentials&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Native Mobile App&lt;/strong&gt;: Authorization Code + PKCE&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Testing in Postman&lt;/strong&gt;: Authorization Code + PKCE&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;oauth2-in-java-spring-boot&quot;&gt;OAuth2 in Java Spring Boot&lt;/h3&gt;
    &lt;h4 id=&quot;using-token-from-ui&quot;&gt;Using token from UI&lt;/h4&gt;
    &lt;p&gt;If your UI already has an access token:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Repository&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Repository&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;WebClient&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Repository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;WebClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Builder&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webClientBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;webClient&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webClientBuilder&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;baseUrl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;URL&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ServerBearerExchange&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;FilterFunction&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;using-client-credentials-flow&quot;&gt;Using Client Credentials Flow&lt;/h3&gt;
    &lt;p&gt;in application.yaml&lt;/p&gt;
    &lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;api&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;auth2&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;provider&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;issuer-uri&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;https://auth-server.com/oauth2&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;client-id&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;CLIENT_ID&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;client-secret&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;CLIENT_SECRET&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;authorization-grant-type&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;client_credentials&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;write&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Set up a reactive WebClient that automatically fetches and attaches OAuth2 tokens using client credentials.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Configuration&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;WebClientConfig&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Bean&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;WebClient&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;webClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;WebClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Builder&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webClientBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;${apis.url}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apiUrl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;${api.auth2.provider.issuer-uri}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;issuerUri&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;${api.auth2.client.client-id}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clientId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;${api.auth2.client.client-secret}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clientSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;${api.auth2.client.scope}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ClientRegistration&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clientRegistration&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ClientRegistration&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;withRegistrationId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;instrument-api&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;tokenUri&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;issuerUri&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/v1/token&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;clientId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clientId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;clientSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clientSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;authorizationGrantType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;AuthorizationGrantType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;CLIENT_CREDENTIALS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ReactiveClientRegistrationRepository&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clientRegistrations&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InMemoryReactiveClientRegistrationRepository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clientRegistration&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ReactiveOAuth2AuthorizedClientService&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;authorizedClientService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InMemoryReactiveOAuth2AuthorizedClientService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clientRegistrations&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webClientBuilder&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ServerOAuth2AuthorizedClientExchangeFilterFunction&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;clientRegistrations&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;authorizedClientService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;baseUrl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apiUrl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;defaultHeader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;application/json&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2025-08-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/understanding-oauth2-indentity-provider</link>
<guid isPermaLink="true">https://randomwits.com/blog/understanding-oauth2-indentity-provider</guid>
</item>
<item>
  <title>StillColor for macOS: Disable Temporal Dithering</title>
  <description>&lt;p&gt;What&apos;s a temporal dithering and why it&apos;s bad for our eyes?&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;What&apos;s a temporal dithering and why it&apos;s bad for our eyes?&lt;/p&gt;
    &lt;p&gt;According to the &lt;a href=&quot;https://github.com/waydabber/BetterDisplay/wiki/Eye-care:-prevent-PWM-and-or-temporal-dithering&quot;&gt;BetterDisplay wiki&lt;/a&gt;:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Temporal dithering is a technique to produce more colors than what a display&apos;s panel (or display connection) can support (for example showing colors with 10 bit color depth – &quot;billions of colors&quot; – on an 8 bit – &quot;millions of colors&quot; – panel). When the display does not have the capability to show the full color depth, it will emulate missing colors by rapidly changing between two adjacent color levels, thus creating a middle ground.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Temporal dithering is a trade-off: it improves apparent color depth but can introduce subtle flicker that stresses the eyes. Tools like StillColor help remove it for a smoother, more comfortable viewing experience on Apple M1/M2/M3.&lt;/p&gt;
    &lt;h3 id=&quot;step-1-check-dithering-status&quot;&gt;Step 1. Check Dithering Status&lt;/h3&gt;
    &lt;p&gt;Run the following command in Terminal:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ioreg &lt;span class=&quot;nt&quot;&gt;-lw0&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; enableDither
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If dithering is enabled, you will see results like:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s2&quot;&gt;&quot;enableDither&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Yes
    &lt;span class=&quot;s2&quot;&gt;&quot;enableDither&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Yes
    &lt;span class=&quot;s2&quot;&gt;&quot;enableDither&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Yes
    &lt;span class=&quot;s2&quot;&gt;&quot;enableDither&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; Yes
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;step-2-download-stillcolor&quot;&gt;Step 2. Download StillColor&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;Go to the &lt;a href=&quot;https://github.com/aiaf/Stillcolor/releases&quot;&gt;StillColor releases page&lt;/a&gt;.&lt;/li&gt;
    &lt;li&gt;Download the latest &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.zip&lt;/code&gt; file (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Stillcolor-v1.1.zip&lt;/code&gt;).&lt;/li&gt;
    &lt;li&gt;Extract and move &lt;strong&gt;Stillcolor.app&lt;/strong&gt; into your Applications folder:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;Stillcolor.app ~/Applications
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;step-3-verify-dithering-is-disabled&quot;&gt;Step 3. Verify Dithering is Disabled&lt;/h3&gt;
    &lt;p&gt;Run the same command again:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ioreg &lt;span class=&quot;nt&quot;&gt;-lw0&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; enableDither
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now you should see:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s2&quot;&gt;&quot;enableDither&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; No
    &lt;span class=&quot;s2&quot;&gt;&quot;enableDither&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; No
    &lt;span class=&quot;s2&quot;&gt;&quot;enableDither&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; No
    &lt;span class=&quot;s2&quot;&gt;&quot;enableDither&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; No
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;step-4-launch-stillcolor&quot;&gt;Step 4. Launch StillColor&lt;/h3&gt;
    &lt;p&gt;Open &lt;strong&gt;StillColor&lt;/strong&gt; from Launchpad to keep dithering disabled. You can now enjoy a flicker-free display.&lt;/p&gt;
  </description>
  <pubDate>2025-08-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/stillcolors-in-mac</link>
<guid isPermaLink="true">https://randomwits.com/blog/stillcolors-in-mac</guid>
</item>
<item>
  <title>Porn and Sugar</title>
  <description>&lt;p&gt;I’ve begun to notice how similar porn and sugar are.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I’ve begun to notice how similar porn and sugar are. Both deliver the same kind of instant hit, that cheap thrill. They hijack the brain’s dopamine pathways, leading us not toward lasting joy but toward fleeting bursts of satisfaction.&lt;/p&gt;
    &lt;p&gt;Sugar was my first victory. My mother was diagnosed with high blood sugar, and together we gave it up. I realized then that I am more committed when I am not alone—when I’m either competing or walking a path alongside someone.&lt;/p&gt;
    &lt;p&gt;It reminds me of the time I went skydiving. I was nervous beyond words, my heart pounding as the plane climbed higher. Fear gripped me so tightly I almost backed out. But then my colleague jumped first. In that moment, it was impossible for me to remain behind, watching. I closed my eyes and leapt. The rush of air, the earth rushing closer, the strange serenity in the free fall—it was one of the best decisions of my life. It taught me something about myself: I overcome resistance more easily when I am not doing it in isolation.&lt;/p&gt;
    &lt;p&gt;Now I no longer crave sugar. In fact, I’ve grown to dislike it when I taste it unknowingly.&lt;/p&gt;
    &lt;p&gt;Porn, however, is different. I still find myself slipping into that abyss, that hidden corner where one steals a quick puff of smoke. It is not the moral question that troubles me. I am not here to debate whether it is right or wrong.&lt;/p&gt;
    &lt;p&gt;As Viktor Frankl once said:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;When a man can&apos;t find a deep sense of meaning, they distract themselves with pleasure&quot;&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Science, too, points to the damage. Neuroimaging shows how heavy porn consumption dulls regions of the brain responsible for motivation and decision-making. And unlike sugar, porn is omnipresent—ubiquitous as air, always just a click away.&lt;/p&gt;
    &lt;p&gt;Even Gandhi, in his experiments with celibacy, sought to wrestle with human urges. He did so in an era without the relentless flood of digital stimuli. Osho, on the other hand, saw masturbation itself as dangerous—not for moral reasons, but because it risks turning one inward to the point of disconnection, to the illusion of self-sufficiency without love&lt;sup id=&quot;fnref:osho&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:osho&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Both sugar and porn are not simply about appetite. Neither offers true nourishment; nothing essential is lost if one abandons them. They are illusions of need, not needs themselves.&lt;/p&gt;
    &lt;p&gt;When I gave up sugar, my mother walked the path with me. That companionship made the struggle lighter, almost natural. When I went skydiving, I only jumped because my friend did first, and I couldn’t bear the thought of staying behind. Even going to the gym is easier with a workout partner who pushes you and shares the struggle.&lt;/p&gt;
    &lt;p&gt;But porn is different —it is hidden, private, carried in silence. There is no comradeship. And that makes the challenge more isolating.&lt;/p&gt;
    &lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:osho&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.osho.com/osho-online-library/osho-talks/sexuality-ecstasy-brahmacharya-eca9aff1-c13&quot;&gt;Osho&apos;s website&lt;/a&gt; &lt;a href=&quot;#fnref:osho&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-08-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/porn-and-sugar</link>
<guid isPermaLink="true">https://randomwits.com/blog/porn-and-sugar</guid>
</item>
<item>
  <title>Daily Logs for Aug 16, 2025</title>
  <description>&lt;p&gt;Dear Vishi, my logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, my logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;gunnar-glasses&quot;&gt;Gunnar Glasses&lt;/h2&gt;
    &lt;p&gt;I accidently ordered glasses using my credit card. Since I have a doctor&apos;s prescription, I should have used HSA card.&lt;/p&gt;
    &lt;p&gt;There is a &lt;a href=&quot;https://gunnar.com/pages/contact&quot;&gt;contact page&lt;/a&gt; where you can cancel an order. Not sure if this would refund the amount.&lt;/p&gt;
    &lt;p&gt;I also dropped an email to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;support@gunnars.com&lt;/code&gt;&lt;/p&gt;
    &lt;h2 id=&quot;understanding-blue-light-from-computer&quot;&gt;Understanding Blue light from Computer&lt;/h2&gt;
    &lt;p&gt;Visible light is all the light wavelength we can see with our eyes. e.g.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Red: ~620–750 nm (longest wavelength, lowest frequency)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Blue: ~450–495 nm&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;…&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Violet: ~380–450 nm (shortest wavelength, highest frequency)&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Blue wavelengths—which are beneficial during daylight hours because they boost attention, reaction times, and mood—seem to be the most disruptive at night &lt;sup id=&quot;fnref:quote&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:quote&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. Few suggestions&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Use dim red lights for night lights. Red light is less likely to shift circadian rhythm and suppress melatonin.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Avoid looking at bright screens beginning two to three hours before bed.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If you work a night shift or use a lot of electronic devices at night, consider wearing blue-blocking glasses or installing an app that filters the blue/green wavelength at night.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Expose yourself to lots of bright light during the day, which will boost your ability to sleep at night, as well as your mood and alertness during daylight.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Why does computer produces lot of blue lights? Screens produce a lot of blue light mainly because of how LEDs work. White light from LEDs is made by blue light + phosphor, not by blending all colors equally. This makes the blue spike stronger than in natural sunlight.&lt;/p&gt;
    &lt;h2 id=&quot;online&quot;&gt;Online&lt;/h2&gt;
    &lt;p&gt;Saw this tweet&lt;sup id=&quot;fnref:tweet&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:tweet&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; from Tulsi Gabbard:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;To all celebrating Janmashtami around the world, I send you my aloha and best wishes on this most auspicious day.  Jai Sri Krishna!&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;yfinance-too-many-request&quot;&gt;yfinance too many request&lt;/h2&gt;
    &lt;p&gt;I was getting following error with the library&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yfinance.exceptions.YFRateLimitError: Too many Requests. Rate limited. Try after a while
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Upgrading the library fixed the issue&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--upgrade&lt;/span&gt; yfinance
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:quote&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.health.harvard.edu/staying-healthy/blue-light-has-a-dark-side&quot;&gt;Blue light has a dark side&lt;/a&gt; &lt;a href=&quot;#fnref:quote&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:tweet&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://x.com/TulsiGabbard/status/1956698139928174915&quot;&gt;Tulsi Gabbard&lt;/a&gt; &lt;a href=&quot;#fnref:tweet&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-08-16T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-08-16</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-08-16</guid>
</item>
<item>
  <title>Compile Time vs Runtime Safety in Java</title>
  <description>&lt;p&gt;When writing Java code, ensuring correctness and reliability is a key concern. One way to achieve this is by leveraging the type system to catch errors early—ideally at compile time rather than at runtime. Let&apos;s explore this concept through a simple example.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When writing Java code, ensuring correctness and reliability is a key concern. One way to achieve this is by leveraging the type system to catch errors early—ideally at compile time rather than at runtime. Let&apos;s explore this concept through a simple example.&lt;/p&gt;
    &lt;p&gt;Consider the following code that prints a list of integers:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myList&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;myList&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Output: 1, 2, 3, 4, 5&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This is straightforward and type-safe. The variable myList is explicitly declared as a List&lt;Integer&gt;, so the compiler guarantees that only integer values are present.&lt;/Integer&gt;&lt;/p&gt;
    &lt;p&gt;Now, consider a modified version of the same code using the Object type:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myList&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Output: 1, 2, 3, 4, 5&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;At runtime, this behaves identically. However, the use of Object introduces a critical weakness: type safety is no longer enforced by the compiler.&lt;/p&gt;
    &lt;p&gt;To illustrate the risk, imagine the list contains invalid data:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myList&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;string&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;cm&quot;&gt;/*
    1
    2
    3
    4
    5
    Exception in thread &quot;main&quot;: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer*/&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The error occurs only when the stream processes the String value, meaning the application fails after deployment rather than during development or build.&lt;/p&gt;
    &lt;p&gt;Using raw &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Object&lt;/code&gt; references and relying on explicit casting shifts error detection from compile time to runtime. This violates the principle of failing fast—a best practice in software engineering where issues should be exposed as early as possible.&lt;/p&gt;
    &lt;p&gt;Compile-time safety, enabled by Java’s generics and strong typing, allows the compiler to validate type correctness before the program runs. In contrast, runtime safety checks introduce unpredictable failures, harder debugging, and increased risk in production environments.&lt;/p&gt;
  </description>
  <pubDate>2025-08-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/compile-time-vs-runtime-safety-java</link>
<guid isPermaLink="true">https://randomwits.com/blog/compile-time-vs-runtime-safety-java</guid>
</item>
<item>
  <title>Daily Logs for Aug 4, 2025</title>
  <description>&lt;p&gt;Dear Vishi, my logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, my logs for today&lt;/p&gt;
    &lt;h2 id=&quot;navigating-the-terminal&quot;&gt;Navigating the Terminal&lt;/h2&gt;
    &lt;p&gt;Quickly moving around in the terminal is essential for productivity. While &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+A&lt;/code&gt; (start of line) and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+E&lt;/code&gt; (end of line) are great for editing commands, scrolling through output is different.&lt;/p&gt;
    &lt;p&gt;Most terminal emulators (like iTerm, GNOME Terminal, or Windows Terminal) allow you to scroll through the output buffer using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Shift+PageUp&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Shift+PageDown&lt;/code&gt; or your mouse&apos;s scroll wheel. To jump directly to the top or bottom, you can pipe the output of a command to a pager like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;less&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Pipe a long command&apos;s output to less&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-lR&lt;/span&gt; / | less
    &lt;span class=&quot;c&quot;&gt;# In less, you can:&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# - Press &apos;G&apos; to go to the end (bottom).&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# - Press &apos;g&apos; to go to the start (top).&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# - Use arrow keys or j/k to scroll.&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# - Press &apos;q&apos; to quit.&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;refreshing-a-file-in-vim&quot;&gt;Refreshing a File in Vim&lt;/h2&gt;
    &lt;p&gt;When a file you&apos;re editing in Vim is changed by an external process (like a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git pull&lt;/code&gt;), you need to reload it.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:e&lt;/code&gt; - &lt;strong&gt;Reload if no local changes were made.&lt;/strong&gt; Vim will load the external changes.&lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:e!&lt;/code&gt; - &lt;strong&gt;Force reload and discard local changes.&lt;/strong&gt; This command reloads the file from disk, overwriting any changes you&apos;ve made in the buffer.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;hr /&gt;
    &lt;h2 id=&quot;a-deep-dive-into-oauth2-grant-types&quot;&gt;A Deep Dive into OAuth2 Grant Types&lt;/h2&gt;
    &lt;p&gt;OAuth2 is an authorization framework, not an authentication protocol. It provides standardized flows for applications to gain secure, limited access to user resources without exposing their credentials. Identity Providers like Okta, Auth0, or Entra ID (Azure AD) implement these flows.&lt;/p&gt;
    &lt;h3 id=&quot;the-core-endpoints-authorize-and-token&quot;&gt;The Core Endpoints: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/authorize&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/token&lt;/code&gt;&lt;/h3&gt;
    &lt;p&gt;OAuth2 separates the process of getting user consent from the process of obtaining an access token. This separation is a key security principle and is handled by two main endpoints:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;/authorize&lt;/strong&gt;: This is a user-facing endpoint. The application redirects the user&apos;s browser to it. Here, the user authenticates with the provider (if not already logged in) and grants the application permission to access their data. It then sends back a temporary &lt;strong&gt;authorization code&lt;/strong&gt;.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;/token&lt;/strong&gt;: This is a server-to-server endpoint. The application&apos;s backend makes a secure, direct call to this endpoint, exchanging the authorization code (along with its own client ID and secret) for an &lt;strong&gt;access token&lt;/strong&gt; and, optionally, a &lt;strong&gt;refresh token&lt;/strong&gt;.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;strong&gt;Why the separation?&lt;/strong&gt; To keep sensitive tokens out of the browser. The access token is a powerful credential. By exchanging the code on the backend, the token is never exposed to the user&apos;s machine, preventing its theft through browser history or malicious scripts.&lt;/p&gt;
    &lt;h3 id=&quot;1-authorization-code-grant&quot;&gt;1. Authorization Code Grant&lt;/h3&gt;
    &lt;p&gt;This is the most common and secure grant type, ideal for traditional web and mobile applications that have a backend server.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Flow:&lt;/strong&gt;&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;User Consent&lt;/strong&gt;: The application redirects the user to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/authorize&lt;/code&gt; endpoint.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Get Code&lt;/strong&gt;: The user logs in and gives consent. The provider redirects back to the application with a short-lived authorization code.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Exchange Code for Token&lt;/strong&gt;: The application&apos;s backend sends the authorization code, its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;client_id&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;client_secret&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/token&lt;/code&gt; endpoint.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Receive Tokens&lt;/strong&gt;: The provider validates everything and returns an access token and a refresh token.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;&lt;strong&gt;Real-World Examples&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Clicking &quot;Login with Google&quot; on a website like Canva.&lt;/li&gt;
    &lt;li&gt;A mobile banking app authenticating you.&lt;/li&gt;
    &lt;li&gt;Connecting a third-party application like Slack to your Google Drive.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;2-client-credentials-grant&quot;&gt;2. Client Credentials Grant&lt;/h3&gt;
    &lt;p&gt;This grant is for machine-to-machine (M2M) communication where there is no user interaction.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Flow:&lt;/strong&gt;&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Request Token&lt;/strong&gt;: A backend service makes a direct call to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/token&lt;/code&gt; endpoint, sending its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;client_id&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;client_secret&lt;/code&gt;.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Receive Token&lt;/strong&gt;: The provider validates the credentials and returns an access token.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;&lt;strong&gt;Key Characteristics&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;No user involved.&lt;/li&gt;
    &lt;li&gt;No &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/authorize&lt;/code&gt; endpoint is used.&lt;/li&gt;
    &lt;li&gt;Typically, no refresh tokens are issued; the client just requests a new access token when the old one expires.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;strong&gt;Real-World Examples&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;A microservice calling another internal API.&lt;/li&gt;
    &lt;li&gt;A CI/CD pipeline script deploying resources to a cloud provider.&lt;/li&gt;
    &lt;li&gt;Running automated API tests with a tool like Postman.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;3-pkce-securing-public-clients&quot;&gt;3. PKCE: Securing Public Clients&lt;/h3&gt;
    &lt;p&gt;&lt;strong&gt;PKCE (Proof Key for Code Exchange)&lt;/strong&gt; is not a separate grant type but an extension that makes the Authorization Code flow more secure for clients that can&apos;t protect a secret, like &lt;strong&gt;Single-Page Applications (SPAs)&lt;/strong&gt; and &lt;strong&gt;native mobile apps&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt;It mitigates an &quot;authorization code interception&quot; attack. In this attack, a malicious app on a user&apos;s device could intercept the authorization code and exchange it for an access token.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;How PKCE Helps&lt;/strong&gt;:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Before starting the flow, the client app generates a secret &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;code_verifier&lt;/code&gt; and a transformed version of it called the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;code_challenge&lt;/code&gt;.&lt;/li&gt;
    &lt;li&gt;It sends the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;code_challenge&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/authorize&lt;/code&gt; endpoint.&lt;/li&gt;
    &lt;li&gt;When exchanging the authorization code at the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/token&lt;/code&gt; endpoint, it also sends the original &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;code_verifier&lt;/code&gt;.&lt;/li&gt;
    &lt;li&gt;The server transforms the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;verifier&lt;/code&gt; and checks if it matches the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;challenge&lt;/code&gt; sent earlier. If they match, the token is issued.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;This ensures that only the application that initiated the request can complete it.&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;: &lt;a href=&quot;https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow&quot;&gt;Microsoft OAuth2 Documentation&lt;/a&gt;&lt;/p&gt;
    &lt;h2 id=&quot;resolving-ambiguous-mappings-in-spring-boot&quot;&gt;Resolving Ambiguous Mappings in Spring Boot&lt;/h2&gt;
    &lt;p&gt;In Spring MVC, an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IllegalStateException: Ambiguous mapping&lt;/code&gt; error occurs when two or more controller methods are mapped to the same URL pattern and HTTP method, and Spring cannot decide which one to invoke for an incoming request.&lt;/p&gt;
    &lt;p&gt;Consider this controller:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@RestController&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Maps to POST /123&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@PostMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/{id}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;handlePostWithId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@PathVariable&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Also maps to POST /123, causing ambiguity!&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@PostMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/{id}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;handlePostWithIdAndParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@PathVariable&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nd&quot;&gt;@RequestParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Both methods map to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; requests for paths like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/some-id&lt;/code&gt;. To resolve this, you need to make the mappings more specific. A common technique is to differentiate based on the presence of a request parameter using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;params&lt;/code&gt; attribute.&lt;/p&gt;
    &lt;h3 id=&quot;the-fix-using-params&quot;&gt;The Fix: Using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;params&lt;/code&gt;&lt;/h3&gt;
    &lt;p&gt;By adding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;params = &quot;test&quot;&lt;/code&gt;, you tell Spring that the second method should only be invoked if the request URL contains the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test&lt;/code&gt; parameter.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@RestController&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Handles POST /123 (without a &quot;test&quot; param)&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@PostMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/{id}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;handlePostWithId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@PathVariable&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Handles POST /123?test=someValue&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@PostMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/{id}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;handlePostWithIdAndParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@PathVariable&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nd&quot;&gt;@RequestParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now the mappings are unique, and Spring can correctly route requests.&lt;/p&gt;
    &lt;h2 id=&quot;learning-spanish&quot;&gt;Learning Spanish&lt;/h2&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;I know&lt;/td&gt;
    &lt;td&gt;Jo se&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;I know it&lt;/td&gt;
    &lt;td&gt;Lo se&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;do you know?&lt;/td&gt;
    &lt;td&gt;sabes?&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;I want to know ?&lt;/td&gt;
    &lt;td&gt;Queiro saber&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;she know its&lt;/td&gt;
    &lt;td&gt;ella lo sabe&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2025-08-05T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-08-04</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-08-04</guid>
</item>
<item>
  <title>How to Listen to a Kafka Consumer in Spring Boot (Reactive &amp; Non-Reactive)</title>
  <description>&lt;p&gt;Listening to a kafka consumer varies in both servlet and reactive application.&lt;!-- truncate_here --&gt;&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In a traditional servlet based Spring boot, you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KafkaListener&lt;/code&gt; annotation&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Service&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@KafkaListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topics&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;myTopic&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ConsumerRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;record&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// process the record&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;✅ &lt;strong&gt;Pros&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Simple, declarative, and well-documented.&lt;/li&gt;
    &lt;li&gt;Supports message deserialization, error handling, retries, and DLQ out of the box.&lt;/li&gt;
    &lt;li&gt;Integrates seamlessly with Spring’s dependency injection.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;❌ &lt;strong&gt;Cons&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Blocking I/O: Each message is processed synchronously.&lt;/li&gt;
    &lt;li&gt;Not suitable for high-throughput reactive pipelines.&lt;/li&gt;
    &lt;li&gt;Threads are tied up during processing (limited scalability under load).&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;reactive-kafka-consumer-with-project-reactor&quot;&gt;Reactive Kafka Consumer with Project Reactor&lt;/h2&gt;
    &lt;h3 id=&quot;applicationeventlistener&quot;&gt;ApplicationEventListener&lt;/h3&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Service&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Autowired&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@EventListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ApplicationReadyEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reactive&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;record&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// process the message&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;postconstruct&quot;&gt;PostConstruct&lt;/h2&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Service&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Autowired&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@PostConstruct&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reactive&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;record&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// process the message&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;commanlinerunner&quot;&gt;CommanLineRunner&lt;/h2&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Service&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyService&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CommanLineRunner&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Autowired&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ReactiveKakfaConsumer&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reactive&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;record&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// process the message&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;when-to-use-each-approach&quot;&gt;When to use Each Approach&lt;/h2&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;PostConstruct&lt;/td&gt;
    &lt;td&gt;When you need initialization right after bean creation&lt;/td&gt;
    &lt;td&gt;Triggered immediately after bean construction and dependency injection&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;CommnadLineRunner&lt;/td&gt;
    &lt;td&gt;When you need to run code after the application context is fully started&lt;/td&gt;
    &lt;td&gt;Executes after the application context is ready but before the application start&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;ApplicationReadyEvent&lt;/td&gt;
    &lt;td&gt;When you need to ensure all aspects of application are ready&lt;/td&gt;
    &lt;td&gt;Trigger after the application is started and ready to server the request&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2025-08-03T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/listen-to-kafka-consumer-spring-boot</link>
<guid isPermaLink="true">https://randomwits.com/blog/listen-to-kafka-consumer-spring-boot</guid>
</item>
<item>
  <title>The Best Free Games to Play</title>
  <description>&lt;p&gt;Curated list of free games to play.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Curated list of free games to play.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Name&lt;/th&gt;
    &lt;th&gt;Link&lt;/th&gt;
    &lt;th&gt;Comments&lt;/th&gt;
    &lt;th&gt;Recommendation&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;The Were Cleaner&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2795000/The_WereCleaner/)&lt;/td&gt;
    &lt;td&gt;You play as a janitor who needs to pay his rent. However you are also a warewolf who can eat people. My only pet peeve is that it&apos;s too short&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;20 Small Mazes&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2570630/20_Small_Mazes/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Agni&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1822340/AGNI/)&lt;/td&gt;
    &lt;td&gt;Simple runner game&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Doronko Wanko&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2512840/DORONKO_WANKO/)&lt;/td&gt;
    &lt;td&gt;Play as a mischievous dog and make a mess. You need to change language from Japanese to English&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Atuel&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2794330/Atuel/)&lt;/td&gt;
    &lt;td&gt;Short, meditative adventure exploring the Atuel River in Argentina.&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;The Sims 4&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1222670/The_Sims_4/)&lt;/td&gt;
    &lt;td&gt;Fun simulation game&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Alpaca Stacka&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1655140/Alpaca_Stacka/)&lt;/td&gt;
    &lt;td&gt;Help lost chicks as a friendly alpaca.&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Sheepy: A Short Adventure&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1568400/Sheepy_A_Short_Adventure/)&lt;/td&gt;
    &lt;td&gt;Short, relaxing platformer with a sheep protagonist.&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Warframe&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/230410/Warframe/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;BABBDI&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2240530/BABBDI/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Indigo Park: Chapter 1&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2504480/Indigo_Park_Chapter_1/)&lt;/td&gt;
    &lt;td&gt;Atmospheric horror adventure, first chapter is free.&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Rental&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2796550/Rental/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;How fish is made&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1854430/How_Fish_Is_Made/)&lt;/td&gt;
    &lt;td&gt;Simple gameplay where you propel a fish with eerie background music.&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;The Supper&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1171370/The_Supper/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Super Animal Royale&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/843380/Super_Animal_Royale/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Zardy&apos;s Maze&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1484800/Zardys_Maze/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Supermarket Together&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2709570/Supermarket_Together/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Break a Leg&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/3022110/Break_a_Leg/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Swallow the Sea&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1511860/Swallow_the_Sea/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Perfect Vermin&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1416130/Perfect_Vermin/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Leaf Blower Revolution - Idle Game&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/1468260/Leaf_Blower_Revolution__Idle_Game/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Landfill&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2353760/Landfall_Archives/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;The Expendabros&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/312990/The_Expendabros/)&lt;/td&gt;
    &lt;td&gt;Free to play game. It&apos;s a demo version of BroForce. Retro feel and great shooting.&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Life is Strange Episode 1&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/319630/Life_is_Strange__Episode_1/)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Sludge Life: The Big Mud Sessions&lt;/td&gt;
    &lt;td&gt;[Steam](https://store.steampowered.com/app/2494930/Sludge_Life_The_Big_Mud_Sessions/)&lt;/td&gt;
    &lt;td&gt;The demo to sludge life 2.&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2025-08-03T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/free-games-to-play</link>
<guid isPermaLink="true">https://randomwits.com/blog/free-games-to-play</guid>
</item>
<item>
  <title>Daily Logs for Aug 1, 2025</title>
  <description>&lt;p&gt;Dear Vishi, my logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, my logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;rayman-legends&quot;&gt;Rayman Legends&lt;/h2&gt;
    &lt;p&gt;It&apos;s a great game that I&apos;ve been binge playing. The background music is great and each stage is exciting.&lt;/p&gt;
    &lt;p&gt;Cons:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;You can&apos;t play it offline as it requires Ubisoft launcher to connect to internet&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Few tips:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Limit FPS to 58 on steam deck. This made it render better on a TV monitor.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If you are using a remote controller, you might need to &lt;strong&gt;Reorder Controller&lt;/strong&gt; to give it preference over steams native controller.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;windows-tinting&quot;&gt;Windows Tinting&lt;/h2&gt;
    &lt;p&gt;I have a long commute to work. So wanted to tint the windows. First, learnt about VLT. In a nutshell, 35% 
    percent vlt means that it should allow 35 percent of light to pass through. Lower vlt means, more dark. However I was more concerned about UV rays then privacy. Also I wanted to tint only the windshield and front side windows to keep the cost down. Here&apos;s what I ended doing on my car:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Windshield&lt;/strong&gt;: 70% so that&apos;s it&apos;s not conspicuously obvious&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Visor&lt;/strong&gt;: 5% vlt&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Front Side Windows&lt;/strong&gt;: 50% vlt. I could have gone with 35%. However since I am not doing it on all windows, so it kind of looked weird.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
  </description>
  <pubDate>2025-08-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-08-01</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-08-01</guid>
</item>
<item>
  <title>Daily Logs for 23 July, 2025</title>
  <description>&lt;p&gt;Dear Vishi, my logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, my logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;add-a-component-to-an-existing-angular-project&quot;&gt;Add a component to an existing Angular Project&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;existing-angular-project
    ng generate component my-new-component
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;mac-switch-workspaces&quot;&gt;Mac switch workspaces&lt;/h2&gt;
    &lt;p&gt;In Mac, if you press &lt;strong&gt;F3&lt;/strong&gt;, it will launch the mission control to view all applications. If you have magic mouse, you can use two fingers two fingers to change workspaces.&lt;/p&gt;
    &lt;h2 id=&quot;gemini-cli&quot;&gt;Gemini Cli&lt;/h2&gt;
    &lt;p&gt;Keep updating it to get latest features&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm update -g @google/gemini-cli
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Opt out of data usage&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/privacy
    Allow Google to use this data to develop and improve our products?                                                
    1. Yes
    2. No                                                                                            
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;tridactyl&quot;&gt;Tridactyl&lt;/h2&gt;
    &lt;p&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b&lt;/code&gt; to list all opened tabs in firefox when using this addon.&lt;/p&gt;
  </description>
  <pubDate>2025-07-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-07-23</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-07-23</guid>
</item>
<item>
  <title>Daily Logs for July 22, 2025</title>
  <description>&lt;p&gt;Dear Vishi, my logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, my logs for today.&lt;/p&gt;
    &lt;h2 id=&quot;engine-oil-change&quot;&gt;Engine Oil Change&lt;/h2&gt;
    &lt;p&gt;I ordered &lt;strong&gt;synthetic oil&lt;/strong&gt; from &lt;a href=&quot;amsoil.com&quot;&gt;amsoil.com&lt;/a&gt; for my Honda Accord 2017. It&apos;s better than &lt;strong&gt;regular oil&lt;/strong&gt;.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Product&lt;/th&gt;
    &lt;th&gt;Package Size&lt;/th&gt;
    &lt;th&gt;Qty&lt;/th&gt;
    &lt;th&gt;Price&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;AMSOIL Signature Series 0W-20 100% Synthetic Motor Oil&lt;/td&gt;
    &lt;td&gt;Quart Bottle&lt;/td&gt;
    &lt;td&gt;5&lt;/td&gt;
    &lt;td&gt;$77.45&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;AMSOIL Oil Filter&lt;/td&gt;
    &lt;td&gt;EA15K13&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;$13.30&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Most car&apos;s autocare shops don&apos;t let you bring your own oil or parts. I found a cheap one at &lt;strong&gt;Queen City Auto Care &amp;amp; Lube at 6286 South Blvd, Charlotte, NC 28217&lt;/strong&gt;. It charges only 20 bucks for an oil change. That&apos;s the most reasonable I have found. Would recommend.&lt;/p&gt;
    &lt;h2 id=&quot;things-to-do-on-long-car-drives&quot;&gt;Things to Do on Long Car Drives&lt;/h2&gt;
    &lt;p&gt;I usually commute long hours to work. I wonder what all things I can do while driving:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Listening to songs&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Learn a language&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Talk to ChatGPT and ask questions&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Watch a movie (not recommended)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Listen to a book or a podcast&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Talk to a friend (or family)&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;why-the-sky-is-blue&quot;&gt;Why the Sky is Blue&lt;/h2&gt;
    &lt;p&gt;Today I listened to &lt;a href=&quot;https://archive.org/details/WhyTheSkyIsBlue-English-C.V.Raman&quot;&gt;Why the Sky is Blue by C.V. Raman&lt;/a&gt;, a famous Nobel Prize Laureate in Physics from India. He delivered this lecture at the Community Science Center in 1968.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Key insights from the lecture:&lt;/strong&gt;&lt;/p&gt;
    &lt;h3 id=&quot;1-the-chain-of-questions-approach&quot;&gt;1. The Chain of Questions Approach&lt;/h3&gt;
    &lt;p&gt;When someone asks &quot;Why is the sky blue?&quot;, don&apos;t just give a direct answer. Instead, ask another question: &quot;Is the sky always blue?&quot;&lt;/p&gt;
    &lt;p&gt;This leads us to realize that the sky only appears blue in daylight. So what&apos;s the difference between night and day? &lt;strong&gt;The sun.&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Next question: But moonlight is practically sunlight reflected, yet there&apos;s no bluish color at night. So it depends on &lt;strong&gt;illuminance&lt;/strong&gt; - the color only appears at higher light intensity levels.&lt;/p&gt;
    &lt;p&gt;Now we know that both atmosphere and sun are responsible for the color, but &lt;strong&gt;how?&lt;/strong&gt; Next question: Does it appear more blue on clear skies or cloudy skies?&lt;/p&gt;
    &lt;p&gt;This chain of questioning leads to understanding the phenomenon at a much deeper level.&lt;/p&gt;
    &lt;h3 id=&quot;2-avoid-superficial-answers&quot;&gt;2. Avoid Superficial Answers&lt;/h3&gt;
    &lt;p&gt;Don&apos;t give short, casual answers. For example, saying &quot;leaves are green because of chlorophyll&quot; is technically correct but lacks &lt;strong&gt;inquisitiveness&lt;/strong&gt;. The real question becomes: &lt;em&gt;Why&lt;/em&gt; does chlorophyll absorb certain wavelengths and reflect green light?&lt;/p&gt;
    &lt;h3 id=&quot;3-light-scattering-and-particle-size&quot;&gt;3. Light Scattering and Particle Size&lt;/h3&gt;
    &lt;p&gt;Light is scattered most effectively when its &lt;strong&gt;wavelength&lt;/strong&gt; is approximately equal to the size of the scattering particle. Think of it like resonance - a wave is more able to resonate with a piece of wood its own size rather than with a massive ship.&lt;/p&gt;
    &lt;p&gt;This principle explains why shorter blue wavelengths are scattered more by tiny atmospheric particles than longer red wavelengths.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;The key insight&lt;/strong&gt;: More blue light is scattered in the atmosphere due to microscopic particles and gas molecules. Without these scattering particles, there would be no blue sky - just the black void of space visible during the day.&lt;/p&gt;
    &lt;h2 id=&quot;new-concepts&quot;&gt;New Concepts&lt;/h2&gt;
    &lt;p&gt;&lt;strong&gt;Financial Instrument&lt;/strong&gt;: A legally binding contract that represents a monetary value and can be traded between parties. These instruments derive their value from underlying assets and generate future cash flows. Examples include:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Equity instruments&lt;/strong&gt;: Stocks, shares&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Debt instruments&lt;/strong&gt;: Bonds, treasury bills, certificates of deposit&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Derivative instruments&lt;/strong&gt;: Options, futures, swaps&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;strong&gt;CUSIP (Committee on Uniform Securities Identification Procedures)&lt;/strong&gt;: A 9-character alphanumeric code that serves as a unique identifier for securities issued in the United States and Canada. Think of it as a &quot;fingerprint&quot; or &quot;serial number&quot; for financial instruments. The format consists of:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;First 6 characters: Identify the issuer&lt;/li&gt;
    &lt;li&gt;7th &amp;amp; 8th characters: Identify the specific issue&lt;/li&gt;
    &lt;li&gt;9th character: Check digit for validation&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;booking-a-flight-for-visa-purposes&quot;&gt;Booking a Flight for Visa Purposes&lt;/h2&gt;
    &lt;p&gt;I need to buy a refundable flight for &lt;strong&gt;visa purposes&lt;/strong&gt;. In my experience, it&apos;s better to book it directly with the airline rather than through a middleman. I booked &lt;strong&gt;main refundable&lt;/strong&gt; from the &lt;strong&gt;Delta website&lt;/strong&gt;.&lt;/p&gt;
  </description>
  <pubDate>2025-07-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-07-22</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-07-22</guid>
</item>
<item>
  <title>Daily Logs for July 20, 2025</title>
  <description>&lt;p&gt;Dear Vishi, my logs for today.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, my logs for today.&lt;/p&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;how-to-write-a-good-prompt&quot;&gt;How to write a good prompt&lt;/h2&gt;
    &lt;p&gt;I listened to Jonathan Mast who advised on how to write a good prompt. He said instead of writing it ourself, we can use LLM to write it for us:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;💬 Act as a Prompt Engineer, review the following prompt for me. optimize it to make it better and ask me any questions before proceedings: Your rough draft&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;how-to-open-wsl-folder-on-file-explorer&quot;&gt;How to open &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wsl&lt;/code&gt; folder on File Explorer&lt;/h2&gt;
    &lt;p&gt;In your terminal, you can simply type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;explorer.exe .&lt;/code&gt;. Or you can also go to address bar of the Explorer and type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\\wsl$&lt;/code&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;run-java-like-a-python-script&quot;&gt;Run Java like a Python script&lt;/h2&gt;
    &lt;p&gt;JBang lets you run Java files like scripts, similar to how you run Python files. No project setup, no pom.xml, no build tools needed.&lt;/p&gt;
    &lt;p&gt;Install it using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sdkman&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;jbang
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Create a simple standalone script&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//DEPS io.projectreactor:reactor-core:3.6.5&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;reactor.core.publisher.Flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Test&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;test1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Flux&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;just&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;collectList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Converts to Mono&amp;lt;List&amp;lt;Integer&amp;gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Doubled values: &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Run it like&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;jbang Test.java
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2025-07-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-07-20</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-07-20</guid>
</item>
<item>
  <title>Types in Java</title>
  <description>&lt;p&gt;Java is a statically typed language , which means that every variable, method parameter, and expression must have a defined type known at compile time. This helps catch errors early and improves code reliability.&lt;!-- truncate_here --&gt;Java is a statically typed language , which means that every variable, method parameter, and expression must have a defined type known at compile time. This helps catch errors early and improves code reliability.&lt;/p&gt;
    &lt;p&gt;A type in Java defines: the kind of value a variable can hold and what operations that can be performed on it.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;// int: arithmetic allowed&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Ana&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// String: you can call name.length()&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;All types in Java fall into two broad categories:&lt;/p&gt;
    &lt;h2 id=&quot;primitive-vs-reference-types&quot;&gt;Primitive vs Reference Types&lt;/h2&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt; &lt;/th&gt;
    &lt;th&gt;Type Category&lt;/th&gt;
    &lt;th&gt;Examples&lt;/th&gt;
    &lt;th&gt;Stored In&lt;/th&gt;
    &lt;th&gt;Can be null?&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**Primitive Types**&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;double&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;boolean&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;Stack&lt;/td&gt;
    &lt;td&gt;❌ No&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Reference Types**&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;String&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int[]&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Runnable&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;Stack (ref) + Heap (value)&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;primitive-types&quot;&gt;Primitive Types&lt;/h2&gt;
    &lt;p&gt;Java has 8 primitive types:int, long, double, float, boolean, char, byte, short.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Fast and memory-efficient&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Cannot be null — so never throw NullPointerException&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Not objects — you cannot call methods on them (x.length() ❌)&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;reference-types&quot;&gt;Reference Types&lt;/h2&gt;
    &lt;p&gt;Reference types refer to objects stored on the heap.&lt;/p&gt;
    &lt;p&gt;Examples include:&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Classes (String, Scanner, custom types)&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Interfaces (Runnable, Function&amp;lt;T,R&amp;gt;)&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Arrays (int[], String[])&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Lambdas (assigned to functional interfaces)&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Enums&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Runnable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hi&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;These variables hold references, not actual data. The data lives in the heap, while the reference lives on the stack.&lt;/p&gt;
    &lt;h2 id=&quot;everything-reference-type-extends-object&quot;&gt;Everything Reference-Type Extends Object&lt;/h2&gt;
    &lt;p&gt;Yes — even arrays and lambdas:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;o1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;              &lt;span class=&quot;c1&quot;&gt;// String is a subclass of Object&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;o2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;// Arrays extend Object&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;o3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Runnable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{};&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// Lambdas are compiled into classes implementing interfaces&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;All reference types can be upcast to Object&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;They all have methods like .toString(), .equals(), and .hashCode()&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;boxing-and-unboxing-when-primitives-become-objects&quot;&gt;Boxing and Unboxing (When Primitives Become Objects)&lt;/h2&gt;
    &lt;p&gt;Java allows primitives to be wrapped in object form via boxing:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;boxed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;// Autoboxing (int → Integer)&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unboxed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;boxed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;// Auto-unboxing (Integer → int)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;why-you-should-not-use-object-in-generics&quot;&gt;Why You Should NOT Use Object in Generics&lt;/h2&gt;
    &lt;h3 id=&quot;anti-pattern&quot;&gt;Anti-Pattern:&lt;/h3&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Box&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Object&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Box&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Manual cast required&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;problems&quot;&gt;Problems&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;No compile-time type safety&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Must cast manually (error-prone)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Can easily throw ClassCastException&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;use-generics-for-type-safe-code&quot;&gt;Use Generics for Type-Safe Code&lt;/h2&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// no cast needed&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;advantages&quot;&gt;Advantages:&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Type-safe at compile time&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Easier to read and maintain&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Prevents runtime errors&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;wildcards-&quot;&gt;Wildcards (&amp;lt;?&amp;gt;)&lt;/h2&gt;
    &lt;p&gt;Use wildcards when you&apos;re writing generic code for flexible input types, but you don’t need to know or change the exact type.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;printBox&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;?&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;box&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;box&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// value is safely treated as Object&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Technique&lt;/th&gt;
    &lt;th&gt;Type Safe?&lt;/th&gt;
    &lt;th&gt;Cast Required?&lt;/th&gt;
    &lt;th&gt;Can Read?&lt;/th&gt;
    &lt;th&gt;Can Write?&lt;/th&gt;
    &lt;th&gt;Use When…&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Object&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;❌ No&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt;Avoid unless truly generic or legacy&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt;❌ No&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt;You know the type ahead of time&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;?&amp;gt;&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt;❌ No&lt;/td&gt;
    &lt;td&gt;✅ Yes&lt;/td&gt;
    &lt;td&gt;❌ No&lt;/td&gt;
    &lt;td&gt;You don’t know the exact type&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2025-07-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/types-in-java</link>
<guid isPermaLink="true">https://randomwits.com/blog/types-in-java</guid>
</item>
<item>
  <title>Review Modern Java in Action</title>
  <description>&lt;p&gt;Review Modern Java in Action.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;!-- disclaimer --&gt;
    &lt;div style=&quot;margin: 0 auto&quot; class=&quot;cl disclaimer&quot;&gt;
    &lt;i class=&quot;icon-star&quot;&gt;&lt;/i&gt;
    &lt;span style=&quot;color:black&quot;&gt; &amp;nbsp;&amp;nbsp;This post is in progress. It will be updated continuously&lt;/span&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;what-is-oop&quot;&gt;What is OOP?&lt;/h2&gt;
    &lt;p&gt;OOP (Object-Oriented Programming) is a paradigm where &lt;strong&gt;everything is treated as an object&lt;/strong&gt; — encapsulating state (fields) and behavior (methods) together.&lt;/p&gt;
    &lt;h2 id=&quot;stream-processing&quot;&gt;Stream processing&lt;/h2&gt;
    &lt;p&gt;A stream is a sequence of data items that are conceptually produced one at a time.&lt;/p&gt;
    &lt;h3 id=&quot;parallelism-vs-concurrency&quot;&gt;Parallelism vs Concurrency&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Parallelism&lt;/strong&gt;: Tasks are split and executed &lt;strong&gt;simultaneously across multiple CPU cores&lt;/strong&gt;. Great for &lt;strong&gt;CPU-bound tasks&lt;/strong&gt;.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Concurrency&lt;/strong&gt;: Tasks are &lt;strong&gt;interleaved&lt;/strong&gt; on one or more threads, often on a &lt;strong&gt;single core&lt;/strong&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Parallelism vs Concurrency. Parallelism is executing the code across multiple GPU cores. However Concurrency is running various code accross single core.  You want to use paralleism for CPU bound work. Concurrency for I/O bound work or slow task.&lt;/p&gt;
    &lt;h3 id=&quot;functional-programming-in-java&quot;&gt;Functional Programming in Java&lt;/h3&gt;
    &lt;p&gt;Functional programming focuses on:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Avoiding shared mutable state&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Using higher-order functions&lt;/strong&gt; — passing functions as parameters or returning them&lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;functional-vs-imperative-styles&quot;&gt;Functional vs Imperative Styles&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;In &lt;strong&gt;imperative programming&lt;/strong&gt;, you define &lt;strong&gt;how&lt;/strong&gt; something is done step by step.
    &lt;ul&gt;
    &lt;li&gt;Values are &lt;strong&gt;first-class&lt;/strong&gt; (you can pass them around).&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Methods/classes are not&lt;/strong&gt; — they can’t be easily passed or composed.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;In &lt;strong&gt;functional programming&lt;/strong&gt;, functions are first-class citizens too.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;method-refernce&quot;&gt;Method refernce&lt;/h2&gt;
    &lt;p&gt;&lt;strong&gt;Method references&lt;/strong&gt; are a shorthand for lambda expressions that simply call a method. They make your code cleaner and easier to read.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hiddenFiles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;listFiles&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isHidden&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You can use a method reference:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hiddenFiles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;listFiles&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;File:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isHidden&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;some-practice-problems&quot;&gt;Some practice problems&lt;/h2&gt;
    &lt;p&gt;&lt;strong&gt;Double a list using stream&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.stream.Collectors&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Test&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Arrays&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;asList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;collect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Collectors&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here &lt;strong&gt;collect&lt;/strong&gt; is a terminal operation. It is eager—it triggers the processing of the stream and gathers the results.  &lt;strong&gt;map&lt;/strong&gt; is lazy, meaning it doesn’t process elements until a terminal operation (like collect) is called.&lt;/p&gt;
    &lt;h2 id=&quot;first-class-vs-second-class-citizens&quot;&gt;First class vs Second class citizens&lt;/h2&gt;
    &lt;p&gt;In programming language theory, the concept of first-class citizens (or first-class objects) refers to entities that can be used freely in all standard ways that other values can be used in a language.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Being passed as an argument to a function&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Being returned from a function&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Being assigned to a variable&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Being stored in data structures&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;&lt;strong&gt;Functions Are Not First-Class Citizens (Before Java 8)&lt;/strong&gt;&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;You couldn&apos;t pass a method directly as an argument to another method.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;You couldn&apos;t assign a method to a variable.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;You couldn&apos;t return a method from another method.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;&lt;strong&gt;Functions are now first class citizens&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Starting with Java 8 , functions became first-class citizens thanks to the introduction of:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Lambda expressions&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Method references&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Functional interfaces&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;java.util.function&lt;/code&gt; package&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Assigning a lambda to a variable&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Function&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;square&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Invoke it&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;square&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;apply&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Passing a function as an argument&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Arrays&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;asList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Returning a function from a method&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Function&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getMultiplier&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;factor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;factor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Classes Are Also Not First-Class Citizens&lt;/strong&gt;&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Pass a class definition directly as a parameter&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Return a class definition from a method (though you can return a Class&amp;lt;?&amp;gt; reference, which is metadata, not the class body itself)&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;printClassName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;?&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clazz&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Class name: &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clazz&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printClassName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Passing metadata, not the class itself&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;method-reference&quot;&gt;Method Reference&lt;/h2&gt;
    &lt;p&gt;A method reference allows you to refer to a method without executing it.&lt;/p&gt;
    &lt;p&gt;Before Java 8, if you wanted to list only the hidden files in a directory, you might write:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hiddenFiles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;listFiles&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;FileFilter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;accept&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isHidden&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Using &lt;strong&gt;Method Reference&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hiddenFiles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;listFiles&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;File:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isHidden&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;File::isHidden&lt;/code&gt; is a method reference to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;isHidden()&lt;/code&gt; method of the File class. It’s equivalent to this lambda expression:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isHidden&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;passing-code-as-an-example&quot;&gt;Passing code as an example&lt;/h2&gt;
    &lt;p&gt;Lets you add &lt;strong&gt;two filters&lt;/strong&gt; like&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;filterGreenApples&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inventory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inventory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;GREEN&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getColor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;filterHeavyApples&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inventory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inventory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getWeight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;150&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Refactor this like where a method is passes a predicate parameter named &lt;strong&gt;p&lt;/strong&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isGreenApple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Green&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getColor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isHeavyApple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getWeight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;150&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.function.Predicate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;filterApples&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inventory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Predicate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inventory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To test this you can call&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;filterApples&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;inventory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;Apple:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isGreenApple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// or&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;filterApples&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;inventory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;Apple:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isHeavyApple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;predicate-in-java&quot;&gt;Predicate in Java&lt;/h2&gt;
    &lt;p&gt;In Java, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Predicate&amp;lt;T&amp;gt;&lt;/code&gt; interface is part of the java.util.function package and plays a central role in functional-style programming.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@FunctionalInterface&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Predicate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;It defines a single abstract method : test(T t)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;This makes it a functional interface , which means you can assign lambda expressions or method references to it.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;It represents a boolean-valued function (i.e., a condition) on one input.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;basic-usage&quot;&gt;Basic Usage&lt;/h3&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.function.Predicate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Main&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Define a predicate using a lambda&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Predicate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;isLongerThan5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Use the test() method&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isLongerThan5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;// false&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isLongerThan5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;longstring&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;filtering-collections&quot;&gt;Filtering Collections&lt;/h3&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;words&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;bat&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;carrot&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;dog&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;elephant&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;longWords&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;words&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Predicate&lt;T&gt; also provides default methods for composing conditions:&lt;/T&gt;&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Predicate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;startsWithA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;startsWith&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Predicate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;endsWithZ&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;endsWith&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;z&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Combine with .and(), .or(), .negate()&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Predicate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;combined&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;startsWithA&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endsWithZ&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;combined&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;applez&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;combined&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// false&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;anonymous-inner-classs&quot;&gt;Anonymous Inner classs&lt;/h2&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MeaningOfThis&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;doIt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Runnable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Runnable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;MeaningOfThis&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MeaningOfThis&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;doIt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;First, MeaningOfThis has a variable value with value 4. Next, the doIt method declares a local value with value 6, shadowing the field. Then, an inner class is defined with its own value set to 5. Inside its run method, another local value is declared with value 10. However, this.value refers to the inner class&apos;s field, so the output is 5.&lt;/p&gt;
    &lt;p&gt;Before Java 5, a common way to execute code in a separate thread was to implement Runnable and pass it to a Thread object:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Runnable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Runnable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Running in a thread&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Thread&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// This actually starts a new thread&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;r.run(), which does not start a new thread — it just calls the method directly on the current thread.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Java 5 introduced the java.util.concurrent package, including ExecutorService, which abstracts thread creation and management. You submit tasks to a thread pool, and you can optionally get a result via a Future.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.concurrent.*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Example&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Exception&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ExecutorService&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;executor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Executors&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;newFixedThreadPool&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Runnable example (no result)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;executor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Running in a thread pool&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Callable example (returns a result)&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Future&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;future&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;executor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Task completed!&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;future&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Wait and get the result&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;executor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;shutdown&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Java 8 (2014) introduced CompletableFuture in java.util.concurrent.&lt;/p&gt;
    &lt;p&gt;It implements both Future and CompletionStage.&lt;/p&gt;
    &lt;p&gt;Adds non-blocking, chainable async programming&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;CompletableFuture&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;supplyAsync&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;thenApply&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; World&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;thenAccept&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;No manual get() needed — it reacts when data is ready.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Supports chaining (thenApply, thenCompose) and combining multiple tasks (allOf, anyOf).&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;lambda-expression&quot;&gt;Lambda expression&lt;/h2&gt;
    &lt;p&gt;it&apos;s the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;anonymous functions&lt;/code&gt; that can be passed around. So there are first class citizens in java. It has three parts&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Lambda parameters&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Arrow&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Lambda body&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// takes one parameter of tyep string and returns an int&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Apple&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getWeight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// return a boolean (implied)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//takes no parameters and returns an int&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;functional-interface&quot;&gt;Functional Interface&lt;/h2&gt;
    &lt;p&gt;Interface that only has exactly one &lt;strong&gt;abstract method&lt;/strong&gt;. e.g. predicate, runnable, comparator.&lt;/p&gt;
  </description>
  <pubDate>2025-07-12T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/review-book-modern-java-in-action</link>
<guid isPermaLink="true">https://randomwits.com/blog/review-book-modern-java-in-action</guid>
</item>
<item>
  <title>How to Get Peru Tourist Visa from USA with Indian passport</title>
  <description>&lt;p&gt;My experience on how to get Peru&apos;s tourist visa with India passport living in the US.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;My experience on how to get Peru&apos;s tourist visa with India passport living in the US.&lt;/p&gt;
    &lt;h2 id=&quot;option-1&quot;&gt;Option 1&lt;/h2&gt;
    &lt;p&gt;You don&apos;t need tourist visa if you have a US visa that&apos;s valid for at least six months before the day of arrival&lt;sup id=&quot;fnref:Peru&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:Peru&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. However if you dont&apos; fall under this category, then you need option 2.&lt;/p&gt;
    &lt;h2 id=&quot;option-2&quot;&gt;Option 2&lt;/h2&gt;
    &lt;h3 id=&quot;rap-sheet-request&quot;&gt;Rap Sheet request&lt;/h3&gt;
    &lt;p&gt;Peru consulate expects a &lt;strong&gt;negative criminal report&lt;/strong&gt;. You need to request for FBI&apos;s &quot;Identity History Summary&quot; (also called the &quot;rap sheet&quot;). It shows whether you have a criminal record in the U.S. If you have no record, it explicitly states &quot;No arrest data found&quot;.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Go to &lt;a href=&quot;https://www.edo.cjis.gov/#/&quot;&gt;https://www.edo.cjis.gov/#/&lt;/a&gt;&lt;/p&gt;
    &lt;p&gt;Enter your e-mail address to start the Identity History Summary Check Process!&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Enter your email and remember the &lt;strong&gt;pin&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Would you like your social security number included on the response? 
    No&lt;/p&gt;
    &lt;p&gt;How would you like to submit your fingerprint card? Electronic submission via third party&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;After completing the application, you will be asked to pay 18 dollars.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Next select USPS nearby for fingerprints&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;additional-documents&quot;&gt;Additional Documents&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Travel Itinerary:&lt;/strong&gt; You must provide complete flight details, including both international and domestic flights within Peru.&lt;br /&gt;
    &lt;em&gt;Note:&lt;/em&gt; When I first submitted only my international arrival and departure details, the Peru Embassy in Washington contacted me&lt;sup id=&quot;fnref:number&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:number&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; and requested the full itinerary. They asked me to email it to: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;visas@conperdc.org&lt;/code&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Recent Bank Statements:&lt;/strong&gt; Include copies of your last three bank statements.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Driver’s License Copy:&lt;/strong&gt; Attach a copy of your valid driver’s license.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Original Passport:&lt;/strong&gt; Submit your original passport.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;peru-visa&quot;&gt;Peru Visa&lt;/h2&gt;
    &lt;p&gt;Finally got &lt;strong&gt;Peru visa&lt;/strong&gt; stamped on my passport.&lt;/p&gt;
    &lt;p&gt;&lt;img align=&quot;center&quot; loading=&quot;lazy&quot; src=&quot;https://raw.githubusercontent.com/tushar-sharma/imgs/main/online/peru_visa.png&quot; /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:Peru&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.gob.pe/institucion/rree/informes-publicaciones/279522-convenios-de-visas-para-ciudadanos-extranjeros&quot;&gt;https://www.gob.pe/&lt;/a&gt; &lt;a href=&quot;#fnref:Peru&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:number&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Peru embassy number in Washington, DC is +1 (202) 990-4064 &lt;a href=&quot;#fnref:number&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-07-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/peru-tourist-visa-from-usa</link>
<guid isPermaLink="true">https://randomwits.com/blog/peru-tourist-visa-from-usa</guid>
</item>
<item>
  <title>Understanding Webservers in Frameworks</title>
  <description>&lt;p&gt;Curious in understanding webservers role in popular frameworks.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h3 id=&quot;fastapi-and-uvicorn&quot;&gt;FastAPI and Uvicorn&lt;/h3&gt;
    &lt;p&gt;FastAPI is a modern, asynchronous web framework for building APIs.&lt;br /&gt;
    It requires an &lt;strong&gt;ASGI-compatible web server&lt;/strong&gt; (like &lt;strong&gt;Uvicorn&lt;/strong&gt;) to handle HTTP requests, since it doesn&apos;t include a server itself.&lt;br /&gt;
    Uvicorn is a high-performance ASGI server that supports asynchronous I/O and is well-suited for FastAPI.&lt;br /&gt;
    This contrasts with Django, which uses &lt;strong&gt;WSGI&lt;/strong&gt; — a synchronous and blocking interface — making FastAPI more performant and scalable for concurrent workloads.&lt;/p&gt;
    &lt;h3 id=&quot;django-and-wsgi&quot;&gt;Django and WSGI&lt;/h3&gt;
    &lt;p&gt;Django includes a built-in development server based on &lt;strong&gt;WSGI&lt;/strong&gt; (Web Server Gateway Interface), which is synchronous and blocking.&lt;br /&gt;
    This server is suitable for development but not recommended for production.&lt;br /&gt;
    For production, Django apps are typically served with servers like &lt;strong&gt;Gunicorn&lt;/strong&gt; or &lt;strong&gt;uWSGI&lt;/strong&gt;, often behind a reverse proxy like &lt;strong&gt;Nginx&lt;/strong&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;spring-boot&quot;&gt;Spring Boot&lt;/h3&gt;
    &lt;p&gt;Spring Boot is a Java framework that includes an &lt;strong&gt;embedded web server&lt;/strong&gt; by default, simplifying deployment:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;For traditional servlet-based applications, it uses servers like &lt;strong&gt;Apache Tomcat&lt;/strong&gt;, &lt;strong&gt;Jetty&lt;/strong&gt;, or &lt;strong&gt;Undertow&lt;/strong&gt;.&lt;/li&gt;
    &lt;li&gt;For reactive, non-blocking applications, it uses &lt;strong&gt;Netty&lt;/strong&gt;, which supports asynchronous processing and backpressure.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;This flexibility allows Spring Boot to support both blocking (traditional) and reactive programming models.&lt;/p&gt;
    &lt;h3 id=&quot;angular&quot;&gt;Angular&lt;/h3&gt;
    &lt;p&gt;Angular is a frontend framework for building single-page applications (SPAs).&lt;br /&gt;
    It does &lt;strong&gt;not&lt;/strong&gt; include a backend server; instead, it runs in the browser and communicates with backend APIs over HTTP.&lt;br /&gt;
    During development, Angular uses a development server (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng serve&lt;/code&gt;) powered by Webpack Dev Server to serve the frontend assets and enable live reload.&lt;br /&gt;
    In production, Angular apps are compiled into static files (HTML, JS, CSS) and served by any static file server or CDN.&lt;/p&gt;
    &lt;h3 id=&quot;nestjs&quot;&gt;NestJS&lt;/h3&gt;
    &lt;p&gt;NestJS is a Node.js backend framework built with TypeScript and inspired by Angular’s architecture.&lt;br /&gt;
    It supports multiple underlying HTTP servers:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;By default, it uses &lt;strong&gt;Express&lt;/strong&gt;, which is synchronous and callback-based (though async is supported).&lt;/li&gt;
    &lt;li&gt;It can also use &lt;strong&gt;Fastify&lt;/strong&gt;, which is faster and supports async handlers.&lt;br /&gt;
    NestJS is modular and supports building scalable server-side applications, with support for WebSockets, microservices, and GraphQL.&lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2025-06-28T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/understanding-webservers-in-frameworks</link>
<guid isPermaLink="true">https://randomwits.com/blog/understanding-webservers-in-frameworks</guid>
</item>
<item>
  <title>Can Logic Alone Lead Us to Truth?</title>
  <description>&lt;p&gt;If you drop a feather and an elephant from a mountain, who hits the ground first?&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;If you’ve lived all your life on Earth—just like the rest of us—you&apos;d probably say it’s the elephant. Why? You may never have done the experiment yourself, but it &lt;em&gt;seems&lt;/em&gt; logical. But here&apos;s a deeper question: &lt;strong&gt;Can we rely solely on logic to lead us to truth?&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Now imagine you had special powers and lived on the Moon instead. In that case, you might answer differently. On the Moon, with no atmosphere to create air resistance, a feather and an elephant would fall at the same time. This isn’t just theoretical—NASA astronauts during the Apollo 15 mission actually performed this experiment using a hammer and a feather. The results were clear: both objects hit the lunar surface simultaneously.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/oYEgdZ3iEKA?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/oYEgdZ3iEKA?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/oYEgdZ3iEKA/hqdefault.jpg alt=&apos;Hammer and Feather NASA&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Hammer and Feather NASA&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;So why don’t they fall at the same rate on Earth?&lt;/p&gt;
    &lt;p&gt;It&apos;s because of &lt;strong&gt;air resistance&lt;/strong&gt;. Earth has an atmosphere, and as objects fall, they experience drag depending on their shape, mass, and surface area. A feather flutters down slowly due to its large surface area and low mass, while an elephant plummets quickly.&lt;/p&gt;
    &lt;p&gt;But let’s look at what physics tells us about gravity:&lt;/p&gt;
    &lt;p&gt;According to &lt;strong&gt;Newton&apos;s Second Law&lt;/strong&gt;, force equals mass times acceleration:&lt;/p&gt;
    &lt;p&gt;$$ F = m \cdot a $$&lt;/p&gt;
    &lt;p&gt;And the gravitational force between two objects is given by Newton&apos;s Law of Universal Gravitation:&lt;/p&gt;
    &lt;p&gt;$$ F = G \frac{m_1 \cdot m_2}{r^2} $$&lt;/p&gt;
    &lt;p&gt;If we equate these two expressions (since gravity is the force acting), and let $ m_1 $ be the mass of the falling object:&lt;/p&gt;
    &lt;p&gt;$$ m_1 \cdot a = G \frac{m_1 \cdot m_2}{r^2} $$&lt;/p&gt;
    &lt;p&gt;We can cancel $ m_1 $ from both sides:&lt;/p&gt;
    &lt;p&gt;$$ a = G \frac{m_2}{r^2} $$&lt;/p&gt;
    &lt;p&gt;This shows that the &lt;strong&gt;acceleration due to gravity does not depend on the mass of the falling object&lt;/strong&gt;—only on the mass of the planet and the distance from its center. So in a vacuum, all objects fall at the same rate regardless of their mass.&lt;/p&gt;
    &lt;h3 id=&quot;but-what-about-logic&quot;&gt;But What About Logic?&lt;/h3&gt;
    &lt;p&gt;Let’s consider a few more examples where logic alone might mislead us:&lt;/p&gt;
    &lt;h4 id=&quot;there-must-be-a-god-because-the-universe-is-so-perfectly-tuned&quot;&gt;“There must be a god because the universe is so perfectly tuned.”&lt;/h4&gt;
    &lt;p&gt;This argument relies on what’s known as the &lt;strong&gt;design fallacy&lt;/strong&gt;. While the physical constants of the universe do appear finely tuned for life, this observation doesn’t prove the existence of a divine designer. It may be true, or there could be other explanations such as multiverse theory or unknown natural laws. Without empirical evidence, &lt;strong&gt;logic alone cannot confirm such claims&lt;/strong&gt;.&lt;/p&gt;
    &lt;h4 id=&quot;the-sun-orbits-the-earthit-looks-like-it-moves-across-the-sky&quot;&gt;“The Sun orbits the Earth—it looks like it moves across the sky!”&lt;/h4&gt;
    &lt;p&gt;Before Copernicus and Galileo, this seemed perfectly logical based on observation. After all, the Sun appears to rise and set. But appearances can be deceiving. We often accept scientific facts on trust—like many people today believe the Earth orbits the Sun simply because their science teacher said so, without ever having conducted the experiments themselves.&lt;/p&gt;
    &lt;h4 id=&quot;if-something-feels-morally-right-it-must-be-right&quot;&gt;“If something feels morally right, it must be right.”&lt;/h4&gt;
    &lt;p&gt;Morality is deeply tied to culture, upbringing, and personal belief. Consider how slavery was once considered &quot;natural&quot; and even morally justified by many societies. Over time, increased awareness, empathy, and understanding of human rights led to a shift in moral thinking. This evolution shows that &lt;strong&gt;morality is not fixed logic, but a dynamic process informed by experience and evidence&lt;/strong&gt;.&lt;/p&gt;
    &lt;h4 id=&quot;light-must-be-a-particle-since-it-scatters-through-a-prism&quot;&gt;“Light must be a particle since it scatters through a prism.”&lt;/h4&gt;
    &lt;p&gt;Newton believed light was made of particles, partly based on his prism experiments showing how white light splits into colors. However, later discoveries like the double-slit experiment showed wave-like behavior, and Einstein’s explanation of the photoelectric effect brought back the idea of particles. Light turned out to be &lt;strong&gt;both a wave and a particle&lt;/strong&gt;—a concept only revealed through experimentation and further refinement of theory.&lt;/p&gt;
    &lt;h3 id=&quot;when-logic-isnt-enough&quot;&gt;When Logic Isn&apos;t Enough&lt;/h3&gt;
    &lt;p&gt;There are countless theories throughout history that seemed logical at the time, yet were proven wrong by empirical evidence:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Miasma Theory&lt;/strong&gt;: The belief that diseases were caused by &quot;bad air.&quot;&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Steady State Theory&lt;/strong&gt;: The idea that the universe has always existed in an unchanging state.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Geocentric Model&lt;/strong&gt;: The belief that Earth is the center of the universe.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Spontaneous Generation&lt;/strong&gt;: The idea that life can arise from non-living matter.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;These theories were eventually replaced not because they lacked logic, but because they failed under experimental scrutiny.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;“The test of all knowledge is experiment” — Richard Feynman&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Logic is a powerful tool—it helps us form hypotheses, ask questions, and make predictions. But &lt;strong&gt;truth ultimately lies in the real world&lt;/strong&gt;, and the only way to access it reliably is through &lt;strong&gt;empirical testing&lt;/strong&gt;. The universe doesn’t care how logical our reasoning seems; it reveals itself only when we test our ideas against reality.&lt;/p&gt;
  </description>
  <pubDate>2025-06-26T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/can-logic-alone-lead-us-to-truth</link>
<guid isPermaLink="true">https://randomwits.com/blog/can-logic-alone-lead-us-to-truth</guid>
</item>
<item>
  <title>Getting Started with Redis: Concepts, Commands, and Monitoring</title>
  <description>&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;
    &lt;p&gt;Redis is a in-memory NoSQL database mainly used for caching. It&apos;s a key-value store which means each unique keys map to a value which could be either a stirng, list, set, hash, blob, JSON or any other data. Each keys are unique and can be queried.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Redis is a in-memory NoSQL database mainly used for caching. It&apos;s a key-value store which means each unique keys map to a value which could be either a stirng, list, set, hash, blob, JSON or any other data. Each keys are unique and can be queried.&lt;/p&gt;
    &lt;h2 id=&quot;connecting-to-a-redis-cluster&quot;&gt;Connecting to a Redis Cluster&lt;/h2&gt;
    &lt;p&gt;To connect to a Redis cluster securely using the command line, you can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redis-cli&lt;/code&gt; tool with TLS and authentication:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex1.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;common-redis-operations&quot;&gt;Common Redis Operations&lt;/h2&gt;
    &lt;p&gt;Common redis operations across different data types:&lt;/p&gt;
    &lt;h3 id=&quot;string-operations&quot;&gt;String Operations&lt;/h3&gt;
    &lt;p&gt;Strings are the simplest Redis data type. A Redis string value can be up to 512 MB in size&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex2.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;list-operations&quot;&gt;List Operations&lt;/h3&gt;
    &lt;p&gt;Redis Lists are implemented as linked lists, optimized for fast insertions and deletions from both ends.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex3.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;hash-operations&quot;&gt;Hash Operations&lt;/h3&gt;
    &lt;p&gt;Hashes are maps between string fields and string values, ideal for representing objects.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex4.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;set-operations&quot;&gt;Set Operations&lt;/h3&gt;
    &lt;p&gt;Sets are unordered collections of unique strings. They support powerful set algebra operations.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex5.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;sorted-set-operations&quot;&gt;Sorted Set Operations&lt;/h3&gt;
    &lt;p&gt;Sorted Sets are similar to Sets but with an associated score that allows ordering.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex6.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;key-management--expiration&quot;&gt;Key Management &amp;amp; Expiration&lt;/h2&gt;
    &lt;p&gt;Redis allows setting time-to-live (TTL) on keys and inspecting their status.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex7.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;monitoring-redis-memory-usage&quot;&gt;Monitoring Redis Memory Usage&lt;/h2&gt;
    &lt;p&gt;Use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;INFO MEMORY&lt;/code&gt; command to inspect memory consumption:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex8.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;subscribing-to-keyspace-events&quot;&gt;Subscribing to Keyspace Events&lt;/h2&gt;
    &lt;p&gt;Redis provides a pub/sub mechanism to monitor events such as key updates, deletions, and expirations. To subscribe to all events under the myApp namespace:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex9.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;automating-event-monitoring-with-python&quot;&gt;Automating Event Monitoring with Python&lt;/h3&gt;
    &lt;p&gt;You can automate monitoring of Redis keyspace events using Python and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redis&lt;/code&gt; library. The following script connects to Redis, subscribes to a pattern, and logs events to both a file and the console:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex10.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;sample-output&quot;&gt;&lt;strong&gt;Sample Output:&lt;/strong&gt;&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9e3075f5b90a37f78de2a38c80a13c48.js?file=ex11.txt&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2025-06-18T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/getting-started-with-redis</link>
<guid isPermaLink="true">https://randomwits.com/getting-started-with-redis</guid>
</item>
<item>
  <title>Anecdotal Travel Tips for Smart Flying</title>
  <description>&lt;p&gt;Anecdotal Travel Tips for Smart Flying.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Anecdotal Travel Tips for Smart Flying.&lt;/p&gt;
    &lt;h2 id=&quot;early-check-in&quot;&gt;Early Check in&lt;/h2&gt;
    &lt;p&gt;Check in 24 hours before your flight to avoid overbooking risks and secure preferred seating. Many airlines allocate unclaimed seats to standby passengers just before departure, so early check-in ensures your spot.&lt;/p&gt;
    &lt;h2 id=&quot;check-if-you-need-visa&quot;&gt;Check if you need visa?&lt;/h2&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.traveldoc.aero/&quot;&gt;traveldoc.aero&lt;/a&gt; allows you to check if you need visa for your destination. It also helps to check if you need transit visa.&lt;/p&gt;
    &lt;h2 id=&quot;ear-pain&quot;&gt;Ear pain&lt;/h2&gt;
    &lt;p&gt;I have started getting ear pain recently. Mostly it&apos;s during take off and landing. Few things have helped me alleviate the pain&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Chew gum or suck on ginger candy to stimulate swallowing (opens Eustachian tubes).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Use filtered earplugs (e.g., Flents Quiet or Alpine Sleepsaver) to gradually equalize pressure. Currently I use these from &lt;a href=&quot;https://www.amazon.com/dp/B07K2T3XRX&quot;&gt;MUDEELA&lt;/a&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Try the Valsalva maneuver : Pinch your nose, close your mouth, and gently blow to pop your ears.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;seat-selection&quot;&gt;Seat Selection&lt;/h2&gt;
    &lt;h3 id=&quot;comfort&quot;&gt;Comfort&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Less turbulence&lt;/strong&gt;: Seats near the wings or front of the plane are closer to the aircraft’s center of gravity, reducing perceived motion.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Long flights&lt;/strong&gt;: Wear compression socks to improve circulation and lower DVT (deep vein thrombosis) risk.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Sleep better&lt;/strong&gt;: Pack a 100% blackout eye mask (e.g., Manta Sleep Mask ) for better sleep&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;safety&quot;&gt;Safety&lt;/h3&gt;
    &lt;p&gt;Recently crash of Air India flight  AI171 , Boeing 787-8 Dreamliner, almost killed everyone onboard . The sole survivor was seated in 11A , a window seat near an emergency exit&lt;sup id=&quot;fnref:tweet&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:tweet&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. While not a guarantee, sitting within 5 rows of an exit improves evacuation odds. Here is the &lt;a href=&quot;https://www.seatguru.com/airlines/Air_India/Air_India_Boeing_787-8.php&quot;&gt;seat map&lt;/a&gt; of the plane.&lt;/p&gt;
    &lt;p&gt;This case highlights how seat location might influence outcomes, though survival depends heavily on the accident type. Intriguingly, some analyses indicate that first-class seats may statistically correlate with slightly lower survival rates in crashes compared to rear economy seats—possibly due to their forward positioning. A small consolation for economy passengers: Don&apos;t feel bad for being in &apos;cattle class&apos;.&lt;/p&gt;
    &lt;h2 id=&quot;portable-travel-bidet&quot;&gt;Portable travel bidet&lt;/h2&gt;
    &lt;p&gt;Personal hygiene preferences vary, but a portable bidet enhances cleanliness mid-flight. Bidets I use&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Electronic &lt;a href=&quot;https://www.amazon.com/dp/B09DYYKVRH&quot;&gt;bidet&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Non-electronic &lt;a href=&quot;https://www.amazon.com/dp/B09DYYKVRH&quot;&gt;bidet&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;entertainment&quot;&gt;Entertainment&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Read&lt;/strong&gt;: A Kindle is ideal for books (no glare, lightweight).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Watch&lt;/strong&gt;: Download movies on an iPad via Netflix or Prime Video (downloads usually expires like 48 hours).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Listen&lt;/strong&gt;: Bring noise-canceling headphones—airline-issued earbuds rarely deliver quality sound.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Game&lt;/strong&gt;: A Steam Deck provides offline gaming versatility for long hauls.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;food&quot;&gt;Food&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Avoid alcohol&lt;/strong&gt; : Dehydration at altitude amplifies hangover effects.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Tomato juice&lt;/strong&gt;: Studies suggest umami flavors intensify at 35,000 feet, making tomato juice taste richer.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Skip carbonated drinks&lt;/strong&gt;: Gas expands in low-pressure cabins, potentially causing bloating or discomfort.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:tweet&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://x.com/piersmorgan/status/1933196679672463667&quot;&gt;Twitter&lt;/a&gt; &lt;a href=&quot;#fnref:tweet&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-06-12T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/travelling-hacks</link>
<guid isPermaLink="true">https://randomwits.com/blog/travelling-hacks</guid>
</item>
<item>
  <title>Daily Logs for June 9, 2025</title>
  <description>&lt;p&gt;Dear Vishi, daily logs for June 9, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, daily logs for June 9, 2025&lt;/p&gt;
    &lt;h2 id=&quot;coffee-and-coackroaches&quot;&gt;Coffee and Coackroaches&lt;/h2&gt;
    &lt;p&gt;I learned that cockroach residues can be present in coffee. The FDA allows up to 5% insect residue in certain food products, including coffee. Cockroaches are often attracted to coffee beans stored in warehouses. It is not financially viable to completely separate roaches from coffee during processing.&lt;/p&gt;
    &lt;p&gt;Three reasons I stay away from coffee:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;It may contain cockroach residue&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;I don’t like the taste&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;It fails the Ames test&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Note: The Ames test is a widely used assay to detect substances that can cause genetic mutations. If coffee &quot;fails&quot; this test in its raw form, it typically refers to unbrewed or concentrated extracts — brewed coffee usually does not show mutagenic activity due to dilution and chemical transformation during roasting.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;python&quot;&gt;Python&lt;/h2&gt;
    &lt;p&gt;In a simple Python program:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/e2150965874553947a1467ce0efed189.js?file=ex1.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;__new__&lt;/code&gt; method is a low-level constructor that’s usually hidden from view. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;__init__&lt;/code&gt; method is called after &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;__new__&lt;/code&gt; and is used to initialize instance attributes.&lt;/p&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;self&lt;/code&gt; is just like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;this&lt;/code&gt; which is used to refrence the current instance of the class.&lt;/p&gt;
    &lt;h3 id=&quot;list-cmprehension&quot;&gt;List Cmprehension&lt;/h3&gt;
    &lt;p&gt;It&apos;s like a for loop in a one line&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/e2150965874553947a1467ce0efed189.js?file=ex2.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Here &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a+1&lt;/code&gt; is  computed for each element.&lt;/p&gt;
    &lt;h3 id=&quot;lambda&quot;&gt;Lambda&lt;/h3&gt;
    &lt;p&gt;Lambda functions originate from lambda calculus. They provide a shorthand way to define small, anonymous functions:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/e2150965874553947a1467ce0efed189.js?file=ex3.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2025-06-09T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-06-09</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-06-09</guid>
</item>
<item>
  <title>Daily Logs for May 30, 2025</title>
  <description>&lt;p&gt;Dear Vishi, daily logs for May 30, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, daily logs for May 30, 2025.&lt;/p&gt;
    &lt;h2 id=&quot;songs-recommendation&quot;&gt;Songs Recommendation&lt;/h2&gt;
    &lt;p&gt;The songs that I am currently listening in a loop:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Fleetwood Mac - Little Lies&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Fleetwood Mac - Everywhere&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Fleetwood Mac - Dreams&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;be-here-now&quot;&gt;Be Here Now&lt;/h2&gt;
    &lt;p&gt;Excerpts from reading &lt;strong&gt;Be Here Now&lt;/strong&gt; by Ram Dass&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;So I left to go to India, and I took a bottle of LSD with me, with the idea that I&apos;d meet holy men along the way, and I&apos;d give them LSD and they&apos;d tell me what LSD is. Maybe I&apos;d learn the missing clue.&lt;/p&gt;
    &lt;/blockquote&gt;
  </description>
  <pubDate>2025-05-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-05-30</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-05-30</guid>
</item>
<item>
  <title>Daily Logs for May 29, 2025</title>
  <description>&lt;p&gt;Dear Vishi, daily logs for May 29, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, daily logs for May 29, 2025.&lt;/p&gt;
    &lt;h2 id=&quot;neuroplasticity&quot;&gt;Neuroplasticity&lt;/h2&gt;
    &lt;p&gt;Neuroplasticity is the brain&apos;s ability to change and adapt in response to new information and challenges. I&apos;ve been thinking about various ways I can increase neuroplasticity.&lt;/p&gt;
    &lt;p&gt;Recently, I started playing ping pong with my left (non-dominant) hand. It&apos;s fun and also keeps me competitive against people who arent great at the sport.&lt;/p&gt;
    &lt;h2 id=&quot;military-wife-detained-deported-at-honolulu-airport&quot;&gt;Military wife detained, deported at Honolulu airport&lt;/h2&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/0cYsSl-twEg?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/0cYsSl-twEg?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/0cYsSl-twEg/hqdefault.jpg alt=&apos;Military wife detained, deported at Honolulu airport&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Military wife detained, deported at Honolulu airport&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;alan-wake-2&quot;&gt;Alan Wake 2&lt;/h2&gt;
    &lt;p&gt;I&apos;m currently stuck at the Mulligan and Thornton boss fight. Ammo is limited, and painkillers take time to consume. The boss fights in this game are difficult, even though I chose Story Mode (the easiest).&lt;/p&gt;
    &lt;p&gt;The game has great moments to make it a great game. However searching through the dark with navigation makes it frustrating. Also the combat is not good. Bailed on it.&lt;/p&gt;
    &lt;h2 id=&quot;qwen-ai-bug&quot;&gt;Qwen AI bug&lt;/h2&gt;
    &lt;p&gt;I like Qwen AI, which is a model by Alibaba. However, there&apos;s a bug where it asks you to slide the button for verification.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; loading=&quot;lazy&quot; src=&quot;https://miro.medium.com/v2/resize:fit:786/format:webp/1*xr4ypMZN6LM5X1pnoBVjtw.png&quot; alt=&quot;Qwen&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;The trick is to move the slider very slowly. Otherwise, you can still use the chat without logging in — but an annoying popup keeps appearing every 5 seconds, asking you to sign up.&lt;/p&gt;
  </description>
  <pubDate>2025-05-29T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-05-29</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-05-29</guid>
</item>
<item>
  <title>Where to play Table Tennis in Winston Salem, NC</title>
  <description>&lt;p&gt;You can play table tennis in Winstaon Salem at.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;You can play table tennis in Winstaon Salem at Miller Park. It&apos;s free of charge but they do ask for $20/ year donation if you become regular. Currently the schedule&lt;sup id=&quot;fnref:schedule&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:schedule&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;Monday, Wednesday, Friday&lt;/td&gt;
    &lt;td&gt;10:00 a.m. - 1:00 p.m.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Wednesday&lt;/td&gt;
    &lt;td&gt;6:30 p.m. - 8:30 p.m.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Saturday	10:00 a.m. - 12:00 p.m.&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:schedule&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.cityofws.org/1631/Recreation-Center-Programs&quot;&gt;Recreation Center Program&lt;/a&gt; &lt;a href=&quot;#fnref:schedule&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-05-28T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/table-tennis-winston-salem-nc</link>
<guid isPermaLink="true">https://randomwits.com/blog/table-tennis-winston-salem-nc</guid>
</item>
<item>
  <title>Daily Logs for 28 May, 2025</title>
  <description>&lt;p&gt;Dear Vishi, daily logs for May 28, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, daily logs for May 28, 2025.&lt;/p&gt;
    &lt;h2 id=&quot;game-recommendation&quot;&gt;Game Recommendation&lt;/h2&gt;
    &lt;p&gt;If you like cozy games then probably try &lt;strong&gt;The WereCleaner&lt;/strong&gt;. It&apos;s &lt;a href=&quot;https://store.steampowered.com/app/2795000/The_WereCleaner/&quot;&gt;free&lt;/a&gt; on Steam. You play as a janitor who needs to pay his rent. However you are also a warewolf who can eat people. Would recommend it. My only pet peeve is that it&apos;s too short.&lt;/p&gt;
    &lt;h2 id=&quot;student-visa-ban&quot;&gt;Student Visa ban&lt;/h2&gt;
    &lt;p&gt;I woke up to the news that Trump administration has frozen student visa appointment for all US universities&lt;sup id=&quot;fnref:bbc&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:bbc&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. Previously, US government had barred &lt;strong&gt;Harvard University&lt;/strong&gt; to enroll foreign students, though this was overruled by the judge&lt;sup id=&quot;fnref:harward&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:harward&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;nintendo-switch-games-on-steam-deck&quot;&gt;Nintendo Switch Games on Steam Deck&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Install EmuDeck&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Download &lt;a href=&quot;https://archive.org/details/yuzu-ea-build-4176-linux&quot;&gt;yuzu image&lt;/a&gt; and copy it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/Applications&lt;/code&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Download firmware and install it from &lt;a href=&quot;https://github.com/THZoria/NX_Firmware/releases&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Get &lt;a href=&quot;https://web.archive.org/web/20230101000000*/https://raw.githubusercontent.com/icosaswitch/Yuzu-NAND/master/prod.keys&quot;&gt;prod keys&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Follow this &lt;a href=&quot;https://www.youtube.com/watch?v=tzwqEL3Zs_g&quot;&gt;tutorial&lt;/a&gt; for more information&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;music-would-be-the-last-feast-i-devour&quot;&gt;Music would be the last feast I devour&lt;/h2&gt;
    &lt;p&gt;Death is inevitable. I&apos;ve been thinking that only a few are lucky enough to choose the right setting for their final breath. Imagine being killed suddenly in a car crash or an accident — robbed of the chance to fulfill your last wish. If fate were to cast its dice favorably for me, would I get to decide my own final wish? Whatever it might be, I know I wouldn&apos;t want to die in silence. I don&apos;t dream of a lavish meal before passing; instead, I want a playlist of my favorite songs. As I close my eyes, I would want the music to slowly fade away. Let me go with music playing in the background — that would be my last wish. Dying without music feels dull and cruel. Music would be the last feast I devour.&lt;/p&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:bbc&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.bbc.com/news/articles/cy75eenl46eo&quot;&gt;US halts student visa appointments and plans expanded social media vetting&lt;/a&gt; &lt;a href=&quot;#fnref:bbc&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:harward&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.npr.org/2025/05/22/nx-s1-5407878/trump-harvard-international-students&quot;&gt;Trump administration revokes Harvard&apos;s ability to enroll international students&lt;/a&gt; &lt;a href=&quot;#fnref:harward&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2025-05-28T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-05-28</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-05-28</guid>
</item>
<item>
  <title>The Last Of Us Part 1 Steam Deck crashing</title>
  <description>&lt;p&gt;If you&apos;ve recently installed &lt;em&gt;The Last of Us Part I&lt;/em&gt; on your Steam Deck using Lutris and it&apos;s crashing at launch, here&apos;s a step-by-step guide to get it running.
    &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;If you&apos;ve recently installed &lt;em&gt;The Last of Us Part I&lt;/em&gt; on your Steam Deck using Lutris and it&apos;s crashing at launch, here&apos;s a step-by-step guide to get it running.&lt;/p&gt;
    &lt;h3 id=&quot;launch-the-game&quot;&gt;Launch the game&lt;/h3&gt;
    &lt;p&gt;Install the game using &lt;strong&gt;lutris&lt;/strong&gt;. Add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;launcher.exe&lt;/code&gt; as a &lt;strong&gt;Non-Steam Game&lt;/strong&gt; to Steam, and rename it to: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;The Last Of Us Part 1&lt;/code&gt;. Launch the game let it crash. This creates the Proton prefix that Protontricks will use later.&lt;/p&gt;
    &lt;h3 id=&quot;ssh-into-your-steam-deck&quot;&gt;SSH Into Your Steam Deck&lt;/h3&gt;
    &lt;p&gt;Use SSH to connect to your Steam Deck:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/3b990ba755d08f6946e0d1d2a77e78be.js?file=ex1.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Navigate to your Downloads folder and download the necessary installers:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/3b990ba755d08f6946e0d1d2a77e78be.js?file=ex2.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;step-3-install-dependencies-with-protontricks&quot;&gt;Step 3: Install Dependencies with Protontricks&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;Open &lt;strong&gt;Protontricks&lt;/strong&gt;.&lt;/li&gt;
    &lt;li&gt;Select &lt;em&gt;The Last of Us Part I&lt;/em&gt;.&lt;/li&gt;
    &lt;li&gt;Click &quot;Install an Application&quot; and hit &lt;strong&gt;OK&lt;/strong&gt;.&lt;/li&gt;
    &lt;li&gt;When the next prompt shows up, click &lt;strong&gt;Cancel&lt;/strong&gt;.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;After canceling, a window will open with more options:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Choose &lt;strong&gt;Run Explorer&lt;/strong&gt; and click &lt;strong&gt;OK&lt;/strong&gt;.&lt;/li&gt;
    &lt;li&gt;In the file browser, navigate to: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\home\deck\Downloads&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Double-click both &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vc_redist.x64.exe&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dotnet-sdk-3.1.426-win-x64.exe&lt;/code&gt; to install them.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;strong&gt;The Last of Us Part I&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Switch to &lt;strong&gt;Game Mode&lt;/strong&gt; on Steam Deck and launch from there.&lt;/p&gt;
  </description>
  <pubDate>2025-05-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/the-last-of-us-steam-deck-crashing</link>
<guid isPermaLink="true">https://randomwits.com/blog/the-last-of-us-steam-deck-crashing</guid>
</item>
<item>
  <title>Daily Logs for May 11, 2025</title>
  <description>&lt;p&gt;Dear Vishi, daily logs for 11 May, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, daily logs for 11 May, 2025&lt;/p&gt;
    &lt;h2 id=&quot;running&quot;&gt;Running&lt;/h2&gt;
    &lt;p&gt;I like running before lunch. Lunch is the first meal I usually have. I don&apos;t mind skipping the breakfast. Jokingly I call it intermittent fasting but I just not feel hungry enough. However if I miss running  prior to breakfast, I can&apos;t run in the evening.&lt;/p&gt;
    &lt;h2 id=&quot;steam-deck&quot;&gt;Steam Deck&lt;/h2&gt;
    &lt;p&gt;My steam deck has been booting slow lately. I&apos;ve been installing too many non-steam games. I installed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CryptUtilities&lt;/code&gt; and see if it improves performance in my steamdeck.&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/CryoByte33/steam-deck-utilities/main/InstallCryoUtilities.desktop&quot;&gt;Download&lt;/a&gt; this link to your desktop (right click and save file) on your Steam Deck, remove the .download from the end of the file name, then double-click it.&lt;/p&gt;
    &lt;p&gt;This will install the program, create desktop icons, and create menu entries. Open &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CryptUtilities&lt;/code&gt; and apply all recommended settings.&lt;/p&gt;
  </description>
  <pubDate>2025-05-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-05-11</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-05-11</guid>
</item>
<item>
  <title>Daily Logs for 9 May, 2025</title>
  <description>&lt;p&gt;Dear Vishi, daily logs for 9 May, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, daily logs for 9 May, 2025&lt;/p&gt;
    &lt;h2 id=&quot;proton-error&quot;&gt;Proton Error&lt;/h2&gt;
    &lt;p&gt;I have non-steam game, Lonely Mountains Snow Rider, installed on my steam deck. I use &lt;strong&gt;Proton Experimental&lt;/strong&gt; in Compatiblity. However today, I got the &lt;strong&gt;Assertion failed&lt;/strong&gt; error while opening it&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0f49c69c7a57a8551865cbcefaa2b019.js?file=error.log&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Solution is to use another previous Proton version like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Proton 9.0-4&lt;/code&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;filepart-with-doonnext&quot;&gt;FilePart with doOnNext&lt;/h2&gt;
    &lt;p&gt;I am currently working on a problem where I have a &lt;strong&gt;service&lt;/strong&gt;, which calls another API for inserting files&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0f49c69c7a57a8551865cbcefaa2b019.js?file=FilePartService.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This works fine, however the client will take time while the external API is inserting file. However I wanted to return a &lt;strong&gt;202&lt;/strong&gt; status instantly and execute the external api as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;side effect&lt;/code&gt;. Something like this&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0f49c69c7a57a8551865cbcefaa2b019.js?file=FilePartServiceSideEffect.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;However this fail with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;java.nio.file.NoSuchFileException&lt;/code&gt; as the publisher is already closed the stream while the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doOnnext&lt;/code&gt; is executed. &lt;strong&gt;FilePart&lt;/strong&gt; loses the files it stored temporary. I am still working for a better solution.&lt;/p&gt;
    &lt;h2 id=&quot;fix-alan-wake-2-resolution&quot;&gt;Fix Alan Wake 2 Resolution&lt;/h2&gt;
    &lt;p&gt;I am playing &lt;strong&gt;Alan Wake 2&lt;/strong&gt; on steam deck. I bought &lt;a href=&quot;https://www.amazon.com/dp/B0CR6JND4M&quot;&gt;docking station&lt;/a&gt; to connect it to the TV. However the resolution was broken as it launched a tiny, unchangeable window.&lt;/p&gt;
    &lt;p&gt;Solution is to delete &lt;strong&gt;Proton Prefix&lt;/strong&gt; and restart the game. However this deletes the saved game.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0f49c69c7a57a8551865cbcefaa2b019.js?file=stream.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This will force the game to regenerate fresh &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;renderer.ini&lt;/code&gt; and all other config files.&lt;/p&gt;
    &lt;h2 id=&quot;papers-please&quot;&gt;Papers, Please&lt;/h2&gt;
    &lt;p&gt;I am playing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Papers, Please&lt;/code&gt;. I got arrested by Supervisor on Day 26. Solution is to reload Day 25 , either approve or deny her entry. Don&apos;t detain her.&lt;/p&gt;
  </description>
  <pubDate>2025-05-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dialy-logs-2025-05-09</link>
<guid isPermaLink="true">https://randomwits.com/blog/dialy-logs-2025-05-09</guid>
</item>
<item>
  <title>Mastering Parameterized Tests in JUnit 5 with Spring Boot</title>
  <description>&lt;p&gt;Want to test smarter, not harder? Parameterized tests let you run the same test with multiple inputs. In this guide, we&apos;ll dive into JUnit&apos;s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ParameterizedTest&lt;/code&gt; using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@MethodSource&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@CsvSource&lt;/code&gt;, plus how to hook it all into Spring Boot.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Want to test smarter, not harder? Parameterized tests let you run the same test with multiple inputs. In this guide, we&apos;ll dive into JUnit&apos;s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ParameterizedTest&lt;/code&gt; using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@MethodSource&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@CsvSource&lt;/code&gt;, plus how to hook it all into Spring Boot.&lt;/p&gt;
    &lt;h3 id=&quot;set-up-a-spring-boot-project&quot;&gt;Set up a Spring Boot project&lt;/h3&gt;
    &lt;p&gt;Using the Spring Initializr:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Go to &lt;a href=&quot;https://start.spring.io/&quot;&gt;https://start.spring.io/&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Download the project and open it in your IDE with following dependencies&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab Gradle&quot;&gt;&lt;a href=&quot;#Gradle&quot;&gt;Gradle&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab Maven&quot;&gt;&lt;a href=&quot;#Maven&quot;&gt;Maven&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample Gradle&quot; id=&quot;Gradle&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/92db9792cc48780e72938fd978bbf5bd.js?file=build.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample Maven&quot; id=&quot;Maven&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/92db9792cc48780e72938fd978bbf5bd.js?file=pom.xml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h2 id=&quot;creating-a-simple-service&quot;&gt;Creating a Simple Service&lt;/h2&gt;
    &lt;p&gt;This service contains a method isPalindrome that determines if a given string reads the same backward as forward, ignoring spaces and case sensitivity.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/92db9792cc48780e72938fd978bbf5bd.js?file=StringService.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;parameterized-tests-with-methodsource&quot;&gt;Parameterized Tests with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@MethodSource&lt;/code&gt;&lt;/h2&gt;
    &lt;p&gt;Instead of writing multiple @Test methods, we’ll use @ParameterizedTest with @MethodSource to provide a stream of test cases.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/92db9792cc48780e72938fd978bbf5bd.js?file=StringServiceTest.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ParameterizedTest&lt;/code&gt;:&lt;/strong&gt; This tells JUnit that this test method will run multiple times with different parameters.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@MethodSource(&quot;palindromeProvider&quot;)&lt;/code&gt;&lt;/strong&gt;: This annotation links to a static method (palindromeProvider) that supplies a stream of arguments.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;palindromeProvider&lt;/code&gt;&lt;/strong&gt;: Returns a Stream&lt;Arguments&gt; where each Arguments.of() represents a test case. For example:&lt;/Arguments&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;madam&quot; → true&lt;br /&gt;
    &quot;hello&quot; → false&lt;br /&gt;
    &quot;A man a plan a canal Panama&quot; → true (after ignoring spaces and case)&lt;br /&gt;&lt;br /&gt;
    Test Logic:&lt;br /&gt;
    For each set of inputs, the testIsPalindrome method creates an instance of StringService and checks if the output of isPalindrome matches the expected result.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;csv-source&quot;&gt;CSV Source&lt;/h2&gt;
    &lt;p&gt;For simpler test cases where you don&apos;t need complex data providers, @CsvSource offers a cleaner syntax. You can define your test data directly in the annotation.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/92db9792cc48780e72938fd978bbf5bd.js?file=CSVsource.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;How &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@CsvSource&lt;/code&gt; Works:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Each line inside the annotation represents a test case.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Values are comma-separated and automatically mapped to method parameters.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;It&apos;s ideal for small, readable test data without needing to write a separate provider method.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2025-04-27T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/parametrized-tests-junit-5-spring-boot</link>
<guid isPermaLink="true">https://randomwits.com/blog/parametrized-tests-junit-5-spring-boot</guid>
</item>
<item>
  <title>Fix Xbox Controller Not Connecting to Steam Deck</title>
  <description>&lt;p&gt;If your Xbox controller isn&apos;t connecting to your Steam Deck and the light continues blinking, follow these steps to troubleshoot and resolve the issue.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;If your Xbox controller isn&apos;t connecting to your Steam Deck and the light continues blinking, follow these steps to troubleshoot and resolve the issue.&lt;/p&gt;
    &lt;h3 id=&quot;step-1-ensure-bluetooth-is-enabled-on-steam-deck&quot;&gt;Step 1: Ensure Bluetooth is Enabled on Steam Deck&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Go to &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Bluetooth&lt;/strong&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Make sure Bluetooth is &lt;strong&gt;On&lt;/strong&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Select &lt;strong&gt;Add Device&lt;/strong&gt; and put your Xbox controller in pairing mode (hold the pairing button until the light blinks rapidly).&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;step-2-check-for-controller-firmware-updates&quot;&gt;Step 2: Check for Controller Firmware Updates&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;On a Windows PC, download the &lt;a href=&quot;https://apps.microsoft.com/detail/9nblggh30xj3&quot;&gt;&lt;strong&gt;Xbox Accessories&lt;/strong&gt; app&lt;/a&gt; from the Microsoft Store.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Connect your Xbox controller via USB.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Open the app&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://miro.medium.com/v2/resize:fit:807/1*HOR9Ieou1NIpQPPU6qzjwg.png&quot; alt=&quot;Controller Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;update the controller firmware&lt;/strong&gt; if prompted.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://miro.medium.com/v2/resize:fit:4800/format:webp/1*pSe-b3TSNPNhD0R1YA1vFg.png&quot; alt=&quot;Controller Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;step-3-try-reconnecting&quot;&gt;Step 3: Try Reconnecting&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;After updating, try reconnecting the controller to your Steam Deck.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the light still blinks and doesn&apos;t stay solid, restart both devices and attempt pairing again.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;step-4-reset-the-controller-if-needed&quot;&gt;Step 4: Reset the Controller (if needed)&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Hold the &lt;strong&gt;Xbox button&lt;/strong&gt; for 10 seconds to turn off the controller.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Turn it back on and repeat the pairing process.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
  </description>
  <pubDate>2025-04-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/xbox-controller-not-connected-steam-deck</link>
<guid isPermaLink="true">https://randomwits.com/blog/xbox-controller-not-connected-steam-deck</guid>
</item>
<item>
  <title>Mastering JSON in Java using Jackson</title>
  <description>&lt;p&gt;JSON(Javascript Object Notation) is the universal language for data exchange in modern applications, particularly when working with REST APIs. In Java, &lt;b&gt;Jackson&lt;/b&gt; library is often used for JSON processing. &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;JSON(Javascript Object Notation) is the universal language for data exchange in modern applications, particularly when working with REST APIs. In Java, &lt;b&gt;Jackson&lt;/b&gt; library is often used for JSON processing.&lt;/p&gt;
    &lt;h2 id=&quot;jackson-core-components&quot;&gt;Jackson Core Components&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;ObjectMapper&lt;/strong&gt;: Bridge between JSON and Java objects&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;JsonNode&lt;/strong&gt;: Tree model for dynamic JSON navigation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;ObjectNode/ArrayNode&lt;/strong&gt;: Mutable JSON node builder&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;json-parsing-fundamentals&quot;&gt;Json Parsing fundamentals&lt;/h2&gt;
    &lt;h3 id=&quot;parse-json-string&quot;&gt;Parse JSON String&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json1.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;building-json-dynamically&quot;&gt;Building JSON dynamically&lt;/h3&gt;
    &lt;p&gt;Create new JSON object&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;java-objects---json-conversion&quot;&gt;Java Objects &amp;lt;-&amp;gt; JSON Conversion&lt;/h3&gt;
    &lt;p&gt;&lt;strong&gt;Deserialization (JSON -&amp;gt; Object)&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json3.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Serialization (Object -&amp;gt; JSON)&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json4.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;common-issues&quot;&gt;Common Issues&lt;/h2&gt;
    &lt;h3 id=&quot;date-handling&quot;&gt;Date Handling&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json5.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Don&apos;t forget&lt;/strong&gt; to register JavaTimeModule&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json6.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;extra-getters&quot;&gt;Extra Getters&lt;/h3&gt;
    &lt;p&gt;If the getter have no corresponding field, then deserialization would fail&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json7.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Use Ignore Unknown Properties&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json8.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Or use Read-Only Properties&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b69b13dc8616b6b132e767b0f561ec3d.js?file=Json9.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2025-04-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/mastering-json-in-java</link>
<guid isPermaLink="true">https://randomwits.com/blog/mastering-json-in-java</guid>
</item>
<item>
  <title>Next Greater Element I</title>
  <description>&lt;p&gt;The next greater element of some element x in an array is the first greater element that is to the right of x in the same array.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;The next greater element of some element x in an array is the first greater element that is to the right of x in the same array.&lt;/p&gt;
    &lt;p&gt;You are given two distinct 0-indexed integer arrays nums1 and nums2, where nums1 is a subset of nums2.&lt;/p&gt;
    &lt;p&gt;For each 0 &amp;lt;= i &amp;lt; nums1.length, find the index j such that nums1[i] == nums2[j] and determine the next greater element of nums2[j] in nums2. If there is no next greater element, then the answer for this query is -1.&lt;/p&gt;
    &lt;p&gt;Return an array ans of length nums1.length such that ans[i] is the next greater element as described above.&lt;/p&gt;
    &lt;h2 id=&quot;brute-force&quot;&gt;Brute Force&lt;/h2&gt;
    &lt;p&gt;For each element in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums1&lt;/code&gt;, find its position in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums2&lt;/code&gt;, then search to the right for the first larger element.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d78c90b71089dd9f756605498853bb72.js?file=next_greatest_brute.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt; O(N&lt;sup&gt;2&lt;/sup&gt;)&lt;/p&gt;
    &lt;h2 id=&quot;monotonic-stack&quot;&gt;Monotonic Stack&lt;/h2&gt;
    &lt;p&gt;A monotonic stack maintains elements in decreasing order. For each element in nums2, we track the next greater element using the stack, storing results in a hash map for O(1) lookups.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Initialize an empty stack and a hash map.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;Iterate through nums2:
    &lt;ul&gt;
    &lt;li&gt;While the stack is not empty and the current element is greater than the stack&apos;s top:&lt;/li&gt;
    &lt;li&gt;Pop from the stack and record the current element as the next greater for the popped value.&lt;/li&gt;
    &lt;li&gt;Push the current element to the stack.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Query the hash map for each element in nums1 to build the result.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab python&quot;&gt;&lt;a href=&quot;#python&quot;&gt;python&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample python&quot; id=&quot;python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d78c90b71089dd9f756605498853bb72.js?file=next_greatest_stack.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d78c90b71089dd9f756605498853bb72.js?file=NextGreatest.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt; O(nums1.length + nums2.length)&lt;/p&gt;
  </description>
  <pubDate>2025-04-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/next-greater-element-i</link>
<guid isPermaLink="true">https://randomwits.com/blog/next-greater-element-i</guid>
</item>
<item>
  <title>Building Reactive File Upload with Spring Boot WebFlux and Swagger</title>
  <description>&lt;p&gt;How do you upload multiple PDF file in reactive REST API?.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;How do you upload multiple PDF file in reactive REST API?&lt;/p&gt;
    &lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;Spring Boot WebFlux (Reactive Web)&lt;/li&gt;
    &lt;li&gt;SpringDoc OpenAPI 3 documentation&lt;/li&gt;
    &lt;li&gt;Project Reactor&lt;/li&gt;
    &lt;li&gt;Java 21&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;project-setup-buildgradle&quot;&gt;Project Setup (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;build.gradle&lt;/code&gt;)&lt;/h2&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/2d7962ae629f4b5c8cc1ed4c45bb9846.js?file=build.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;key-dependencies&quot;&gt;Key Dependencies&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;webflux:&lt;/strong&gt; Enables reactive web programming&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;springdoc-openapi:&lt;/strong&gt; Generates OpenAPI 3 documentation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;reactor-test:&lt;/strong&gt; Provides testing utilities for reactive streams&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;main-application-class&quot;&gt;Main Application Class&lt;/h2&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/2d7962ae629f4b5c8cc1ed4c45bb9846.js?file=DemoUploadApplication.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;key-annotations&quot;&gt;Key Annotations:&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;@OpenAPIDefinition:&lt;/strong&gt; Enables Swagger/OpenAPI documentation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Customizes API metadata through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Info&lt;/code&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;reactive-file-upload-controller&quot;&gt;Reactive File Upload Controller&lt;/h2&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/2d7962ae629f4b5c8cc1ed4c45bb9846.js?file=FileUploaderController.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;why-filepart-instead-of-multipartfile&quot;&gt;Why FilePart instead of MultipartFile?&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Reactive Paradigm:&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Flux handles streams of data asynchronously&lt;/li&gt;
    &lt;li&gt;Processes files as they arrive without buffering entire request&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Memory Efficiency:&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Handles large files without memory overload&lt;/li&gt;
    &lt;li&gt;Backpressure-aware (controls data flow rate)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Non-Blocking I/O:&lt;/strong&gt;
    &lt;ul&gt;
    &lt;li&gt;Works with WebFlux&apos;s event-loop model&lt;/li&gt;
    &lt;li&gt;Maintains high concurrency with minimal threads&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;testing-with-swagger-ui&quot;&gt;Testing with Swagger UI&lt;/h2&gt;
    &lt;p&gt;Access the API documentation at:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/2d7962ae629f4b5c8cc1ed4c45bb9846.js?file=Swagger.md&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;understanding-documentation-components&quot;&gt;Understanding Documentation Components&lt;/h2&gt;
    &lt;h3 id=&quot;openapi-specification-openapijson&quot;&gt;OpenAPI Specification (openapi.json)&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Machine-readable API contract&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Generated at runtime via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/v3/api-docs&lt;/code&gt; endpoint&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Contains endpoints, schemas, and examples&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;swagger-ui-indexhtml&quot;&gt;Swagger UI (index.html)&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Human-friendly documentation interface&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Auto-generated from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;openapi.json&lt;/code&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Accessible via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/swagger-ui.html&lt;/code&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;img class=&quot;mermaid&quot; src=&quot;https://mermaid.ink/svg/eyJjb2RlIjoic2VxdWVuY2VEaWFncmFtXG5Vc2VyLT4-U3dhZ2dlciBVSTogQWNjZXNzIC9zd2FnZ2VyLXVpLmh0bWxcblN3YWdnZXIgVUktPj5TcHJpbmdEb2M6IEdFVCAvdjMvYXBpLWRvY3NcblNwcmluZ0RvYy0-PlN3YWdnZXIgVUk6IG9wZW5hcGkuanNvblxuU3dhZ2dlciBVSS0-PlVzZXI6IFJlbmRlcmVkIERvY3VtZW50YXRpb24iLCJtZXJtYWlkIjpudWxsfQ&quot; /&gt;&lt;/p&gt;
  </description>
  <pubDate>2025-04-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/building-reactive-file-upload-spring-boot-webflux-swagger</link>
<guid isPermaLink="true">https://randomwits.com/blog/building-reactive-file-upload-spring-boot-webflux-swagger</guid>
</item>
<item>
  <title>How to add Non-Steam Games to Steam Deck</title>
  <description>&lt;p&gt;I have a desktop for gaming, but ever since I got the Steam Deck, my gaming time has quadrupled. It&apos;s remarkable how well it handles even demanding games—it&apos;s like a Kindle for gaming. While the default SteamOS mainly supports games from the Steam store, you can actually play almost any game on the device.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I have a desktop for gaming, but ever since I got the Steam Deck, my gaming time has quadrupled. It&apos;s remarkable how well it handles even demanding games—it&apos;s like a Kindle for gaming. While the default SteamOS mainly supports games from the Steam store, you can actually play almost any game on the device.&lt;/p&gt;
    &lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h2&gt;
    &lt;p&gt;Before diving into the steps, ensure you have the following:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Steam Deck&lt;/strong&gt;: Fully updated to the latest firmware.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;PC&lt;/strong&gt;: A computer to transfer game files (optional, but recommended).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Wi-Fi Network&lt;/strong&gt;: Both your Steam Deck and PC should be connected to the same network.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Terminal Access&lt;/strong&gt;: Familiarity with basic terminal commands is helpful.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Game Files&lt;/strong&gt;: The non-Steam game files you want to install.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;enable-desktop-mode&quot;&gt;Enable Desktop Mode&lt;/h2&gt;
    &lt;p&gt;The Steam Deck runs on a custom Linux-based operating system called SteamOS. To add non-Steam games, you’ll need to switch to &lt;strong&gt;Desktop Mode&lt;/strong&gt;.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Power On&lt;/strong&gt; your Steam Deck.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Hold the Power Button&lt;/strong&gt; until the power menu appears.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Select &lt;strong&gt;Switch to Desktop&lt;/strong&gt; to enter Desktop Mode.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Once in Desktop Mode, you’ll have access to a full Linux desktop environment, allowing you to install and configure software.&lt;/p&gt;
    &lt;p&gt;In Desktop Mode, open the &lt;strong&gt;Konsole&lt;/strong&gt; terminal (found in the Applications menu).&lt;/p&gt;
    &lt;h2 id=&quot;konsole-terminal&quot;&gt;Konsole Terminal&lt;/h2&gt;
    &lt;h3 id=&quot;check-the-username&quot;&gt;Check the Username&lt;/h3&gt;
    &lt;p&gt;The default username on the Steam Deck is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deck&lt;/code&gt;. Confirm this by running:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/77d64d5d24dc22c9b22ef53c1b3cc6c7.js?file=KonsoleTerminal1.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;find-the-ip-address&quot;&gt;Find the IP Address&lt;/h3&gt;
    &lt;p&gt;Next, find your Steam Deck&apos;s IP address:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/77d64d5d24dc22c9b22ef53c1b3cc6c7.js?file=KonsoleTerminal2.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Example output:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/77d64d5d24dc22c9b22ef53c1b3cc6c7.js?file=KonsoleTerminal3.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Take note of the IP address (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;192.150.1.111&lt;/code&gt;).&lt;/p&gt;
    &lt;h2 id=&quot;enable-ssh-on-steam-deck&quot;&gt;Enable SSH on Steam Deck&lt;/h2&gt;
    &lt;p&gt;To transfer files from your PC to the Steam Deck, enable SSH:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/77d64d5d24dc22c9b22ef53c1b3cc6c7.js?file=KonsoleTerminal4.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;transfer-game-files-to-steam-deck&quot;&gt;Transfer Game Files to Steam Deck&lt;/h2&gt;
    &lt;p&gt;On your PC, open a terminal and run:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/77d64d5d24dc22c9b22ef53c1b3cc6c7.js?file=KonsoleTerminal5.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;install-and-configure-lutris&quot;&gt;Install and Configure Lutris&lt;/h2&gt;
    &lt;p&gt;Lutris is a popular open-source gaming platform for Linux that simplifies the process of running non-Steam games. It supports a variety of runners, including Wine, Proton, and native Linux games.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Open Discover: In Desktop Mode, open the Discover Software Center (similar to an app store).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Search for Lutris: Install Lutris from the Discover store.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Install Wine and Dependencies: Lutris requires Wine to run Windows games. Install Wine and any necessary dependencies from Discover.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Add Your Game:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Open Lutris and click the + button to add a new game.&lt;/li&gt;
    &lt;li&gt;Set the runner to Wine.&lt;/li&gt;
    &lt;li&gt;Browse to the game’s .exe file in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/home/deck/Games&lt;/code&gt;.&lt;/li&gt;
    &lt;li&gt;Configure any additional settings (e.g., Wine version, DXVK, etc.).&lt;/li&gt;
    &lt;li&gt;Install and launch the game.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;add-the-game-to-steam&quot;&gt;Add the Game to Steam&lt;/h2&gt;
    &lt;p&gt;To make the game accessible from SteamOS (Gaming Mode), you’ll need to add it to your Steam library.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Open Steam in Desktop Mode.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Click Add a Game &amp;gt; Add a Non-Steam Game.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Browse to the game’s executable file. By default, Wine creates a virtual C: drive at: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/home/deck/.wine/drive_c/&lt;/code&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Add the game and ensure it appears in your Steam library.&lt;/p&gt;
    &lt;h2 id=&quot;configure-proton-compatibility&quot;&gt;Configure Proton Compatibility&lt;/h2&gt;
    &lt;p&gt;For Windows games, you may need to enable Proton compatibility in SteamOS.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;In Gaming Mode, navigate to your library and select the non-Steam game.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Go to Properties &amp;gt; Compatibility.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Check Force the use of a specific Steam Play compatibility tool and select the latest version of Proton Experimental.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Launch the game and enjoy!&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;common-issues-and-fixes&quot;&gt;Common Issues and Fixes&lt;/h2&gt;
    &lt;h3 id=&quot;terminal-error-unable-to-lock-database&quot;&gt;Terminal Error: &lt;strong&gt;Unable to Lock Database&lt;/strong&gt;&lt;/h3&gt;
    &lt;p&gt;This error occurs when the package manager is locked by another process. Fix it by running:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/77d64d5d24dc22c9b22ef53c1b3cc6c7.js?file=KonsoleTerminal6.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;missing-dependencies-eg-isskindll&quot;&gt;Missing Dependencies (e.g., isskin.dll)&lt;/h3&gt;
    &lt;p&gt;Some games require additional libraries. Install them using winetricks:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/77d64d5d24dc22c9b22ef53c1b3cc6c7.js?file=KonsoleTerminal7.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;invalid-or-corrupted-pgp-signature&quot;&gt;Invalid or Corrupted PGP Signature&lt;/h3&gt;
    &lt;p&gt;This error can occur when updating packages. Fix it by reinitializing the keyring:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/77d64d5d24dc22c9b22ef53c1b3cc6c7.js?file=KonsoleTerminal8.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2025-04-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/add-non-steam-games-to-steam-deck</link>
<guid isPermaLink="true">https://randomwits.com/blog/add-non-steam-games-to-steam-deck</guid>
</item>
<item>
  <title>Leetcode Daily Temperatures</title>
  <description>&lt;p&gt;Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead.&lt;/p&gt;
    &lt;h2 id=&quot;brute-force-solution&quot;&gt;Brute force solution&lt;/h2&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab python&quot;&gt;&lt;a href=&quot;#python&quot;&gt;python&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/68b174bcb00ebb2f0e3cc6b15bdfea3e.js?file=BruteForce.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample python&quot; id=&quot;python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/68b174bcb00ebb2f0e3cc6b15bdfea3e.js?file=brute_force.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;p&gt;Time Limit Exceeded since complexity is &lt;strong&gt;O(N²)&lt;/strong&gt;&lt;/p&gt;
    &lt;h2 id=&quot;quick-refresher-on-monotonic-stack&quot;&gt;Quick refresher on Monotonic stack&lt;/h2&gt;
    &lt;p&gt;A regular stack follows LIFO (Last In, First Out). You push and pop from the top. &lt;/p&gt;
    &lt;p&gt;A monotonic stack , we maintain either increasing or decreasing order. Use decreasing monotonic stack to find next greater element. Use increasing monotonic stack to find next smallest element.&lt;/p&gt;
    &lt;h2 id=&quot;optimized-solution&quot;&gt;Optimized Solution&lt;/h2&gt;
    &lt;p&gt;We will use monotonic decreasing stack to find next largest element&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab python&quot;&gt;&lt;a href=&quot;#python&quot;&gt;python&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/68b174bcb00ebb2f0e3cc6b15bdfea3e.js?file=MonotonicStack.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample python&quot; id=&quot;python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/68b174bcb00ebb2f0e3cc6b15bdfea3e.js?file=monotoinc_stack.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;p&gt;Time complexity &lt;strong&gt;O(n)&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Why time complexity is O(N²)?&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/68b174bcb00ebb2f0e3cc6b15bdfea3e.js?file=psuedopseudoCode.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The outer for loop runs n times (where n is the length of temperatures).&lt;/p&gt;
    &lt;p&gt;Each index is pushed onto the stack at most once. This contributes at most n push operations in total.&lt;/p&gt;
    &lt;p&gt;Each index is popped from the stack at most once. This contributes at most n pop operations in total.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Iteration&lt;/th&gt;
    &lt;th&gt;Index&lt;/th&gt;
    &lt;th&gt;Temperature&lt;/th&gt;
    &lt;th&gt;Operations&lt;/th&gt;
    &lt;th&gt;Stack State After&lt;/th&gt;
    &lt;th&gt;Result Update&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;73&lt;/td&gt;
    &lt;td&gt;Stack is empty → push index 0&lt;/td&gt;
    &lt;td&gt;[0]&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[0, 0, 0, 0, 0, 0, 0, 0]&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;74&lt;/td&gt;
    &lt;td&gt;Compare 74 with temperature at index 0 (73): 74 &amp;gt; 73 → pop index 0, set result[0] = 1; then push index 1&lt;/td&gt;
    &lt;td&gt;[1]&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[1, 0, 0, 0, 0, 0, 0, 0]&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;75&lt;/td&gt;
    &lt;td&gt;Compare 75 with temperature at index 1 (74): 75 &amp;gt; 74 → pop index 1, set result[1] = 1; then push index 2&lt;/td&gt;
    &lt;td&gt;[2]&lt;/td&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[1, 1, 0, 0, 0, 0, 0, 0]&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;71&lt;/td&gt;
    &lt;td&gt;Compare 71 with temperature at index 2 (75): 71 is not &amp;gt; 75 → push index 3&lt;/td&gt;
    &lt;td&gt;[2, 3]&lt;/td&gt;
    &lt;td&gt;No change&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;4&lt;/td&gt;
    &lt;td&gt;4&lt;/td&gt;
    &lt;td&gt;69&lt;/td&gt;
    &lt;td&gt;Compare 69 with temperature at index 3 (71): 69 is not &amp;gt; 71 → push index 4&lt;/td&gt;
    &lt;td&gt;[2, 3, 4]&lt;/td&gt;
    &lt;td&gt;No change&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;5&lt;/td&gt;
    &lt;td&gt;5&lt;/td&gt;
    &lt;td&gt;72&lt;/td&gt;
    &lt;td&gt;- Compare 72 with temperature at index 4 (69): 72 &amp;gt; 69 → pop index 4, set result[4] = 5 - 4 = 1&lt;br /&gt;- New top is index 3 (71): 72 &amp;gt; 71 → pop index 3, set result[3] = 5 - 3 = 2&lt;br /&gt;- 72 is not &amp;gt; temperature at index 2 (75), so push index 5&lt;/td&gt;
    &lt;td&gt;[2, 5]&lt;/td&gt;
    &lt;td&gt;result[4]=1, result[3]=2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;6&lt;/td&gt;
    &lt;td&gt;6&lt;/td&gt;
    &lt;td&gt;76&lt;/td&gt;
    &lt;td&gt;- Compare 76 with temperature at index 5 (72): 76 &amp;gt; 72 → pop index 5, set result[5] = 6 - 5 = 1&lt;br /&gt;- New top is index 2 (75): 76 &amp;gt; 75 → pop index 2, set result[2] = 6 - 2 = 4&lt;br /&gt;- Stack empty → push index 6&lt;/td&gt;
    &lt;td&gt;[6]&lt;/td&gt;
    &lt;td&gt;result[5]=1, result[2]=4&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;7&lt;/td&gt;
    &lt;td&gt;7&lt;/td&gt;
    &lt;td&gt;73&lt;/td&gt;
    &lt;td&gt;Compare 73 with temperature at index 6 (76): 73 is not &amp;gt; 76 → push index 7&lt;/td&gt;
    &lt;td&gt;[6, 7]&lt;/td&gt;
    &lt;td&gt;No change&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2025-04-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/leetcode-daily-temperatures</link>
<guid isPermaLink="true">https://randomwits.com/blog/leetcode-daily-temperatures</guid>
</item>
<item>
  <title>Daily Logs</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Mar 31, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Mar 31, 2025.&lt;/p&gt;
    &lt;iframe id=&quot;dynamicIframe&quot; style=&quot;position: relative; width: 100%; height: 400px;&quot; src=&quot;/encrypted/2025-03-31-daily-logs-2025-03-31.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;script src=&quot;/js/resizeIframe.js&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2025-03-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-03-31</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-03-31</guid>
</item>
<item>
  <title>Enable Observability at MongoDB</title>
  <description>&lt;p&gt;Implementing Observability in Reactive MongoDB with Spring Boot and Testcontainers. &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Implementing Observability in Reactive MongoDB with Spring Boot and Testcontainers&lt;/p&gt;
    &lt;h2 id=&quot;introduction-to-observability&quot;&gt;Introduction to Observability&lt;/h2&gt;
    &lt;p&gt;Observability is the cornerstone of modern distributed systems, enabling developers to:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Trace&lt;/strong&gt; request flows through microservices&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Measure&lt;/strong&gt; system performance via metrics&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Diagnose&lt;/strong&gt; issues using structured logs&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;In reactive MongoDB applications, observability becomes crucial due to:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Non-blocking nature complicating request tracing&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Connection pooling challenges&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Complex query performance analysis&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;the-three-observability-pillars&quot;&gt;The Three Observability Pillars&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Metrics&lt;/strong&gt;: Quantitative measurements (e.g., query duration)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Traces&lt;/strong&gt;: Distributed request context propagation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Logs&lt;/strong&gt;: Contextual event records&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;autoconfigure-class&quot;&gt;AutoConfigure class&lt;/h2&gt;
    &lt;p&gt;Let’s create an &lt;strong&gt;autoconfigure&lt;/strong&gt; class that will be loaded automatically when the dependency is added in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;build.gradle&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/012eda6dae0f2bbcaa188b7e0f5f94d2.js?file=build.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Make sure to register this class in &lt;strong&gt;META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports&lt;/strong&gt; for Spring Boot to pick it up automatically.
    &lt;br /&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/012eda6dae0f2bbcaa188b7e0f5f94d2.js?file=CustomMongoReactiveAutoConfiguration.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Key Components&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;AutoConfigureAfter:&lt;/strong&gt; Ensures proper configuration ordering&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;MongoClientSettingsBuilderCustomizer:&lt;/strong&gt; Injects observability instrumentation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;ContextProvider:&lt;/strong&gt; Propagates tracing context through reactive pipelines&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;integration-testing&quot;&gt;Integration Testing&lt;/h2&gt;
    &lt;p&gt;We can use &lt;strong&gt;Testcontainers&lt;/strong&gt; for testing traces.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/012eda6dae0f2bbcaa188b7e0f5f94d2.js?file=CustomMongoReactiveAutoConfigurationIntegrationTest.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2025-03-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/enable-observability-mongodb</link>
<guid isPermaLink="true">https://randomwits.com/blog/enable-observability-mongodb</guid>
</item>
<item>
  <title>MongoDB Crib Sheet</title>
  <description>&lt;p&gt;MongoDB Crib Sheet.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;MongoDB Crib Sheet. Mongo uses BSON to store data&lt;/p&gt;
    &lt;h2 id=&quot;document-structure-bson&quot;&gt;Document Structure (BSON)&lt;/h2&gt;
    &lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;_id:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;ObjectId(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;507f191e810c19729de860ea&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;name:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Alice Chen&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;salary:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;NumberLong(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;230000&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;designation:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Principal Engineer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;teams:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;platform-engineering&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;database-ops&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;meta:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;badge:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;SDE-III&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;clearance:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Level-5&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Binary JSON format with type-rich encoding&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Flexible schema (no fixed column structure)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Nested documents (up to 100 levels deep)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Automatic &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_id&lt;/code&gt; generation (12-byte unique identifier)&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2025-03-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/cribsheet-for-mongodb</link>
<guid isPermaLink="true">https://randomwits.com/blog/cribsheet-for-mongodb</guid>
</item>
<item>
  <title>Fixing Missing Microsoft Visual C++ Runtime on Steam Deck</title>
  <description>&lt;p&gt;When launching non-Steam games via Proton or Wine on the Steam Deck, you may encounter the following error.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When launching non-Steam games via Proton or Wine on the Steam Deck, you may encounter the following error:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0537f40629aefbe99947a710e37c2d91.js?file=ex2.txt&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This is a common issue when certain runtime libraries (like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcrun6sp6&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcrun2022&lt;/code&gt;) are missing. This guide provides two solutions: one for &lt;strong&gt;Proton games using Protontricks&lt;/strong&gt;, and one for &lt;strong&gt;Lutris-based installations&lt;/strong&gt; (especially via Flatpak).&lt;/p&gt;
    &lt;hr /&gt;
    &lt;h2 id=&quot;-solution-1-using-protontricks-for-steamproton-games&quot;&gt;🧭 Solution 1: Using Protontricks (for Steam/Proton games)&lt;/h2&gt;
    &lt;h3 id=&quot;1-enter-desktop-mode&quot;&gt;1. Enter Desktop Mode&lt;/h3&gt;
    &lt;p&gt;Hold the &lt;strong&gt;POWER&lt;/strong&gt; button → Select &lt;strong&gt;Switch to Desktop Mode&lt;/strong&gt;&lt;/p&gt;
    &lt;h3 id=&quot;2-install-protontricks&quot;&gt;2. Install Protontricks&lt;/h3&gt;
    &lt;p&gt;Open the &lt;strong&gt;Discover&lt;/strong&gt; store (blue shopping bag icon), then search for: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Protontricks&lt;/code&gt; and install it.&lt;/p&gt;
    &lt;h3 id=&quot;3-launch-protontricks-gui&quot;&gt;3. Launch Protontricks GUI&lt;/h3&gt;
    &lt;p&gt;Open &lt;strong&gt;Konsole&lt;/strong&gt; (terminal), and run:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0537f40629aefbe99947a710e37c2d91.js?file=ex1.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;From the list, select your game:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Example: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Non-Steam shortcut: Sifu.exe&lt;/code&gt;&lt;br /&gt;
    (If your game isn&apos;t listed, run it once in Gaming Mode first.)&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h3 id=&quot;4-install-visual-c-components&quot;&gt;4. Install Visual C++ Components&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;Choose: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Select the default wineprefix&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Then: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Install a Windows DLL or component&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Check: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcrun2022&lt;/code&gt; or another relevant package (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcrun6sp6&lt;/code&gt;)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Accept all prompts and wait for confirmation.&lt;/p&gt;
    &lt;p&gt;If you are getting error: &lt;strong&gt;Could not lock database: Read-only file system&lt;/strong&gt;, run this command&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;steamos-readonly disable
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;remember to enable it after installing&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;steamos-readonly &lt;span class=&quot;nb&quot;&gt;enable&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;-solution-2-lutris-flatpak--wine-dll-missing-in-non-steam-game&quot;&gt;🧩 Solution 2: Lutris (Flatpak) – Wine DLL Missing in Non-Steam Game&lt;/h2&gt;
    &lt;p&gt;If you&apos;re using &lt;strong&gt;Lutris installed via Flatpak&lt;/strong&gt; and running into missing DLLs like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;isskin.dll&lt;/code&gt;, follow these steps:&lt;/p&gt;
    &lt;h3 id=&quot;1-create-a-custom-wine-prefix&quot;&gt;1. Create a Custom Wine Prefix&lt;/h3&gt;
    &lt;p&gt;In terminal:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0537f40629aefbe99947a710e37c2d91.js?file=ex3.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This sets up a new Wine environment specifically for your game.&lt;/p&gt;
    &lt;h3 id=&quot;2-install-the-missing-runtime-vcrun6sp6&quot;&gt;2. Install the Missing Runtime (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcrun6sp6&lt;/code&gt;)&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0537f40629aefbe99947a710e37c2d91.js?file=ex4.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This installs the required Microsoft Visual C++ 6.0 components, including &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;isskin.dll&lt;/code&gt;.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;✅ Make sure you have &lt;strong&gt;native &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;winetricks&lt;/code&gt; installed&lt;/strong&gt;, not the Flatpak version.&lt;br /&gt;
    Install it with:&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0537f40629aefbe99947a710e37c2d91.js?file=ex5.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;3-configure-lutris-to-use-this-prefix&quot;&gt;3. Configure Lutris to Use This Prefix&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;Open &lt;strong&gt;Lutris&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;Right-click your game → &lt;strong&gt;Configure&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;Go to the &lt;strong&gt;Game Options&lt;/strong&gt; tab&lt;/li&gt;
    &lt;li&gt;Set &lt;strong&gt;Wine prefix&lt;/strong&gt; to: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/home/deck/Games/MyGamePrefix&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;4-relaunch-the-game&quot;&gt;4. Relaunch the Game&lt;/h3&gt;
    &lt;p&gt;Now that the correct DLL is available in the prefix, the game should launch without runtime errors.&lt;/p&gt;
    &lt;h2 id=&quot;-solution-3-use-nix&quot;&gt;🧩 Solution 3: Use Nix&lt;/h2&gt;
    &lt;p&gt;Nix is both a package manager and a build system.&lt;/p&gt;
    &lt;p&gt;Unlike pacman/apt, it installs everything into its own store (/nix/store) with exact versions and hashes.&lt;/p&gt;
    &lt;p&gt;It does not overwrite system files → so it works perfectly with SteamOS (where the root partition is tiny &amp;amp; immutable).&lt;/p&gt;
    &lt;p&gt;SteamOS 3.5+ even ships a /nix directory on the big /home partition, specifically to support it.&lt;/p&gt;
    &lt;p&gt;Install it :&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sh &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; https://nixos.org/nix/install&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--daemon&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# This makes sure your shell picks up the Nix environment.&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;reboot 
    nix-env &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# Start the Nix daemon manually&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl start nix-daemon.service
    &lt;span class=&quot;c&quot;&gt;# enable it in next boot&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl &lt;span class=&quot;nb&quot;&gt;enable &lt;/span&gt;nix-daemon.service
    &lt;span class=&quot;c&quot;&gt;#  install winetricks &lt;/span&gt;
    nix-env &lt;span class=&quot;nt&quot;&gt;-iA&lt;/span&gt; nixpkgs.winetricks
    nix-env &lt;span class=&quot;nt&quot;&gt;-iA&lt;/span&gt; nixpkgs.wine
    &lt;span class=&quot;nv&quot;&gt;WINEPREFIX&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.local/share/NonSteamGames/prefix winetricks vcrun6sp6
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;-advanced-tip-register-a-dll-manually&quot;&gt;🧪 Advanced Tip: Register a DLL Manually&lt;/h2&gt;
    &lt;p&gt;If a DLL like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;isskin.dll&lt;/code&gt; is still not detected, you can download it manually (from a trusted source), place it in: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/Games/MyGamePrefix/drive_c/windows/system32/&lt;/code&gt;&lt;/p&gt;
    &lt;p&gt;Then register it using:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0537f40629aefbe99947a710e37c2d91.js?file=ex6.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;hr /&gt;
    &lt;h2 id=&quot;-summary&quot;&gt;✅ Summary&lt;/h2&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Platform&lt;/th&gt;
    &lt;th&gt;Tool&lt;/th&gt;
    &lt;th&gt;Fix&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;Steam/Proton&lt;/td&gt;
    &lt;td&gt;Protontricks&lt;/td&gt;
    &lt;td&gt;Install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcrun2022&lt;/code&gt; via GUI&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Lutris (Flatpak)&lt;/td&gt;
    &lt;td&gt;Wine + Winetricks&lt;/td&gt;
    &lt;td&gt;Create prefix, install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcrun6sp6&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;By using the correct tools and setting up Wine prefixes properly, you can get even the trickiest non-Steam games running on your Steam Deck.&lt;/p&gt;
  </description>
  <pubDate>2025-03-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/fixing-missing-microsoft-visual-cplusplus-runtime-on-steam-deck</link>
<guid isPermaLink="true">https://randomwits.com/blog/fixing-missing-microsoft-visual-cplusplus-runtime-on-steam-deck</guid>
</item>
<item>
  <title>Amazon DocumentDB Read Preferences Guide</title>
  <description>&lt;p&gt;Amazon DocumentDB is a fully managed, MongoDB-compatible database service provided by AWS. It replicates data six times across three Availability Zones (two copies per zone) for high durability and availability.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Amazon DocumentDB is a fully managed, MongoDB-compatible database service provided by AWS. It replicates data six times across three Availability Zones (two copies per zone) for high durability and availability.&lt;/p&gt;
    &lt;h3 id=&quot;connection-string-example-with-read-preferences&quot;&gt;Connection String Example with Read Preferences&lt;/h3&gt;
    &lt;p&gt;Specify read preferences directly in the connection string:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mongodb://host:port/database?readPreference&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;secondaryPreferred
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;consistency-tradeoffs&quot;&gt;Consistency Tradeoffs&lt;/h3&gt;
    &lt;p&gt;NoSQL databases like DocumentDB often use eventual consistency by default. This means reads immediately after writes might return stale data, as updates propagate asynchronously to replicas. This design prioritizes availability and scalability over strict consistency. You can override this behavior using read preferences, though this may impact scalability.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Read Preference Mode&lt;/th&gt;
    &lt;th&gt;Consistency&lt;/th&gt;
    &lt;th&gt;Behavior&lt;/th&gt;
    &lt;th&gt;Use Case&lt;/th&gt;
    &lt;th&gt;Consideration&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**primaryPreferred**&lt;/td&gt;
    &lt;td&gt;Read-after-write consistency&lt;/td&gt;
    &lt;td&gt;- Routes reads to primary by default&lt;br /&gt;- Fails over to replicas if unavailable&lt;/td&gt;
    &lt;td&gt;Critical reads requiring fresh data&lt;/td&gt;
    &lt;td&gt;Creates primary bottleneck (not ideal for read-heavy workloads)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**secondaryPreferred**&lt;/td&gt;
    &lt;td&gt;Eventual consistency&lt;/td&gt;
    &lt;td&gt;- Prioritizes replica reads&lt;br /&gt;- Uses primary only if replicas unavailable&lt;/td&gt;
    &lt;td&gt;Read scaling &amp;amp; high availability&lt;/td&gt;
    &lt;td&gt;Distributes read traffic across replicas&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**nearest**&lt;/td&gt;
    &lt;td&gt;Variable (depends on replication lag)&lt;/td&gt;
    &lt;td&gt;- Selects lowest-latency nodes&lt;br /&gt;- Uses both primary and secondary nodes&lt;/td&gt;
    &lt;td&gt;Latency-sensitive applications&lt;/td&gt;
    &lt;td&gt;Fast responses but potentially stale data&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2025-03-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/amazon-documentdb-read-preferencesd-guide</link>
<guid isPermaLink="true">https://randomwits.com/blog/amazon-documentdb-read-preferencesd-guide</guid>
</item>
<item>
  <title>Weekly Logs from Mar 17 to Mar 23, 2025</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs Mar 17 to Mar 23, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs Mar 17 to Mar 23, 2025.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A421:T434?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;langauge-devil-may-cry-5&quot;&gt;Langauge Devil May Cry 5&lt;/h2&gt;
    &lt;p&gt;Change language in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Devil May Cry 5&lt;/code&gt;. Go to the installation folder. Find the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;steam_emu.ini&lt;/code&gt; and update the langauge&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;###                                                                                                                                                                                                                                                                                                                                                                                       ### Language that will be used in the game                                                                                                                                                                                                                                                                                                                                                ###                                                                                                                                                                                                                                                                                                                                                                                       Language=english   
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;lost-my-way-out&quot;&gt;Lost my way out&lt;/h2&gt;
    &lt;p&gt;I went to a volleyball meetup on Friday. As usual, I relied heavily on my smartphone for navigation—even though it had just 1% battery left. I plugged it into my car charger and started driving, but using Apple Maps drained the battery completely.&lt;/p&gt;
    &lt;p&gt;When my phone died, I kept driving, hoping it would power back on soon. After 30 minutes with no luck, I pulled over, waited 15 minutes, and decided to turn back. Just as I took a U-turn, the phone suddenly revived! Relieved, I followed the directions to the meetup.&lt;/p&gt;
    &lt;p&gt;I returned home around 9 PM after playing. But when I tried to check my phone, it froze completely. The screen was unresponsive—I couldn&apos;t press any buttons or even shut it down.&lt;/p&gt;
    &lt;p&gt;With my phone still dead, I began driving home, relying solely on road signs. Thankfully, I had cash and gas to manage any detours. As I neared UNC, my phone miraculously connected to the car&apos;s Bluetooth when Richu called. She knew the university area well and guided me back safely.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Lesson learned:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Force-restart an iPhone without the screen: Hold the volume up, then volume down, and keep pressing the power button&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;buy a offline GPS maps? Any suggestions&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2025-03-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2025-03-17</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2025-03-17</guid>
</item>
<item>
  <title>Download Detroit Become Human</title>
  <description>&lt;p&gt;Detroit: Become Human, the award-winning video game production from Quantic Dream, is finally available on Steam! Featuring world-renowned actors including Jesse Williams (Grey’s Anatomy), Clancy Brown (Carnivale), Lance Henriksen (Aliens), Bryan Dechart (True Blood) and Valorie Curry (Twilight).&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Detroit: Become Human, the award-winning video game production from Quantic Dream, is finally available on Steam! Featuring world-renowned actors including Jesse Williams (Grey’s Anatomy), Clancy Brown (Carnivale), Lance Henriksen (Aliens), Bryan Dechart (True Blood) and Valorie Curry (Twilight).&lt;/p&gt;
    &lt;style&gt;
    .download-container {
    text-align: center; 
    margin-top: 40px; 
    padding: 20px;
    }
    .download-btn {
    background-color: #f44336;
    color: white;
    padding: 15px 30px;
    text-align: center; 
    text-decoration: none; 
    display: inline-block; 
    font-size: 18px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2)
    transition: background-color 0.3s ease, transform 0.2s ease;
    }
    .download-btn:hover {
    background-color: #d32f2f; 
    cursor: pointer;
    transform: translateY(-3px); 
    }
    .download-btn:active {
    background-color: #b71c1c; 
    transform: translateY(0); 
    }
    &lt;/style&gt;
    &lt;p&gt;You can launch the game by clicking the game icon.&lt;/p&gt;
    &lt;div class=&quot;download-container&quot;&gt;
    &lt;a class=&quot;download-btn&quot; href=&quot;https://multiup.io/423552775ca42dfd11f2b2b1fa5e3d18&quot; target=&quot;_blank&quot;&gt;Download the Game&lt;/a&gt;
    &lt;/div&gt;
    &lt;p&gt;For the password, in the comments type &quot;randomwits.com&quot; and &quot;your email&quot;, and I will send the password.&lt;/p&gt;
    &lt;p&gt;
    If you want to request any specific game, drop me a 
    &lt;a href=&quot;/contact&quot; aria-label=&quot;Explore complete game catalog&quot;&gt;
    message
    &lt;i class=&quot;fas fa-chevron-right&quot;&gt;&lt;/i&gt;
    &lt;/a&gt;
    &lt;/p&gt;
  </description>
  <pubDate>2025-03-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/download-detroit-become-Human</link>
<guid isPermaLink="true">https://randomwits.com/blog/download-detroit-become-Human</guid>
</item>
<item>
  <title>Deploy an Angular App to GitHub Pages for Free</title>
  <description>&lt;p&gt;GitHub Pages provides a simple way to host static websites for free. In this guide, we&apos;ll create a basic Angular app, build it for production, and deploy it to GitHub Pages.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;GitHub Pages provides a simple way to host static websites for free. In this guide, we&apos;ll create a basic Angular app, build it for production, and deploy it to GitHub Pages.&lt;/p&gt;
    &lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h2&gt;
    &lt;p&gt;Ensure you have the following installed:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://nodejs.org/&quot;&gt;Node.js&lt;/a&gt; (LTS recommended)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://angular.io/cli&quot;&gt;Angular CLI&lt;/a&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install -g @angular/cli&lt;/code&gt;)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;A &lt;a href=&quot;https://github.com/&quot;&gt;GitHub&lt;/a&gt; account&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;step-1-create-an-angular-app&quot;&gt;Step 1: Create an Angular App&lt;/h2&gt;
    &lt;p&gt;First, generate a new Angular project:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ff86d6ee1733cd796f39ffa2877b5b15.js?file=create.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This creates a new Angular project with default settings.&lt;/p&gt;
    &lt;h2 id=&quot;step-2-build-the-angular-app&quot;&gt;Step 2: Build the Angular App&lt;/h2&gt;
    &lt;p&gt;To deploy the app, we need to create a production-ready build:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ff86d6ee1733cd796f39ffa2877b5b15.js?file=build.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--configuration production&lt;/code&gt;: Optimizes the build for production.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--base-href &quot;/my-angular-app/&quot;&lt;/code&gt;: Required for GitHub Pages (replace &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-angular-app&lt;/code&gt; with your repository name).&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;The output files will be in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dist/my-angular-app&lt;/code&gt; directory.&lt;/p&gt;
    &lt;h2 id=&quot;step-3-create-a-github-repository&quot;&gt;Step 3: Create a GitHub Repository&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Go to &lt;a href=&quot;https://github.com/&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Click &lt;strong&gt;New repository&lt;/strong&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Name it &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-angular-app&lt;/code&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Initialize with a README (optional).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Click &lt;strong&gt;Create repository&lt;/strong&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;step-4-deploy-to-github-pages&quot;&gt;Step 4: Deploy to GitHub Pages&lt;/h2&gt;
    &lt;p&gt;We’ll use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gh-pages&lt;/code&gt; branch for deployment.&lt;/p&gt;
    &lt;h3 id=&quot;initialize-git-and-push-code&quot;&gt;Initialize Git and Push Code&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ff86d6ee1733cd796f39ffa2877b5b15.js?file=git.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;deploy-the-build-to-github-pages&quot;&gt;Deploy the Build to GitHub Pages&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;Install the GitHub Pages deployment package:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ff86d6ee1733cd796f39ffa2877b5b15.js?file=buildAngular.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;Deploy the app:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ff86d6ee1733cd796f39ffa2877b5b15.js?file=deployAngular.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;step-5-enable-github-pages&quot;&gt;Step 5: Enable GitHub Pages&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Go to your GitHub repository.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Navigate to &lt;strong&gt;Settings &amp;gt; Pages&lt;/strong&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Under &lt;strong&gt;Branch&lt;/strong&gt;, select &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gh-pages&lt;/code&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;step-6-access-your-live-app&quot;&gt;Step 6: Access Your Live App&lt;/h2&gt;
    &lt;p&gt;After a few minutes, your app will be available at:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://YOUR_USERNAME.github.io/my-angular-app/
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
    &lt;p&gt;You’ve successfully deployed an Angular app to GitHub Pages! This method is ideal for hosting small projects, demos, or personal portfolios.&lt;/p&gt;
    &lt;h3 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;404 Errors?&lt;/strong&gt; Ensure the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;base-href&lt;/code&gt; is correctly set.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Changes Not Reflecting?&lt;/strong&gt; Try:&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ff86d6ee1733cd796f39ffa2877b5b15.js?file=verify.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;GitHub Pages Not Loading?&lt;/strong&gt; Double-check that GitHub Pages is enabled under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Settings &amp;gt; Pages&lt;/code&gt;.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Now, you can easily share your Angular project with the world! 🚀&lt;/p&gt;
  </description>
  <pubDate>2025-03-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/deploy-angular-app-github-pages-free</link>
<guid isPermaLink="true">https://randomwits.com/blog/deploy-angular-app-github-pages-free</guid>
</item>
<item>
  <title>Mapping YAML to Configuration classes in Spring Boot</title>
  <description>&lt;p&gt;Spring Boot provides an elegant way to bind YAML configurations directly to Java classes using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ConfigurationProperties&lt;/code&gt; annotation. This tutorial will walk you through the basics and show you how to map a nested YAML structure to a configuration class.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Spring Boot provides an elegant way to bind YAML configurations directly to Java classes using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ConfigurationProperties&lt;/code&gt; annotation. This tutorial will walk you through the basics and show you how to map a nested YAML structure to a configuration class.&lt;/p&gt;
    &lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Spring Boot project&lt;/strong&gt;: If you don&apos;t have a project ready, you can create one using &lt;a href=&quot;https://start.spring.io/&quot;&gt;Spring Initializr&lt;/a&gt;.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;yaml-example&quot;&gt;YAML Example&lt;/h3&gt;
    &lt;p&gt;Consider the following YAML structure:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/51b4b6678f7ff4191d8e01b4e4527706.js?file=application.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In this YAML:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;access.projects&lt;/code&gt; is a list of project configurations.&lt;/li&gt;
    &lt;li&gt;Each project has &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;allowedAccess&lt;/code&gt; (a string) and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;allowedGroup&lt;/code&gt; (a list of strings).&lt;/li&gt;
    &lt;/ul&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;step-1-adding-dependencies&quot;&gt;Step 1: Adding Dependencies&lt;/h3&gt;
    &lt;p&gt;Ensure you have the following dependency in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pom.xml&lt;/code&gt; (if using Maven):&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/51b4b6678f7ff4191d8e01b4e4527706.js?file=pom.xml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This dependency generates metadata for configuration properties, making it easier to manage properties in the IDE.&lt;/p&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;step-2-define-the-configuration-class&quot;&gt;Step 2: Define the Configuration Class&lt;/h3&gt;
    &lt;p&gt;To bind the YAML structure, create a configuration class using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ConfigurationProperties&lt;/code&gt; annotation.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/51b4b6678f7ff4191d8e01b4e4527706.js?file=Config.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h4 id=&quot;explanation&quot;&gt;Explanation:&lt;/h4&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ConfigurationProperties(&quot;access&quot;)&lt;/code&gt;&lt;/strong&gt;: Maps properties under the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;access&lt;/code&gt; key in the YAML file.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Nested Class &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Project&lt;/code&gt;&lt;/strong&gt;: Represents the structure of each project entry in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;projects&lt;/code&gt; list.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Lombok Annotations&lt;/strong&gt;:
    &lt;ul&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Getter&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Setter&lt;/code&gt; reduce boilerplate code for getters and setters.&lt;/li&gt;
    &lt;li&gt;Ensure Lombok is configured in your project.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;step-3-enable-configuration-properties&quot;&gt;Step 3: Enable Configuration Properties&lt;/h3&gt;
    &lt;p&gt;Annotate your main application class with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@EnableConfigurationProperties&lt;/code&gt; to enable configuration property binding.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/51b4b6678f7ff4191d8e01b4e4527706.js?file=Application.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;step-4-using-the-configuration-in-your-application&quot;&gt;Step 4: Using the Configuration in Your Application&lt;/h3&gt;
    &lt;p&gt;You can now inject and use the configuration in any Spring component.&lt;/p&gt;
    &lt;h4 id=&quot;example-usage&quot;&gt;Example Usage:&lt;/h4&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/51b4b6678f7ff4191d8e01b4e4527706.js?file=ProductService.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h4 id=&quot;output&quot;&gt;Output:&lt;/h4&gt;
    &lt;p&gt;For the provided YAML, the output will be:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Allowed Access: t1
    Allowed Groups: [m1, m2]
    Allowed Access: t2
    Allowed Groups: [m2, m3]
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;key-benefits&quot;&gt;Key Benefits&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Type Safety&lt;/strong&gt;: Configuration values are bound directly to strongly typed Java objects.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Centralized Configuration&lt;/strong&gt;: Manage all project-specific configurations in one place.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Flexibility&lt;/strong&gt;: Easy to extend or modify as the YAML structure changes.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;common-pitfalls&quot;&gt;Common Pitfalls&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Ensure YAML indentation is correct&lt;/strong&gt;: Misaligned spaces can cause parsing errors.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Dependency management&lt;/strong&gt;: Ensure the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spring-boot-configuration-processor&lt;/code&gt; is included for better development experience.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Lombok setup&lt;/strong&gt;: Verify Lombok is properly configured in your IDE.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;hr /&gt;
    &lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
    &lt;p&gt;Using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@ConfigurationProperties&lt;/code&gt; in Spring Boot is a powerful way to manage hierarchical configurations. By following this tutorial, you can effectively bind YAML properties to Java classes and use them in your application. Happy coding!&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/&quot;&gt;Spring Boot Documentation&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2025-01-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/mapping-yaml-spring-boot</link>
<guid isPermaLink="true">https://randomwits.com/blog/mapping-yaml-spring-boot</guid>
</item>
<item>
  <title>Dear Vishi, daily logs for Jan 8, 2025</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Jan 8, 2025.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Jan 8, 2025.&lt;/p&gt;
    &lt;iframe id=&quot;dynamicIframe&quot; style=&quot;position: relative; width: 100%; height: 400px;&quot; src=&quot;/encrypted/2025-01-08-daily-logs-2025-01-08.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;script src=&quot;/js/resizeIframe.js&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2025-01-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2025-01-08</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2025-01-08</guid>
</item>
<item>
  <title>Ethiopian Airlines Reschedule</title>
  <description>&lt;p&gt;Recently, I needed to reschedule my Ethiopian Airlines flight due to a change in plans. With just a week before departure, I was anxious about whether I could manage the rescheduling in time. Here’s how I handled it, step by step.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Recently, I needed to reschedule my Ethiopian Airlines flight due to a change in plans. With just a week before departure, I was anxious about whether I could manage the rescheduling in time. Here’s how I handled it, step by step:&lt;/p&gt;
    &lt;h3 id=&quot;step-1-finding-the-right-contact-number&quot;&gt;Step 1: Finding the Right Contact Number&lt;/h3&gt;
    &lt;p&gt;Ethiopian Airlines provides a detailed list of worldwide contact numbers on their &lt;a href=&quot;https://www.ethiopianairlines.com/in/services/help-and-contact/worldwide-contacts&quot;&gt;help and contact page&lt;/a&gt;. Since I was in India, I initially considered calling the local number but ultimately opted to call their U.S. toll-free number for more reliable service.&lt;/p&gt;
    &lt;h3 id=&quot;step-2-using-rebtel-to-call-the-us-number&quot;&gt;Step 2: Using Rebtel to Call the U.S. Number&lt;/h3&gt;
    &lt;p&gt;To reach the U.S. toll-free number from India, I used the Rebtel app. Make sure to put your cellular mode in airplane mode so that the app uses wifi to call. The number I dialed was:&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Toll-Free:&lt;/strong&gt; 1-800-445-2733&lt;/p&gt;
    &lt;h3 id=&quot;step-3-customer-service-experience&quot;&gt;Step 3: Customer Service Experience&lt;/h3&gt;
    &lt;p&gt;The customer service representative I spoke with was both professional and efficient. They quickly understood my situation and guided me through the rescheduling process. Within minutes, my flight was updated to my preferred date and time.&lt;/p&gt;
    &lt;h3 id=&quot;step-4-rescheduling-fee&quot;&gt;Step 4: Rescheduling Fee&lt;/h3&gt;
    &lt;p&gt;There was a USD 200 fee for rescheduling my flight. Given that my original flight cost was around USD 1,300, I was relieved that I didn’t have to spend anywhere near that amount again. While the fee might seem high, it felt reasonable under the circumstances, and I appreciated the straightforward explanation of the charges.&lt;/p&gt;
    &lt;p&gt;Overall, the process was smooth and stress-free.&lt;/p&gt;
  </description>
  <pubDate>2024-12-29T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/ethiopian-airline-reschedule</link>
<guid isPermaLink="true">https://randomwits.com/blog/ethiopian-airline-reschedule</guid>
</item>
<item>
  <title>Manage Ruby Version using rbenv</title>
  <description>&lt;p&gt;I usually build my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll&lt;/code&gt; website using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bundle install&lt;/code&gt;. However I started getting following build error.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I usually build my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll&lt;/code&gt; website using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bundle install&lt;/code&gt;. However I started getting following build error:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;public_suffix-6.0.1 requires ruby version &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; 3.0, which is incompatible with the current version, ruby 2.7.0
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;solution-using-rbenv-to-manage-ruby-versions&quot;&gt;Solution: Using rbenv to Manage Ruby Versions&lt;/h2&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rbenv&lt;/code&gt; is a lightweight Ruby version manager that lets you switch between multiple Ruby versions seamlessly.&lt;/p&gt;
    &lt;h3 id=&quot;step-1-check-current-ruby-version&quot;&gt;Step 1: Check Current Ruby Version&lt;/h3&gt;
    &lt;p&gt;Run:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ruby &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You&apos;ll likely see:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ruby 2.7.0
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;step-2-install-ruby-312-with-rbenv&quot;&gt;Step 2: Install Ruby 3.1.2 with rbenv&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;Install the desired Ruby version:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rbenv &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;3.1.2
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;Set it as the global default version:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rbenv global 3.1.2
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;Verify the installed versions:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rbenv versions
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The output should list &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3.1.2&lt;/code&gt; as the active version.&lt;/p&gt;
    &lt;h3 id=&quot;step-3-update-shell-configuration&quot;&gt;Step 3: Update Shell Configuration&lt;/h3&gt;
    &lt;p&gt;If &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ruby --version&lt;/code&gt; still shows &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2.7.0&lt;/code&gt;, ensure your shell is properly configured to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rbenv&lt;/code&gt;.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Add the following lines to your shell configuration file (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.zshrc&lt;/code&gt;, or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bash_profile&lt;/code&gt;):&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/.rbenv/bin:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;rbenv init -&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;Reload your shell configuration:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; ~/.bashrc   &lt;span class=&quot;c&quot;&gt;# Or source ~/.zshrc&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;Rehash &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rbenv&lt;/code&gt; to update the shims:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rbenv rehash
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;step-4-verify-the-ruby-version&quot;&gt;Step 4: Verify the Ruby Version&lt;/h3&gt;
    &lt;p&gt;Check again:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ruby &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now, it should display:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ruby 3.1.2
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2024-12-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/manage-ruby-version-using-rbenv</link>
<guid isPermaLink="true">https://randomwits.com/blog/manage-ruby-version-using-rbenv</guid>
</item>
<item>
  <title>How To Change your mind by  Michael Pollan</title>
  <description>&lt;p&gt;These are my rough notes while reading this book.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;!-- disclaimer --&gt;
    &lt;div style=&quot;margin: 0 auto&quot; class=&quot;cl disclaimer&quot;&gt;
    &lt;span style=&quot;color:black&quot;&gt; &amp;nbsp;&amp;nbsp;These are my rough notes while reading this book
    &lt;/span&gt; 
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;LSD&lt;/strong&gt; is a molecule. It was synthesized by Hoffman in 1936 while he was working at Sandoz Laboratories in Switzerland.&lt;/p&gt;
    &lt;p&gt;Psilocybin is a naturally occurring psychedelic compound produced by certain species of mushrooms, commonly referred to as &quot;magic mushrooms. It has a long history of use in indigenous rituals, particularly by the Mazatec people of Mexico, where it played a central role in spiritual and healing ceremonies. Psilocybin is converted in the body to psilocin, which is responsible for its psychoactive effects.&lt;/p&gt;
    &lt;p&gt;How is a molecule different than a compound? All compound are molecules but not all molecules are compound. A molecule is when two or more atoms bond together. Compound is a molecule when two or different atoms are bonded together. So O&lt;sub&gt;2&lt;/sub&gt; is not a compound but a molecule.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Acid trip&lt;/strong&gt; is psychedelic experience when consuming LSD. &lt;strong&gt;Mushroop trip&lt;/strong&gt; is when you consume psilocybin. Both experiences often include altered perception of time, sensory enhancement, and profound changes in thought patterns.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;It&apos;s not the young who need to have an experience of the numinous, but those approaching the second half of life to negotiate its challenges.&quot; — Carl Jung&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Clinical studies suggest that psilocybin can alleviate anxiety and depression in people with terminal cancer, helping them face death with reduced fear.&lt;/p&gt;
    &lt;p&gt;Similarly, MDMA (commonly known as ecstasy) has shown promise in treating PTSD (Post-Traumatic Stress Disorder) in clinical trials. MDMA tends to lead to a crash after effects wear off. LSD on other hand has afterglow (only if it&apos;s a good trip).&lt;/p&gt;
    &lt;p&gt;Marijuana has been researched for medical benefits, including pain relief and reduction of chemotherapy-induced nausea, but it does not share the same psychedelic properties as LSD or psilocybin.&lt;/p&gt;
    &lt;p&gt;LSD is a &lt;strong&gt;Schedule 1 substance&lt;/strong&gt; that means the US goverment consider its&apos; a drug of abuse with no accepted medical use and its illegal to sell and possess.&lt;/p&gt;
    &lt;p&gt;Timothy Leary, a psychologist and professor at Harvard, became a prominent advocate for the use of psychedelics after conducting experiments with psilocybin in the 1960s.&lt;/p&gt;
    &lt;p&gt;Leary&apos;s controversial methods and public advocacy led to his dismissal from Harvard and fueled a cultural backlash against psychedelics, contributing to their criminalization.&lt;/p&gt;
    &lt;p&gt;Who&apos;s a philosophical materialist? They believe matter is the fundamental substance of the universe and that everything, including consciousness, can be explained by physical laws without invoking divine or spiritual explanations.&lt;/p&gt;
    &lt;p&gt;LSD or psilocybin are not addictive. What about marijuana? Marijuana can lead to dependence in some individuals but is not considered as addictive as substances like cocaine or opioids. And cocaine is definately addictive. However people predisposition to mental illness should not consume it.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Substance&lt;/th&gt;
    &lt;th&gt;Classification&lt;/th&gt;
    &lt;th&gt;Source&lt;/th&gt;
    &lt;th&gt;Effects&lt;/th&gt;
    &lt;th&gt;Risks&lt;/th&gt;
    &lt;th&gt;Medical Use&lt;/th&gt;
    &lt;th&gt;Legality&lt;/th&gt;
    &lt;th&gt;Duration of Effects&lt;/th&gt;
    &lt;th&gt;Method of Use&lt;/th&gt;
    &lt;th&gt;Research Focus&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**Cocaine**&lt;/td&gt;
    &lt;td&gt;Stimulant&lt;/td&gt;
    &lt;td&gt;Coca plant&lt;/td&gt;
    &lt;td&gt;Energy, euphoria, alertness&lt;/td&gt;
    &lt;td&gt;Highly addictive, heart issues&lt;/td&gt;
    &lt;td&gt;Local anesthetic&lt;/td&gt;
    &lt;td&gt;Illegal in most countries&lt;/td&gt;
    &lt;td&gt;~30 min to 1 hour&lt;/td&gt;
    &lt;td&gt;Snorted, smoked, injected&lt;/td&gt;
    &lt;td&gt;Not under active research&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**LSD**&lt;/td&gt;
    &lt;td&gt;Psychedelic&lt;/td&gt;
    &lt;td&gt;Synthetic (from ergot)&lt;/td&gt;
    &lt;td&gt;Hallucinations, altered perception&lt;/td&gt;
    &lt;td&gt;Non-addictive, bad trips&lt;/td&gt;
    &lt;td&gt;Under research for mental health&lt;/td&gt;
    &lt;td&gt;Schedule I substance&lt;/td&gt;
    &lt;td&gt;8-12 hours&lt;/td&gt;
    &lt;td&gt;Orally (blotter paper)&lt;/td&gt;
    &lt;td&gt;Depression, anxiety, PTSD&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Psilocybin**&lt;/td&gt;
    &lt;td&gt;Psychedelic&lt;/td&gt;
    &lt;td&gt;Mushrooms&lt;/td&gt;
    &lt;td&gt;Hallucinations, emotional insights&lt;/td&gt;
    &lt;td&gt;Non-addictive, anxiety risks&lt;/td&gt;
    &lt;td&gt;Under research for mental health&lt;/td&gt;
    &lt;td&gt;Decriminalized in some areas&lt;/td&gt;
    &lt;td&gt;4-6 hours&lt;/td&gt;
    &lt;td&gt;Orally (mushrooms, tea)&lt;/td&gt;
    &lt;td&gt;Depression, end-of-life care&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Opioids**&lt;/td&gt;
    &lt;td&gt;Narcotics (Painkillers)&lt;/td&gt;
    &lt;td&gt;Opium poppy or synthetic&lt;/td&gt;
    &lt;td&gt;Pain relief, euphoria&lt;/td&gt;
    &lt;td&gt;Highly addictive, overdose risk&lt;/td&gt;
    &lt;td&gt;Pain management&lt;/td&gt;
    &lt;td&gt;Legal for medical use&lt;/td&gt;
    &lt;td&gt;4-6 hours&lt;/td&gt;
    &lt;td&gt;Oral, injected, transdermal&lt;/td&gt;
    &lt;td&gt;Pain management, palliative care&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Marijuana**&lt;/td&gt;
    &lt;td&gt;Psychoactive (Cannabinoid)&lt;/td&gt;
    &lt;td&gt;Cannabis plant&lt;/td&gt;
    &lt;td&gt;Euphoria, relaxation (THC)&lt;/td&gt;
    &lt;td&gt;Dependency in some users&lt;/td&gt;
    &lt;td&gt;Pain, nausea, anxiety relief&lt;/td&gt;
    &lt;td&gt;Legal in some regions&lt;/td&gt;
    &lt;td&gt;2-4 hours&lt;/td&gt;
    &lt;td&gt;Smoked, orally (edibles)&lt;/td&gt;
    &lt;td&gt;Epilepsy, anxiety, chronic pain&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Acid trip can be good or bad. Hofmann who discovered LSD had a bad acid trip. He had to use bicycle to get home after consuming the drug since use of vehicles were restricted during wartime. LSD devoteees celebrate it as &lt;strong&gt;bicycle day&lt;/strong&gt;. Do we know why someone would likely have a good or a bad acid trip?&lt;/p&gt;
    &lt;p&gt;LSD mimics serotonin and binds to serotonin receptor in brain. Serotonin maintians regular brain function, while LSD causes an exaggeration or altered activation of the same pathway.&lt;/p&gt;
    &lt;p&gt;Another interesting difference between alcohol and LSD is that the former produces hangover where as the latter gives a afterglow. Afterglow is a state of well-being, clarity, and connectedness that lingers after the psychedellics effects have worn off. One of the reason for the afterglow is that LSD promotes growth of new neural connections.&lt;/p&gt;
    &lt;p&gt;UDV is a religious sect that uses halluciongenic tea called ayahuasca. It contains DMT, a schedule 1 substance yet is allowed import into USA. Native Americans use peyote for their ceremonies. It originated in Brazil.&lt;/p&gt;
    &lt;p&gt;MDMA enhances empathy, trust and emotional openness. It is often referred to as an empathogen because it stimulates feelings of closeness and connection between people. Wny not just use it? MDMA stimulates the release of large amounts of serotonin, depleting the brain&apos;s reserves. Over time, frequent or high-dose use can cause oxidative stress, which may damage or destroy serotonin axons (the projections of neurons that release serotonin). Also long term use, can cause depression and anxiety. LSD primarily acts as a psychedelic, whereas MDMA functions as an empathogen/stimulant. So LSD doesn&apos;t deplete serotonin or pose a significant risk of neurotoxicity.&lt;/p&gt;
    &lt;p&gt;Jesse setup a nonprofit called Council on Spiritual Practices (CSP) which aims at promoting entheogens. csp.org offers great psychedelic research.&lt;/p&gt;
    &lt;p&gt;Good Friday Experiment by Walter Pahnke, psychiatrist under Timothy Leary. It&apos;s a double blind experiment with twenty religious students. One group received psilocybin and other placebo. Folks with psilocybin had classical mystical experience. Experiment proves that drug induced experience is no different than mystical experience.&lt;/p&gt;
    &lt;p&gt;Holotropic breathwork, technique to induce psychedelics state of consciousness.&lt;/p&gt;
    &lt;p&gt;Is MDMA toxic to brain so that&apos;s why it&apos;s aquired the reputation of club drug?&lt;/p&gt;
    &lt;p&gt;Roland Griffiths went to burning man? What is it? Is it a festival?&lt;/p&gt;
    &lt;p&gt;Why did certain mushroom evolved to produce molecule like LSD and psilocybin that mimics the serotonin and binds to serotonin receptor? What&apos;s the evolution advantage in producing such molecule? Or is it just luck?&lt;/p&gt;
    &lt;p&gt;How is fungus different than bacteria? Both are micro organism? Fungus have cells which have nucleus unlike bacteria. Nucleus is used for protecting DNA. Nuclues is used for cell division (that&apos;s how you get more cells). Fungi are multicellular and larger than bacteria. All bacteria are single celled and it&apos;s DNA is free-floating in the cell in area called nucleoid. That&apos;s why bacter are called prokaryotes which means before kernel (nucleus).&lt;/p&gt;
    &lt;p&gt;What&apos;s mycelia? is it a membrane? And can it convey information?&lt;/p&gt;
    &lt;p&gt;Some mushroom like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Galerina autumnalis&lt;/code&gt; when eaten result in agonizing death. It&apos;s similar to Psilocybe stunzi. One way to identify is - if a grilled mushroom has purplish brown to black spores, and flesh bruises bluish, then it&apos;s likely a psiocyin producing species. Blue pigment is a sign of oxidized psilocin, one of the main pschoactive compounds in a psilocybe. Other is psilocybin which break downs psilocin in body.&lt;/p&gt;
    &lt;p&gt;Stoned Ape Theory - Ingestion of psilocybin caused rapid development of hominid brain for analytical thinking. Most scientist reject this hypothesis.&lt;/p&gt;
    &lt;p&gt;In 1620, Roman Catholic Church declared use of plants for divination was &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;act of superstition condemned as opposed to the purity and integrity of our Holy Catholic Faith&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;What&apos;s the difference between psilocybin and psilocin compound? Are both compound found in magic mashroom? Psiolocybin breaks down into Psilocin. Psilocin is what causes psychedelic effects. It&apos;s structure is similar to serotonin, a neuro transmitter.&lt;/p&gt;
    &lt;p&gt;What do you think of &lt;strong&gt;stoned ape theory&lt;/strong&gt;? Does the consumption of mushrooms by early humans led to drastic increase in our brain. I thought it was cooking. Cooking food was a revolution as we were able to absorb more nutrients.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;As soon as we unloaded and stowed our gear, we laced up our boots and headed out to look for mushrooms&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Azzie mushroom which is part of psychedelic mushroom has side effect like temporary paralysis. Cultivation of this species is illegal in United States.&lt;/p&gt;
    &lt;p&gt;Why are cows not affected by mushroom containing psilocybin? Does it have to do with their digestive system?&lt;/p&gt;
  </description>
  <pubDate>2024-12-13T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/review-book-how-to-change-your-mind</link>
<guid isPermaLink="true">https://randomwits.com/blog/review-book-how-to-change-your-mind</guid>
</item>
<item>
  <title>Weekly Logs from Nov Nov 18 to 24, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Nov 18 to 24, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Nov 18 to 24, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;sunday-musing&quot;&gt;Sunday Musing&lt;/h2&gt;
    &lt;h3 id=&quot;scroll-to-bottom-of-google-sheets&quot;&gt;Scroll to Bottom of Google sheets&lt;/h3&gt;
    &lt;p&gt;I despise having to scroll to bottom of the Google Sheet with large entries. Go to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Extentions-&amp;gt;Apps Script&lt;/code&gt; and add this to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Code.gs&lt;/code&gt; file&lt;/p&gt;
    &lt;pre&gt;&lt;code class=&quot;language-gs&quot;&gt;function onOpen() {
    let ss = SpreadsheetApp.getActiveSpreadsheet();
    let sheet = ss.getActiveSheet();
    sheet.setActiveRange(sheet.getRange(sheet.getLastRow(),1));
    }
    &lt;/code&gt;&lt;/pre&gt;
    &lt;h3 id=&quot;bangladesh-hindus&quot;&gt;Bangladesh Hindus&lt;/h3&gt;
    &lt;p&gt;This is what Donald Trump tweeted on Diwali before US elections&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://x.com/realDonaldTrump/status/1852033622494105832&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/TrumpTweetDiwali.png&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Bangladesh has seen a recent ousting of their prime minister Sheikh Hasina who &lt;a href=&quot;https://thediplomat.com/2024/08/violence-in-bangladesh-after-hasinas-ouster-stirs-fear-among-hindu-minority/&quot;&gt;fled to India&lt;/a&gt;. It&apos;s interesting that Kamala Harris tweeted no such thing on Bangladesh&apos;s Hindus. However, Tulsi Gabbard was more vocal on her tweet on Bangladesh&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://x.com/TulsiGabbard/status/1450975896920203267&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/TulsiTweet.png&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;movie-picks&quot;&gt;Movie Picks&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Checked out &lt;strong&gt;Deadpool 2&lt;/strong&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;It&apos;s hilarious with over-the-top action&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Would recommend.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;favourite-tracks&quot;&gt;Favourite Tracks&lt;/h3&gt;
    &lt;p&gt;Thanks to this song, I learned that New York City was originally called New Amsterdam as it was a Dutch colony in 1624. New York was captured during the reign of King Charles II of England and renamed.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/6AP62vMnwMA?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/6AP62vMnwMA?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/6AP62vMnwMA/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Song&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;I saw video of this young girl getting emotional&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/xL9_Oc_nvkc?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/xL9_Oc_nvkc?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/xL9_Oc_nvkc/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Song&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;This is the full song&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/b1MJVZH3f8w?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/b1MJVZH3f8w?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/b1MJVZH3f8w/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Song&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Recently watching lot of Osho reels&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/ZMURU6osGKU?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/ZMURU6osGKU?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/ZMURU6osGKU/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Song&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;This is the background music&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/9dqtnByXqSo?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/9dqtnByXqSo?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/9dqtnByXqSo/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Song&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;delete-untracked-files-in-git&quot;&gt;Delete untracked files in Git&lt;/h3&gt;
    &lt;p&gt;You can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git clean&lt;/code&gt; to remove untracked file in git repo. You can also provide options&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-f&lt;/code&gt;: Forcefully removes files.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-i&lt;/code&gt;: Review before deleting&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-d&lt;/code&gt;: Removes untracked directories.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-x&lt;/code&gt;: Includes ignored files (those listed in .gitignore).&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;samosa-trumps-over-jalebi&quot;&gt;Samosa trumps over jalebi&lt;/h2&gt;
    &lt;p&gt;My friend asked if I wanted jalebi after work. I said, &quot;Nah, not a fan.&quot; He looked at me like I was suddenly grown a into health freak. “Wow, so health-conscious!”&lt;/p&gt;
    &lt;p&gt;I let him bask in my glory for three seconds before I ruined it. &quot;Let’s get samosas instead. I’m not healthy—I just like my diabetes deep-fried, not sugary.&quot;&lt;/p&gt;
    &lt;h2 id=&quot;saturday-musing&quot;&gt;Saturday Musing&lt;/h2&gt;
    &lt;h3 id=&quot;suppress-stdout-for-commands-in-makefile&quot;&gt;Suppress stdout for commands in Makefile&lt;/h3&gt;
    &lt;p&gt;Let&apos;s say I&apos;ve a Makefile&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;build:
    ./gradlew clean build
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If I simply run, I can see commands executed by Makefile&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make build
    ./gradlew clean build
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;However I can suppress command using&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; build
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;skipping-test-in-junit&quot;&gt;Skipping test in JUnit&lt;/h3&gt;
    &lt;p&gt;Skip a test during the build like&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.junit.jupiter.api.Disabled&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Disabled&lt;/span&gt; 
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;AppTest&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;thursday-musing&quot;&gt;Thursday Musing&lt;/h2&gt;
    &lt;h3 id=&quot;enable-2fa-for-chase&quot;&gt;Enable 2FA for Chase&lt;/h3&gt;
    &lt;p&gt;Default &lt;strong&gt;2FA&lt;/strong&gt; for Chase has only phone options. However if you are outside the U.S., you mostly rely on email for authentication. Go to &lt;a href=&quot;https://medium.com/r/?url=https%3A%2F%2Fsecure.chase.com%2Fweb%2Fauth%2Fdashboard%23%2Fdashboard%2FmyDevices%2FauthSecurity%2FtwoFactorAuthentication&quot;&gt;Chase 2FA&lt;/a&gt; and select email&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/2fa.png&quot; alt=&quot;Chase 2FA&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2024-11-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-nov-18-24</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-nov-18-24</guid>
</item>
<item>
  <title>How to Get Brazil Tourist Visa from USA with Indian passport</title>
  <description>&lt;p&gt;My experience on how to get Brazil&apos;s tourist visa with India passport living in the US.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;My experience on how to get Brazil&apos;s tourist visa with India passport living in the US.&lt;/p&gt;
    &lt;p&gt;First, you need to create an &lt;a href=&quot;https://formulario-mre.serpro.gov.br/sci/pages/web/ui/#/cidadao-nacionalidade&quot;&gt;online application&lt;/a&gt;. Depending upon your passport, you may qualify for e-visa. However I had to apply for regular tourist visa. I had to upload following documents to successfully complete the application&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Passport&apos;s front and back page&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;US Driving License&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Round trip Flight itinerary. I booked a refundable ticket and choose tentative dates&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Airbnb&apos;s refundable reservation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Digital copy of Passport-style (2&quot;x2&quot;) photograph&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Recent bank statement&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Stamped US VISA and supporting documents&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;I-94 copy&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Proof of current address in the US&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;For the next step, either you can directly mail all your documents (with original passport) to the nearest Brazil embassy and schedule an in person interview. Or you can use a third party visa consultant service which can do this on your behalf. Brazil embassy has list of visa consultant services listed after you complete your application. Since this was my first time, I contacted American Visa of DC&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; and sent my documents via FedEx. I received my tourist visa within two weeks. Following is the breakdown of cost&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Brazil Service Fee $200&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Embassy Fee Brazil $80&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;US Postal Money order fee $25&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Federal Express Return $45&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/visa_brazil.png&quot; alt=&quot;Brazil Visa&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt; American Visa of DC. 1801 Columbia Rd, NW Ste#200. Washington DC, 20009&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-11-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/brazil-tourist-visa-from-usa</link>
<guid isPermaLink="true">https://randomwits.com/blog/brazil-tourist-visa-from-usa</guid>
</item>
<item>
  <title>A Philosophy of Software Design by John Ousterhout</title>
  <description>&lt;p&gt;These are my rough notes while reading this book.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;!-- disclaimer --&gt;
    &lt;div style=&quot;margin: 0 auto&quot; class=&quot;cl disclaimer&quot;&gt;
    &lt;span style=&quot;color:black&quot;&gt; &amp;nbsp;&amp;nbsp;These are my rough notes while reading this book
    &lt;/span&gt; 
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;In the Waterfall model, development is a linear process with distinct phases: requirements, design, implementation, testing, and deployment. Each phase must be completed before the next begins. This rigid approach can lead to challenges in adapting to changing requirements or unexpected issues.&lt;/p&gt;
    &lt;p&gt;Agile methodologies, like Scrum or Kanban, emphasize iterative development. A project is broken down into smaller, manageable iterations or sprints. Each sprint involves planning, designing, implementing, and testing a specific set of features. This iterative approach allows for flexibility and continuous improvement.&lt;/p&gt;
    &lt;p&gt;Modular design is an approach where a software system is divided into distinct, relatively independent modules. Each module has two components: an interface and an implementation. The interface specifies what the module does without detailing how it accomplishes it. The implementation contains the code that fulfills the promises made by the interface.&lt;/p&gt;
    &lt;p&gt;In object-oriented programming (OOP), each class can be viewed as a module. By adhering to the interface, changes to a module&apos;s implementation do not impact other modules that depend on it. This isolation enhances flexibility and maintainability across the system.&lt;/p&gt;
    &lt;p&gt;Abstraction provides a simplified view of an entity, focusing only on essential details while omitting irrelevant information. This principle allows developers to manage complexity effectively.&lt;/p&gt;
    &lt;p&gt;An interface is like a contract that specifies methods which must be implemented by any class that adheres to it. It exposes these methods to other modules without revealing the actual implementation, ensuring that interactions occur through a consistent set of behaviors rather than direct access to the implementation.&quot;&lt;/p&gt;
    &lt;p&gt;The best modules are deep: they have a lot of functionality hidden behind a simple interface. Shallow module is one whose interface is complicated relative to the functionality it provides.&lt;/p&gt;
    &lt;p&gt;Often taught that &quot;classes should be small&quot;. Instead classes should be deep. Small classes don&apos;t contribute much functionality and increase boilerplate. e.g.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;FileInputStream&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileStream&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;FileInputStream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;BufferedInputStream&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bufferedStream&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BufferedInputStream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fileStream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ObjectInputStream&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objectStream&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;enw&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ObjectInputStream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bufferedStream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;In this code, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FileInputStream&lt;/code&gt; only provides rudimentary I/O: it&apos;s not capable of bueffered I/O, nor can it read or write searialized objects. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BufferedInputStream&lt;/code&gt; adds buffering to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FileInputStream&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ObjectInputStream&lt;/code&gt; adds read ability to read and write serialized objects. First two objects, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fileStream&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bufferedStream&lt;/code&gt; are never used once the file has been opened. So buffering must be requested explicitly. If a developer forgest to creat this object, there will be no bufferring and I/O will be slow.&lt;/p&gt;
    &lt;p&gt;Java Developers argue that since not everyone wants to use buffering for file I/O, so that&apos;s why there&apos;s an additional step. However interfaces should be desigend to make &lt;strong&gt;common case&lt;/strong&gt; as simple as possible. In contrast, Unix develoeprs made sequential I/O most common use case.&lt;/p&gt;
    &lt;p&gt;A pass-through method is one that does little except invoke another method, whose signature is similar or identical to that of the calling method. They make the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;class&lt;/code&gt; more shallow, increase the complexity without increasing the functionality of system. However, one such exception like dispatcher. A dispatcher is a method that uses its arguments to select one of several other methods to invoke.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Decorators&lt;/strong&gt;. Also called wrapper. A decorator objct takes an existing object and extends its functionality. In Java, &lt;strong&gt;BufferedInputStream&lt;/strong&gt; class is a decorator: given an &lt;strong&gt;InputStream&lt;/strong&gt; object, it provides the same API but intorduces bufering.&lt;/p&gt;
    &lt;p&gt;A pass-through variable is a variable that has been passed through long chain of methods. It increases complexity for intermediate methods. One Soulution - Use Global Variable. However it has it&apos;s cons. It&apos;s impossible to create independent instances of same system in same process that access same global variable (conflict). ANother solution - Use Context object. It stores all the glboal variable. Cons is that it can have thread safety issue. Solution use immutable objects in a context object.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Subdivision&lt;/strong&gt;: Breaking up classes to divide work. However too many classes will increase complexity if there are shallow. Also subdivision works great if classes are independent. If there is dependencies between them, it would be to merge them into single class. e.g. HTTP request reader and parsing it into String would be better to have a single class.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;GOTO&lt;/strong&gt; are bad programming practice because unstructured jumps makes it hard to understand the program.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;How to Split a method&lt;/strong&gt; :&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Keep methods concise: Avoid methods exceeding 20 lines. While this isn&apos;t a strict rule, it serves as a guideline for keeping code readable and maintainable.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Single Responsibility Principle: A method should perform one specific task and do it completely. If a method appears to do more than one thing, consider splitting it.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Extract reusable subtasks: If a subtask within a method is general-purpose (i.e., it can be reused by other methods or components), extract it into its own method.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Avoid overly dependent methods: If a child method requires extensive understanding of its parent method to be understood, it is not a clean split. Such &quot;conjoined methods&quot; make code harder to maintain and debug.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;strong&gt;Exception Handling:&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Increased complexity: Exceptions can increase code complexity if not handled properly. Always strive for clear and consistent exception handling.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Masking exceptions: Handling exceptions at a low level (without propagating them when necessary) can hide the root cause of an issue. For example, silently failing or &quot;hanging&quot; instead of crashing might make debugging and resolution harder.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Aggregating exceptions: Handle exceptions at a higher level when possible. This means propagating errors upwards to a central place where they can be logged or managed consistently, reducing duplicated error-handling logic across the codebase.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Self-Documenting Code is discouraged. Good code doesn&apos;t repeat the code. eg&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Bad comment&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Calculate the total price with tax&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;price&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;taxRate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Better: Make the code self-explanatory&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;totalPriceWithTax&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;price&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;taxRate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;However comments are useful eg.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Using binary search because the dataset is pre-sorted and performance is critical&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;binarySearch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Workaround for a bug in library version 1.2.3 that causes null pointer exceptions&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Avoid Repeating the Code:&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Comments should add value by providing context or intent, not restating what the code does. Bad Example (Repeats the code):&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Setting the status to LOADING&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;readRPC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;LOADING&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Good Example (Explains the purpose):&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Indicate that the RPC is currently being processed&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;readRPC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;LOADING&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Provide High-Level Information:&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Comments should explain the intent or purpose of the code rather than its specific implementation details.&lt;/p&gt;
    &lt;p&gt;Ask Yourself: What is this code trying to achieve?&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Append the current hash to the RPC list for the appropriate server if it hasn’t been processed yet&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;processedHashes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentHash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;appendToRPC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentHash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Abstraction in Comments:&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Provide a simplified view of the entity or process. Focus on essential details and omit those that can be safely ignored. Bad Example (Too Detailed):&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Check if the hash is already in the list of processed hashes, &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// then find the appropriate server using the server map, &lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// and finally append the hash to the RPC queue of that server.&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;processedHashes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentHash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;appendToRPC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentHash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Good Example (Abstracted):&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Ensure the current hash is processed by the appropriate server&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;processedHashes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentHash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;appendToRPC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentHash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Use Comments for Context:&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Comments should clarify the why and not just the what of the code. Example:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Avoid duplicate processing by checking if the hash has already been handled&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;processedHashes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentHash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;appendToRPC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;currentHash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Interface documentation shouldn&apos;t have implementation details.&lt;/p&gt;
    &lt;p&gt;Comments first before writing the code. Also comments are more like abstraction rather than repeting the code&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;// phase 1 : scan active RPC to see &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;call is completed
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Local Variables should be named precise. Generic names are not good. e.g.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;count&lt;/strong&gt; is too generic.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Instead of using &lt;strong&gt;x&lt;/strong&gt; and &lt;strong&gt;y&lt;/strong&gt; for co-ordinates, better would be to use &lt;strong&gt;charIndex&lt;/strong&gt;, &lt;strong&gt;lineIndex&lt;/strong&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Another bad named variable is &lt;strong&gt;result&lt;/strong&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;However, &lt;strong&gt;i&lt;/strong&gt;, &lt;strong&gt;j&lt;/strong&gt; is fine for loop iteration as it only spans few lines of code&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;For &lt;strong&gt;Go Developers&lt;/strong&gt;, convention is usually opposite, variable names are often short&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;strong&gt;Invariant&lt;/strong&gt; is a property of variable or structure that&apos;s always true.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Generic container&lt;/strong&gt; are non obvious code. e.g.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Pair&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Intger&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Boolean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;();&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;It&apos;s much better to wrap it under a class and give it a meaningful name.&lt;/p&gt;
    &lt;p&gt;If there&apos;s a bug in the code, first write a unit test and then fix the test.&lt;/p&gt;
  </description>
  <pubDate>2024-11-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/review-book-a-philosophy-of-software-design</link>
<guid isPermaLink="true">https://randomwits.com/blog/review-book-a-philosophy-of-software-design</guid>
</item>
<item>
  <title>Weekly Logs from Nov 4 to 10, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Nov 4 to 10, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Nov 4 to 10, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A325:T347?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;friday&quot;&gt;Friday&lt;/h2&gt;
    &lt;h3 id=&quot;hellblade-senuas-sacrifice&quot;&gt;Hellblade: Senua&apos;s Sacrifice&lt;/h3&gt;
    &lt;p&gt;I started playing &lt;strong&gt;Hellblade&lt;/strong&gt;. I bought it for discount on Steam.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/8trsJwyjzJU?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/8trsJwyjzJU?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/8trsJwyjzJU/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;banning-movies-in-india&quot;&gt;Banning movies in India&lt;/h3&gt;
    &lt;p&gt;Should movies be banned in any country? Exception - child pronography, direct incitement to violence or treason for leaking national security States&apos;s secrets. But what about if the head of the State don&apos;t like the movie for whatever reason.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Kerala Story&lt;/strong&gt;, much liked by right wing,  was banned in West Bengal. &lt;strong&gt;Parzania&lt;/strong&gt; was banned in Gujarat which I believe would be much liked by the left. You can&apos;t cheer for one ban and oppose another. I reminds me a quote by Noam Chmosky&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;If we don&apos;t believe in freedom of expression for people we despise, we don&apos;t believe in it at all&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;No movies should be banned period. Especially on the flimsy ground of &apos;hurting sentiments&apos;. And all right wing and left wing parties in India has been guilty of censorship.&lt;/p&gt;
  </description>
  <pubDate>2024-11-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-nov-04-10</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-nov-04-10</guid>
</item>
<item>
  <title>Weekly Logs from Oct 28 to Nov 3, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Oct 28 to Nov 3, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Oct 28 to Nov 3, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!&quot;;
    var apiKey = &quot;AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;; 
    var startRow = &quot;A305&quot;; 
    var endRow = &quot;T324&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe id=&quot;dynamicIframe&quot; style=&quot;position: relative; width: 100%; height: 400px;&quot; src=&quot;/encrypted/2024-10-31-weekly-logs-2024-oct-nov-28-03.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;script src=&quot;/js/resizeIframe.js&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2024-10-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-oct-nov-28-03</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-oct-nov-28-03</guid>
</item>
<item>
  <title>Weekly Logs from Oct 21 to 27, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from from Oct 21 to 27, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A292:T304?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe id=&quot;dynamicIframe&quot; style=&quot;position: relative; width: 100%; height: 400px;&quot; src=&quot;/encrypted/2024-10-20-weekly-logs-2014-10-21-27.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;script src=&quot;/js/resizeIframe.js&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2024-10-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2014-10-21-27</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2014-10-21-27</guid>
</item>
<item>
  <title>Weekly Logs from Oct 14 to 20, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from from Oct 14 to 20, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from from Oct 14 to 20, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A279:T291?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-10-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2014-10-14-20</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2014-10-14-20</guid>
</item>
<item>
  <title>Manage Java Version Using SDKMAN</title>
  <description>&lt;p&gt;As a Java developer, you often need to switch between multiple versions of Java for different projects. Managing this manually can be tedious, but SDKMAN! is a great tool that simplifies the process of installing, listing, and switching between Java versions.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;As a Java developer, you often need to switch between multiple versions of Java for different projects. Managing this manually can be tedious, but SDKMAN! is a great tool that simplifies the process of installing, listing, and switching between Java versions.&lt;/p&gt;
    &lt;p&gt;In this guide, we&apos;ll explore how to use SDKMAN! to:&lt;/p&gt;
    &lt;p&gt;List available and installed Java versions.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Install specific Java versions.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Switch between Java versions.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Set default and local versions for your projects.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;installing-sdkman&quot;&gt;Installing SDKMAN!&lt;/h3&gt;
    &lt;p&gt;First, if you don&apos;t have SDKMAN! installed, you can install it by running the following commands in your terminal:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://get.sdkman.io&quot;&lt;/span&gt; | bash
    &lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/.sdkman/bin/sdkman-init.sh&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;to-verify-the-installation-run&quot;&gt;To verify the installation, run:&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk version
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Once SDKMAN! is installed, you can list all available Java versions and the ones you have installed locally.&lt;/p&gt;
    &lt;h3 id=&quot;list-all-available-java-versions&quot;&gt;List all available Java versions:&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk list java
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;list-installed-java-versions&quot;&gt;List installed Java versions:&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk current java
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will show you the Java versions you currently have installed on your machine.&lt;/p&gt;
    &lt;h3 id=&quot;installing-a-specific-java-version&quot;&gt;Installing a Specific Java Version&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;java 17.0.0-open
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This command downloads and installs OpenJDK 17. SDKMAN! will set this version as the default unless you specify otherwise.&lt;/p&gt;
    &lt;h3 id=&quot;switching-between-java-versions&quot;&gt;Switching Between Java Versions&lt;/h3&gt;
    &lt;p&gt;You may need to switch Java versions frequently, depending on your project. SDKMAN! makes this seamless.&lt;/p&gt;
    &lt;h4 id=&quot;switch-globally-set-the-default-java-version&quot;&gt;Switch globally (set the default Java version):&lt;/h4&gt;
    &lt;p&gt;To switch the default Java version globally (for all projects), use the sdk use command. For example:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk use java 11.0.0-open
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This sets the default Java version system-wide to OpenJDK 11.&lt;/p&gt;
    &lt;h4 id=&quot;switch-locally-per-project&quot;&gt;Switch locally (per project):&lt;/h4&gt;
    &lt;p&gt;If you want to set a Java version for a specific project, navigate to your project folder and run:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk &lt;span class=&quot;nb&quot;&gt;env &lt;/span&gt;init
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This creates a .sdkmanrc file where you can specify the Java version. To apply the version defined in .sdkmanrc, simply run:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk &lt;span class=&quot;nb&quot;&gt;env&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;SDKMAN! will automatically switch to the Java version specified in the project directory.&lt;/p&gt;
    &lt;h3 id=&quot;setting-a-default-java-version&quot;&gt;Setting a Default Java Version&lt;/h3&gt;
    &lt;p&gt;To set a default version that persists across terminal sessions:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sdk default java 17.0.0-open
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This command sets OpenJDK 17 as the default version system-wide.&lt;/p&gt;
  </description>
  <pubDate>2024-10-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/manage-java-version-sdkman</link>
<guid isPermaLink="true">https://randomwits.com/blog/manage-java-version-sdkman</guid>
</item>
<item>
  <title>Weekly Logs from Oct 7 to 13, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from from Oct 7 to 13, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A266:T278?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe id=&quot;dynamicIframe&quot; style=&quot;position: relative; width: 100%; height: 400px;&quot; src=&quot;/encrypted/2024-10-10-weekly-logs-2024-10-07-13.html&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;script src=&quot;/js/resizeIframe.js&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2024-10-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-10-07-13</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-10-07-13</guid>
</item>
<item>
  <title>An Introduction to Spring Data Redis Reactive</title>
  <description>&lt;p&gt;Spring Data Redis Reactive offers a powerful solution for working with Redis in a non-blocking, reactive manner. Let&apos;s dive into the key components and how to use them effectively.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Spring Data Redis Reactive offers a powerful solution for working with Redis in a non-blocking, reactive manner. Let&apos;s dive into the key components and how to use them effectively.&lt;/p&gt;
    &lt;h3 id=&quot;setting-up-dependencies&quot;&gt;Setting Up Dependencies&lt;/h3&gt;
    &lt;p&gt;To get started with Spring Data Redis Reactive, you need to include the appropriate dependency in your project. If you&apos;re using Maven, add the following to your pom.xml:&lt;/p&gt;
    &lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-data-redis-reactive&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;For Gradle users, add this to your build.gradle:&lt;/p&gt;
    &lt;div class=&quot;language-groovy highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;implementation&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;org.springframework.boot:spring-boot-starter-data-redis-reactive&apos;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This starter dependency brings in everything you need for reactive Redis operations, including the Lettuce driver, which is the preferred client for reactive Redis usage in Spring.&lt;/p&gt;
    &lt;p&gt;Spring Data Redis Reactive provides three main components for interacting with Redis:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;ReactiveRedisConnectionFactory&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;ReactiveRedisOperations&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;ReactiveRedisTemplate&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;reactiveredisconnectionfactory&quot;&gt;ReactiveRedisConnectionFactory&lt;/h3&gt;
    &lt;p&gt;ReactiveRedisConnectionFactory is the cornerstone of Redis interactions in a reactive Spring application. It&apos;s responsible for creating and managing reactive Redis connections.&lt;/p&gt;
    &lt;h4 id=&quot;key-features&quot;&gt;Key Features&lt;/h4&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Manages connection lifecycle&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Provides low-level access to Redis commands&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Supports connection pooling and custom configurations&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;when-to-use&quot;&gt;When to Use&lt;/h4&gt;
    &lt;p&gt;Use ReactiveRedisConnectionFactory when you need:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Fine-grained control over Redis connections&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;To execute raw Redis commands&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;To implement custom Redis protocols or operations&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;code-example&quot;&gt;Code Example&lt;/h3&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;@Service
    public class LowLevelRedisService {
    private final ReactiveRedisConnectionFactory connectionFactory;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;public LowLevelRedisService(ReactiveRedisConnectionFactory connectionFactory) {
    this.connectionFactory = connectionFactory;
    }
    public Mono&amp;lt;String&amp;gt; executeCustomCommand(String key) {
    return connectionFactory.getReactiveConnection()
    .stringCommands()
    .get(ByteBuffer.wrap(key.getBytes()))
    .map(ByteBuffer::array)
    .map(String::new);
    } }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4ebb9c09b2596714a50d94bbf9202d3c.js?file=ReactiveRedisConnectionFactory.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;reactiveredisoperations&quot;&gt;ReactiveRedisOperations&lt;/h3&gt;
    &lt;p&gt;ReactiveRedisOperations is an interface that defines a set of reactive Redis operations. It provides a higher-level abstraction compared to ReactiveRedisConnectionFactory.&lt;/p&gt;
    &lt;h4 id=&quot;key-features-1&quot;&gt;Key Features&lt;/h4&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Defines operations for various Redis data structures (Strings, Lists, Sets, etc.)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Provides type-safe operations&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Allows for easy mocking in unit tests&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;when-to-use-1&quot;&gt;When to Use&lt;/h4&gt;
    &lt;p&gt;Use ReactiveRedisOperations when you:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Want to code against interfaces for better testability&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Need type-safe Redis operations&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Prefer a higher-level abstraction than raw connections&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;code-example-1&quot;&gt;Code Example&lt;/h4&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;@Service
    public class UserService {
    private final ReactiveRedisOperations&amp;lt;String, User&amp;gt; redisOperations;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;public UserService(ReactiveRedisOperations&amp;lt;String, User&amp;gt; redisOperations) {
    this.redisOperations = redisOperations;
    }
    public Mono&amp;lt;User&amp;gt; saveUser(User user) {
    return redisOperations.opsForValue().set(user.getId(), user)
    .thenReturn(user);
    }
    public Mono&amp;lt;User&amp;gt; getUser(String id) {
    return redisOperations.opsForValue().get(id);
    } }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4ebb9c09b2596714a50d94bbf9202d3c.js?file=ReactiveRedisOperations.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;reactiveredistemplate&quot;&gt;ReactiveRedisTemplate&lt;/h3&gt;
    &lt;h4 id=&quot;key-features-2&quot;&gt;Key Features&lt;/h4&gt;
    &lt;p&gt;Implements ReactiveRedisOperations interface&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Handles serialization/deserialization of objects&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Provides exception translation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Supports Redis transactions&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;when-to-use-2&quot;&gt;When to Use&lt;/h4&gt;
    &lt;p&gt;Use ReactiveRedisTemplate when you:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Want a convenient, high-level API for Redis operations&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Need automatic serialization of complex objects&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Require support for Redis transactions&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;code-example-2&quot;&gt;Code Example&lt;/h4&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;@Service
    public class CacheService {
    private final ReactiveRedisTemplate&amp;lt;String, User&amp;gt; redisTemplate;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;public CacheService(ReactiveRedisTemplate&amp;lt;String, User&amp;gt; redisTemplate) {
    this.redisTemplate = redisTemplate;
    }
    public Mono&amp;lt;User&amp;gt; cacheUser(User user) {
    return redisTemplate.opsForValue().set(user.getId(), user, Duration.ofMinutes(30))
    .thenReturn(user);
    }
    public Mono&amp;lt;User&amp;gt; getCachedUser(String id) {
    return redisTemplate.opsForValue().get(id);
    } }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4ebb9c09b2596714a50d94bbf9202d3c.js?file=ReactiveRedisTemplate.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;All these &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Beans&lt;/code&gt; are autoconfigured by spring based on the dependency.&lt;/p&gt;
  </description>
  <pubDate>2024-10-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/spring-data-redis-reactive</link>
<guid isPermaLink="true">https://randomwits.com/blog/spring-data-redis-reactive</guid>
</item>
<item>
  <title>Essential Things to Do After Installing Chrome</title>
  <description>&lt;p&gt;Google Chrome is one of the most widely-used web browsers for its speed, security, and versatility. After installing Chrome, there are a few key steps you can take to optimize your experience and boost productivity.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Google Chrome is one of the most widely-used web browsers for its speed, security, and versatility. After installing Chrome, there are a few key steps you can take to optimize your experience and boost productivity.&lt;/p&gt;
    &lt;h2 id=&quot;enable-developer-mode&quot;&gt;Enable Developer Mode&lt;/h2&gt;
    &lt;p&gt;If you want to unlock advanced features in Chrome, enabling &quot;Developer Mode&quot; is a must. This feature allows you to install custom extensions, debug web pages, and access more powerful tools. Here&apos;s how to enable it:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Open Chrome and navigate to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chrome://extensions/&lt;/code&gt;.&lt;/li&gt;
    &lt;li&gt;In the top-right corner, toggle the button to enable &lt;strong&gt;Developer Mode&lt;/strong&gt;.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;install-essential-chrome-extensions&quot;&gt;Install Essential Chrome Extensions&lt;/h2&gt;
    &lt;p&gt;To enhance your productivity and browsing experience, consider installing these Chrome extensions:&lt;/p&gt;
    &lt;h3 id=&quot;ublock-origin&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm&quot;&gt;uBlock Origin&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;A lightweight and powerful ad blocker that improves your browsing experience by blocking intrusive ads, trackers, and malware.&lt;/p&gt;
    &lt;h3 id=&quot;vimium&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/vimium/dbepggeogbaibhgnhhndojpepiihcmeb&quot;&gt;Vimium&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;If you&apos;re a keyboard enthusiast, Vimium lets you navigate the web entirely with your keyboard, making your browsing experience faster and more efficient.&lt;/p&gt;
    &lt;h3 id=&quot;adguard-adblocker&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/adguard-adblocker/bgnkhhnnamicmpeenaelnjfhikgbkllg&quot;&gt;AdGuard AdBlocker&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;AdGuard blocks ads, pop-ups, and trackers while offering privacy protection. It enhances your online security and keeps your browsing fast and smooth.&lt;/p&gt;
    &lt;h3 id=&quot;checkbot&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/checkbot-seo-web-speed-se/dagohlmlhagincbfilmkadjgmdnkjinl&quot;&gt;Checkbot&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;An all-in-one tool to check your website’s SEO, speed, and security. It&apos;s a must-have if you manage or build websites.&lt;/p&gt;
    &lt;h3 id=&quot;grammarly&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/grammarly-for-chrome/kbfnbcaeplbcioakkpcpgfkobkghlhen?hl=en&quot;&gt;Grammarly&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Improve your writing and avoid embarrassing grammar mistakes with Grammarly. It helps you write better across emails, social media, and documents.&lt;/p&gt;
    &lt;h3 id=&quot;cookie-remover&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/cookie-remover/kcgpggonjhmeaejebeoeomdlohicfhce?hl=en&quot;&gt;Cookie Remover&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Quickly remove cookies for the current site with one click. This extension is great for privacy-conscious users who want to manage cookies on-the-fly.&lt;/p&gt;
    &lt;h3 id=&quot;screen-recorder&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/screen-recorder/hniebljpgcogalllopnjokppmgbhaden&quot;&gt;Screen Recorder&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Capture and record your screen directly from Chrome. It&apos;s useful for creating tutorials, recording meetings, or sharing visual feedback.&lt;/p&gt;
    &lt;h3 id=&quot;medium-parser&quot;&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/medium-parser/elgmajanahbjpbcljflifdnnmpodfiij&quot;&gt;Medium Parser&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Read Medium articles without hitting the paywall. This extension allows you to freely access Medium content without limitations.&lt;/p&gt;
    &lt;p&gt;If it gets blocked by the Chrome Web Store, you can &lt;a href=&quot;https://github.com/Xatta-Trone/medium-parser-extension/archive/refs/heads/main.zip&quot;&gt;download it here&lt;/a&gt;. Once downloaded, unzip the file, go to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chrome://extensions&lt;/code&gt;, and drag the unzipped folder, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chrome&lt;/code&gt;,  into the page. It will automatically install.&lt;/p&gt;
    &lt;h3 id=&quot;i-dont-care-about-cookies&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/i-dont-care-about-cookies/fihnjjcciajhdojfnbdddfaoknhalnja&quot;&gt;I Don&apos;t Care About Cookies&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Automatically remove cookie notifications from websites, keeping your browsing experience seamless and uncluttered.&lt;/p&gt;
    &lt;h3 id=&quot;json-formatter&quot;&gt;&lt;a href=&quot;https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa/related?hl=en&quot;&gt;JSON Formatter&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;If you work with JSON data, this extension formats JSON responses so that they’re easy to read, edit, and debug.&lt;/p&gt;
    &lt;h3 id=&quot;enable-copy-paste&quot;&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/enable-copypaste/leghnagnephbfcencnbonkbdimeokhem?hl=en&quot;&gt;Enable Copy-Paste&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Frustrated when you can’t copy-paste from certain websites? This extension enables the ability to copy-paste text from sites that normally block it.&lt;/p&gt;
    &lt;h3 id=&quot;small-tabs&quot;&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/small-tabs/ebfkcjpfhipceldaglgmaihlacpcomgj&quot;&gt;Small Tabs&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Reduce the size of your Chrome tabs and keep your browser organized with Small Tabs. It’s especially useful when you have too many tabs open and want a cleaner workspace.&lt;/p&gt;
    &lt;h3 id=&quot;jasper-everywhere-extension&quot;&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/jasper-everywhere-extensi/bpiohchncadidhohcajcnoelomephkdd&quot;&gt;Jasper Everywhere Extension&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;If you frequently work with AI writing tools, Jasper Everywhere brings the power of Jasper AI to any text field in your browser, allowing you to generate content quickly and efficiently.&lt;/p&gt;
    &lt;h3 id=&quot;compose-ai&quot;&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/compose-ai-ai-powered-wri/ddlbpiadoechcolndfeaonajmngmhblj&quot;&gt;Compose AI&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Compose AI speeds up your writing process by generating smart, AI-powered suggestions for text completion. It’s a great tool for those who write emails, reports, or articles regularly.&lt;/p&gt;
    &lt;h3 id=&quot;popup-blocker-strict&quot;&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/popup-blocker-strict/aefkmifgmaafnojlojpnekbpbmjiiogg&quot;&gt;Popup Blocker (strict)&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Strictly block all popup requests from any website&lt;/p&gt;
    &lt;h3 id=&quot;image-downloader&quot;&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/image-downloader/cnpniohnfphhjihaiiggeabnkjhpaldj&quot;&gt;Image Downloader&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;Browse and download images on the web&lt;/p&gt;
    &lt;h3 id=&quot;tab-list&quot;&gt;&lt;a href=&quot;https://chromewebstore.google.com/detail/tab-list/ccbillglagbffammojaidpaailialkje&quot;&gt;Tab List&lt;/a&gt;&lt;/h3&gt;
    &lt;p&gt;List and manage opened tabs for current window.&lt;/p&gt;
    &lt;p&gt;Happy browsing!&lt;/p&gt;
  </description>
  <pubDate>2024-09-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/essentials-extensions-to-make-chrome-more-productive</link>
<guid isPermaLink="true">https://randomwits.com/blog/essentials-extensions-to-make-chrome-more-productive</guid>
</item>
<item>
  <title>Are Smoothies Good for Weight Loss?</title>
  <description>&lt;p&gt;This morning, I woke up and made a smoothie for myself—a mix of blueberries, raspberries, and milk, with no added sugar. I felt pretty good, thinking, &quot;At least I&apos;m eating healthy!&quot; But then, curiosity got the better of me. Are smoothies really as healthy as they seem?.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;This morning, I woke up and made a smoothie for myself—a mix of blueberries, raspberries, and milk, with no added sugar. I felt pretty good, thinking, &quot;At least I&apos;m eating healthy!&quot; But then, curiosity got the better of me. Are smoothies really as healthy as they seem?&lt;/p&gt;
    &lt;p&gt;When you blend fruits, something interesting happens. The natural sugars in the fruit, which are normally trapped inside the cell walls, are released. These are often referred to as &quot;&lt;strong&gt;free sugars&lt;/strong&gt;.&quot; But what exactly are free sugars? They&apos;re sugars that are no longer bound within the structure of the food. In this case, blending breaks open the cells, making the sugar more easily absorbed by your body, which could potentially cause a spike in your blood sugar levels.&lt;/p&gt;
    &lt;p&gt;Another thing that changes when you blend fruits is the fiber. &lt;strong&gt;Fiber&lt;/strong&gt; is the part of fruits (and other plant-based foods) that our bodies don&apos;t digest. It helps slow down the absorption of sugars and keeps you feeling full. In whole fruits, the fiber remains intact, creating a natural &quot;barrier&quot; that slows down sugar absorption. But when you blend fruits, the fiber is physically broken down, meaning it doesn’t work as effectively in slowing down digestion.&lt;/p&gt;
    &lt;p&gt;Smoothies can still be a great option, especially if you&apos;re using whole, fresh fruits like I did today. However, it&apos;s important to be mindful of portion sizes and the ingredients you&apos;re using. If you&apos;re adding a lot of sugary ingredients (even natural ones like honey or flavored yogurt), your smoothie might not be as healthy as you think.&lt;/p&gt;
    &lt;p&gt;A good rule of thumb is: &lt;strong&gt;Eat your fruits and juice your vegetables.&lt;/strong&gt; Eating whole fruits ensures you get all the benefits of intact fiber, and juicing vegetables allows you to pack in nutrients without adding too much sugar.&lt;/p&gt;
  </description>
  <pubDate>2024-09-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/are-smoothies-good-for-weight-loss</link>
<guid isPermaLink="true">https://randomwits.com/blog/are-smoothies-good-for-weight-loss</guid>
</item>
<item>
  <title>Tips for Better Sleep</title>
  <description>&lt;p&gt;Sleep is often seen as a dull, passive part of our lives, but it&apos;s one of the most important things we do daily. During &lt;strong&gt;REM (Rapid Eye Movement)&lt;/strong&gt; sleep, our bodies undergo temporary muscle paralysis, a natural mechanism to prevent us from acting out our dreams. Our ancestors likely dreaded the vulnerability sleep brought, especially in the presence of nocturnal predators.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Sleep is often seen as a dull, passive part of our lives, but it&apos;s one of the most important things we do daily. During &lt;strong&gt;REM (Rapid Eye Movement)&lt;/strong&gt; sleep, our bodies undergo temporary muscle paralysis, a natural mechanism to prevent us from acting out our dreams. Our ancestors likely dreaded the vulnerability sleep brought, especially in the presence of nocturnal predators.&lt;/p&gt;
    &lt;p&gt;Thankfully, modern society has mostly allayed these fears. Unless you live in a war-torn region or in extreme poverty, most of us enjoy the luxury of sleeping in a quiet bedroom—even if it&apos;s not as lavish as a sultan&apos;s palace. The key is that sleep rejuvenates us, preparing our bodies and minds for the challenges of the next day.&lt;/p&gt;
    &lt;p&gt;Interestingly, during both REM and &lt;strong&gt;non-REM (NREM)&lt;/strong&gt; sleep cycles, dopamine, a neurotransmitter that plays a role in pleasure and reward, is released. This might explain the feeling of refreshment after a good night’s sleep.&lt;/p&gt;
    &lt;h3 id=&quot;sleep-deprivation-as-dangerous-as-being-drunk&quot;&gt;Sleep Deprivation: As Dangerous as Being Drunk&lt;/h3&gt;
    &lt;p&gt;Sleep is so crucial that depriving yourself of it has serious consequences. After &lt;strong&gt;24 hours without sleep&lt;/strong&gt;, your mental and physical performance drops to a level comparable to someone with a &lt;strong&gt;blood alcohol concentration (BAC)&lt;/strong&gt; of &lt;strong&gt;0.10%&lt;/strong&gt;. For context, the legal limit for driving in the U.S. is &lt;strong&gt;0.08%&lt;/strong&gt;, meaning being sleep-deprived can impair you just as much as alcohol . &lt;sup id=&quot;fnref:williamson2000&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:williamson2000&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h3 id=&quot;how-much-should-we-sleep&quot;&gt;How much should we sleep?&lt;/h3&gt;
    &lt;p&gt;According to the &lt;a href=&quot;https://health.gov/myhealthfinder/healthy-living/mental-health-and-relationships/get-enough-sleep&quot;&gt;U.S. Department of Health and Human Services&lt;/a&gt;,   
    adults should aim for at least &lt;strong&gt;7 hours of sleep per night&lt;/strong&gt;. However, some research suggests that biphasic sleep, which involves a long sleep period at night and a shorter nap during the day, can boost productivity for some people. This is seen in cultures that practice &lt;strong&gt;siestas&lt;/strong&gt;, a short afternoon nap.&lt;/p&gt;
    &lt;p&gt;While biphasic sleep may work for some, it&apos;s important to recognize that &lt;strong&gt;REM sleep&lt;/strong&gt; (Rapid Eye Movement), a critical stage for cognitive function and memory consolidation, typically occurs later in the sleep cycle. So, relying solely on short naps without getting enough consolidated sleep at night will not fully meet your sleep needs.&lt;/p&gt;
    &lt;h3 id=&quot;what-can-we-do-before-sleep&quot;&gt;What Can We Do Before Sleep?&lt;/h3&gt;
    &lt;p&gt;Here are some habits that can help improve the quality of your sleep:&lt;/p&gt;
    &lt;h4 id=&quot;pink-noise&quot;&gt;Pink Noise&lt;/h4&gt;
    &lt;p&gt;I listen to &lt;strong&gt;pink noise&lt;/strong&gt; before sleeping. Pink noise has equal power per octave, creating a balanced sound that&apos;s often described as more natural than white noise.&lt;/p&gt;
    &lt;p&gt;Studies have shown that listening to pink noise can improve sleep quality by enhancing deep sleep. &lt;sup id=&quot;fnref:yoon2017&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:yoon2017&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h4 id=&quot;avoid-blue-light-from-electronics&quot;&gt;Avoid Blue Light from Electronics&lt;/h4&gt;
    &lt;p&gt;&lt;strong&gt;Blue light&lt;/strong&gt; refers to the short-wavelength light emitted from screens like phones, computers, and TVs. Blue light interferes with the production of &lt;strong&gt;melatonin&lt;/strong&gt;, the hormone that regulates sleep cycles. To minimize its effect, you can:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Wear blue light-blocking glasses&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Use apps like &lt;strong&gt;f.lux&lt;/strong&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Enable the built-in night mode on your devices, which reduces blue light exposure before bedtime &lt;sup id=&quot;fnref:chang2015&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:chang2015&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;limit-alcohol-caffeine-and-nicotine&quot;&gt;Limit Alcohol, Caffeine, and Nicotine&lt;/h4&gt;
    &lt;p&gt;Alcohol, caffeine, and nicotine are all known to disrupt sleep quality.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Caffeine&lt;/strong&gt; can stay in your system for up to 6 hours, making it harder to fall asleep.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Nicotine&lt;/strong&gt; is a stimulant, which can increase wakefulness.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Alcohol&lt;/strong&gt;, although initially sedating, disrupts later stages of sleep, leading to less restful sleep overall. &lt;sup id=&quot;fnref:roehrs2001&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:roehrs2001&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;avoid-heavy-meals-and-sugary-snacks-before-bed&quot;&gt;Avoid Heavy Meals and Sugary Snacks Before Bed&lt;/h4&gt;
    &lt;p&gt;Heavy meals or snacks high in sugar can spike blood sugar levels and disrupt sleep. Although yogurt contains &lt;strong&gt;probiotics&lt;/strong&gt;, which may help gut health, consuming it before bed may not always benefit everyone. Light, balanced snacks are generally better. &lt;sup id=&quot;fnref:spiegel2004&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:spiegel2004&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h4 id=&quot;use-e-ink-devices-for-reading&quot;&gt;Use E-ink Devices for Reading&lt;/h4&gt;
    &lt;p&gt;I prefer using a &lt;strong&gt;Kindle&lt;/strong&gt; with an e-ink display, which doesn&apos;t emit blue light, for reading before sleep. This is largely a matter of preference, but studies suggest that limiting exposure to bright screens before bed can improve sleep onset.&lt;/p&gt;
    &lt;h4 id=&quot;morning-sunlight-for-biological-clock-regulation&quot;&gt;Morning Sunlight for Biological Clock Regulation&lt;/h4&gt;
    &lt;p&gt;Expose yourself to &lt;strong&gt;natural sunlight&lt;/strong&gt; within 15 minutes of waking. Sunlight triggers signals to your brain that help regulate your &lt;strong&gt;circadian rhythm&lt;/strong&gt;, which controls sleep and wake cycles. &lt;sup id=&quot;fnref:legates2014&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:legates2014&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h4 id=&quot;avoid-sleeping-near-low-frequency-noise&quot;&gt;Avoid Sleeping Near Low-Frequency Noise&lt;/h4&gt;
    &lt;p&gt;If you live near a &lt;strong&gt;windmill&lt;/strong&gt; or other sources of low-frequency noise, this can interfere with sleep quality. Low-frequency sounds are known to disturb certain people and can cause sleep disturbances. &lt;sup id=&quot;fnref:berglund1996&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:berglund1996&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;7&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:williamson2000&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Williamson, A., &amp;amp; Feyer, A.-M. (2000). Moderate sleep deprivation produces impairments in cognitive and motor performance equivalent to legally prescribed levels of alcohol intoxication.  &lt;em&gt;Occupational and Environmental Medicine&lt;/em&gt;, 57(10), 649-655. &lt;a href=&quot;https://doi.org/10.1136/oem.57.10.649&quot;&gt;DOI:10.1136/oem.57.10.649&lt;/a&gt; &lt;a href=&quot;#fnref:williamson2000&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:yoon2017&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Yoon, S., et al. (2017). Pink noise improves sleep stability. &lt;em&gt;Frontiers in Human Neuroscience&lt;/em&gt;. &lt;a href=&quot;https://doi.org/10.3389/fnhum.2017.00123&quot;&gt;DOI:10.3389/fnhum.2017.00123&lt;/a&gt; &lt;a href=&quot;#fnref:yoon2017&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:chang2015&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Chang, A.-M., et al. (2015). Evening use of light-emitting eReaders negatively affects sleep, circadian timing, and next-morning alertness. &lt;em&gt;Proceedings of the National Academy of Sciences&lt;/em&gt;, 112(4), 1232-1237. &lt;a href=&quot;https://doi.org/10.1073/pnas.1418490112&quot;&gt;DOI:10.1073/pnas.1418490112&lt;/a&gt;   &lt;a href=&quot;#fnref:chang2015&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:roehrs2001&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Roehrs, T., &amp;amp; Roth, T. (2001). Sleep, sleepiness, and alcohol use. &lt;em&gt;Alcohol Research &amp;amp; Health&lt;/em&gt;, 25(2), 101-109. &lt;a href=&quot;#fnref:roehrs2001&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:spiegel2004&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Spiegel, K., et al. (2004). Impact of sleep debt on metabolic and endocrine function. &lt;em&gt;The Lancet&lt;/em&gt;, 354(9188), 1435-1439. &lt;a href=&quot;https://doi.org/10.1016/S0140-6736(04)17674-5&quot;&gt;DOI:10.1016/S0140-6736(04)17674-5&lt;/a&gt; &lt;a href=&quot;#fnref:spiegel2004&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:legates2014&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;LeGates, T. A., et al. (2014). Light as a central modulator of circadian rhythms, sleep, and affect. &lt;em&gt;Nature Reviews Neuroscience&lt;/em&gt;, 15(7), 443-454. &lt;a href=&quot;https://doi.org/10.1038/nrn3743&quot;&gt;DOI:10.1038/nrn3743&lt;/a&gt;   &lt;a href=&quot;#fnref:legates2014&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:berglund1996&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Berglund, B., et al. (1996). Sources and effects of low-frequency noise. &lt;em&gt;Journal of the Acoustical Society of America&lt;/em&gt;, 99(5), 2985-3002. &lt;a href=&quot;https://doi.org/10.1121/1.414683&quot;&gt;DOI:10.1121/1.414683&lt;/a&gt;   &lt;a href=&quot;#fnref:berglund1996&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-09-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/tips-for-better-sleep</link>
<guid isPermaLink="true">https://randomwits.com/blog/tips-for-better-sleep</guid>
</item>
<item>
  <title>Hike the Grandfather Trail</title>
  <description>&lt;p&gt;To continue my passion for hiking, I recently visited &lt;strong&gt;Grandfather Mountain State Park&lt;/strong&gt;, one of North Carolina&apos;s most iconic hiking destinations. It offers a variety of trails and experiences, but the Grandfather Trail, known for its challenging terrain, ladders, and stunning views, was my primary target.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;To continue my passion for hiking, I recently visited &lt;strong&gt;Grandfather Mountain State Park&lt;/strong&gt;, one of North Carolina&apos;s most iconic hiking destinations. It offers a variety of trails and experiences, but the Grandfather Trail, known for its challenging terrain, ladders, and stunning views, was my primary target.&lt;/p&gt;
    &lt;h3 id=&quot;planning-your-visit&quot;&gt;Planning Your Visit&lt;/h3&gt;
    &lt;p&gt;Before you start your adventure, you&apos;ll need a permit, which can be purchased &lt;a href=&quot;https://grandfather.com/tickets/&quot;&gt;online&lt;/a&gt; or upon arrival at the park. I recommend purchasing it ahead of time to save yourself the trouble.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Important Tip&lt;/strong&gt;: Be sure to download Google Maps before you arrive since there’s limited to no cell service in this area. Alternatively, you can use offline maps on the &lt;a href=&quot;https://www.alltrails.com/trail/us/north-carolina/grandfather-trail-to-watauga-viewpoint&quot;&gt;AllTrails app&lt;/a&gt; to keep track of your trail progress.&lt;/p&gt;
    &lt;p&gt;Also wear sturdy hiking boots with good ankle support. Lastly, the trails closes at 5pm so plan the hike accordingly.&lt;/p&gt;
    &lt;h3 id=&quot;lower-bridge-parking-spot&quot;&gt;Lower Bridge Parking Spot&lt;/h3&gt;
    &lt;p&gt;After purchasing the ticket, you’ll need to drive for about five minutes to the &lt;strong&gt;lower bridge parking spot&lt;/strong&gt;, which serves as the starting point for your hike. From here, you can take a short trail to the upper parking lot. A notable highlight is the &lt;strong&gt;Mile High Swinging Bridge&lt;/strong&gt;, a suspension bridge offering breathtaking views. After crossing the bridge, there are large boulders where you can sit, rest, or snap some great photos.&lt;/p&gt;
    &lt;h3 id=&quot;grandfather-trail&quot;&gt;Grandfather Trail&lt;/h3&gt;
    &lt;p&gt;Following the signs, we embarked on the &lt;strong&gt;Grandfather Trail&lt;/strong&gt;. Initially, the trail was relatively easy, with rocky paths that weren’t too strenuous. The real challenge began after a while when I encountered the trail&apos;s famous ladders. These ladders add an extra layer of difficulty, especially if you&apos;re not accustomed to heights.&lt;/p&gt;
    &lt;h3 id=&quot;climbing-the-ladders&quot;&gt;Climbing the Ladders&lt;/h3&gt;
    &lt;p&gt;The ascent was fun and manageable for the most part. The final stretch, however, included a particularly steep ladder followed by a section where you need to hold onto a rope for extra support as you pull yourself up. It felt like an adventure straight out of a mountaineering expedition.&lt;/p&gt;
    &lt;h3 id=&quot;the-summit&quot;&gt;The Summit&lt;/h3&gt;
    &lt;p&gt;Reaching the summit, I was greeted with stunning views—despite the mist. It was a damp, cloudy day, and while visibility was limited, the experience was serene and peaceful. The mist added a mystical element to the landscape, making it feel as though I was walking through the clouds.&lt;/p&gt;
    &lt;h3 id=&quot;descending&quot;&gt;Descending&lt;/h3&gt;
    &lt;p&gt;Surprisingly, the most challenging part of the hike wasn’t the climb up but rather the descent down the ladders. It required careful attention, and I took my time to ensure I had secure footing on each step. Once past the ladders, the rest of the trail was enjoyable, offering great opportunities to admire the natural beauty surrounding me.&lt;/p&gt;
    &lt;h3 id=&quot;fun-fact&quot;&gt;Fun Fact&lt;/h3&gt;
    &lt;p&gt;As I exited the parking lot, I noticed a fun little sign that read&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/grandfather_hike_forest_gump.jpg&quot; alt=&quot;Forest Gump&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2024-09-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/hike-grandfather-trail</link>
<guid isPermaLink="true">https://randomwits.com/blog/hike-grandfather-trail</guid>
</item>
<item>
  <title>792. Number of Matching Subsequences</title>
  <description>&lt;p&gt;Given a string s and an array of strings words, return the number of words[i] that is a subsequence of s. A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Given a string s and an array of strings words, return the number of words[i] that is a subsequence of s.&lt;/p&gt;
    &lt;p&gt;A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.&lt;/p&gt;
    &lt;h3 id=&quot;example&quot;&gt;Example&lt;/h3&gt;
    &lt;p&gt;Input:&lt;/p&gt;
    &lt;p&gt;s = &quot;abcde&quot;
    words = [&quot;a&quot;, &quot;bb&quot;, &quot;acd&quot;, &quot;ace&quot;]
    Output:&lt;/p&gt;
    &lt;p&gt;3 (&quot;a&quot;, &quot;acd&quot;, and &quot;ace&quot; are subsequences of s).&lt;/p&gt;
    &lt;h3 id=&quot;brute-force-approach&quot;&gt;Brute force Approach&lt;/h3&gt;
    &lt;p&gt;In this solution, we iterate through each word and check if it&apos;s a subsequence of the string s using a two-pointer technique.&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;class Solution {
    public boolean isSubSequence(String word, String s) {
    int sPos = 0;
    int wPos = 0;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    while (sPos &amp;lt; s.length()) { 
    if (wPos == word.length()) break;
    if (word.charAt(wPos) == s.charAt(sPos)) {
    wPos++;
    }
    sPos++;
    }
    return wPos == word.length();
    }
    public int numMatchingSubseq(String s, String[] words) {
    int count = 0;
    for (String word : words) {
    if (isSubSequence(word, s)) {
    count++;
    }
    }
    return count;
    } }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5f1a0e8ba086c2ebe4a554b2628485b5.js?file=SubSequenceBrute.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h4 id=&quot;drawbacks&quot;&gt;Drawbacks:&lt;/h4&gt;
    &lt;p&gt;Time Complexity: O(m * n), where m is the length of s and n is the number of words. This brute force approach checks each word against the entire string s, leading to time limit exceeded (TLE) errors on large inputs.&lt;/p&gt;
    &lt;h3 id=&quot;optimized-approach-using-hashmap-and-binary-search&quot;&gt;Optimized Approach Using HashMap and Binary Search&lt;/h3&gt;
    &lt;p&gt;To optimize the brute force approach, we can precompute the indices of each character in s using a HashMap. Then, for each word, we perform binary search to efficiently find the next character&apos;s position in s.&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;class Solution {
    public int numMatchingSubseq(String s, String[] words) {
    int count = 0;
    Map&amp;lt;Character, List&lt;Integer&gt;&amp;gt; map = new HashMap&amp;lt;&amp;gt;();&lt;/Integer&gt;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    for (int i = 0; i &amp;lt; s.length(); i++) {
    char c = s.charAt(i);
    map.computeIfAbsent(c, k -&amp;gt; new ArrayList&amp;lt;&amp;gt;()).add(i);
    }
    for (String word : words) {
    boolean found = true;
    int prevIndex = -1;
    for (char c : word.toCharArray()) {
    if (!map.containsKey(c)) {
    found = false;
    break;
    }
    List&amp;lt;Integer&amp;gt; indices = map.get(c);
    int pos = binarySearch(indices, prevIndex);
    if (pos == indices.size()) {
    found = false;
    break;
    }
    prevIndex = indices.get(pos);
    }
    if (found) count++;
    }
    return count;
    }
    private int binarySearch(List&amp;lt;Integer&amp;gt; indices, int prevIndex) {
    int low = 0;
    int high = indices.size() - 1;
    while (low &amp;lt;= high) {
    int mid = low + (high - low) / 2;
    if (indices.get(mid) &amp;lt;= prevIndex) {
    low = mid + 1;
    } else {
    high = mid - 1;
    }
    }
    return low;
    } }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/5f1a0e8ba086c2ebe4a554b2628485b5.js?file=SubSequence.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h4 id=&quot;explanation&quot;&gt;Explanation&lt;/h4&gt;
    &lt;p&gt;HashMap Preprocessing: We create a HashMap where each character in s maps to a list of its indices. This allows us to quickly locate all occurrences of a character.&lt;/p&gt;
    &lt;p&gt;Binary Search for Subsequence Check: For each word, we use binary search to find the position of the next character in s after the last found character. This ensures that the characters appear in order while minimizing unnecessary comparisons.&lt;/p&gt;
    &lt;h4 id=&quot;benefits&quot;&gt;Benefits&lt;/h4&gt;
    &lt;p&gt;Time Complexity: O(m + n * k * log(l)), where:
    m is the length of s.
    n is the number of words.
    k is the average length of the words.
    l is the average number of occurrences of a character in s.&lt;/p&gt;
    &lt;p&gt;This is significantly faster, especially for larger inputs, since we reduce the time spent searching for characters using the precomputed HashMap and binary search.&lt;/p&gt;
  </description>
  <pubDate>2024-09-12T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/number-of-matching-subsequences</link>
<guid isPermaLink="true">https://randomwits.com/blog/number-of-matching-subsequences</guid>
</item>
<item>
  <title>Testing Preauthorize Annotation in Spring Boot</title>
  <description>&lt;p&gt;Preauthorize annotation can be use to enforce access control in Spring Boot applications. It&apos;s part of Spring Security that allows you to specify access control expression for methods. These expressions are evaluated before method execution, determining whether the current user has the authority to invoke the method.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Preauthorize annotation can be use to enforce access control in Spring Boot applications. It&apos;s part of Spring Security that allows you to specify access control expression for methods. These expressions are evaluated before method execution, determining whether the current user has the authority to invoke the method.&lt;/p&gt;
    &lt;h2 id=&quot;implementing-preauthorize&quot;&gt;Implementing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@PreAuthorize&lt;/code&gt;&lt;/h2&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;import org.springframework.security.access.prepost.PreAuthorize;
    import reactor.core.publisher.Mono;&lt;/p&gt;
    &lt;p&gt;public class AuthorizedService {
    @PreAuthorize(&quot;hasAuthority(@config.getAuthority())&quot;)
    public Mono&lt;Boolean&gt; hasAuthority() {
    return Mono.just(true);
    }
    }&lt;/Boolean&gt;&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4152cea6d018ce10a56780ec6aaa1349.js?file=AuthorizedService.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In this example, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hasAuthority()&lt;/code&gt; method is protected by a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@PreAuthorize&lt;/code&gt; annotation. The expression &quot;hasAuthority(@config.getAuthority())&quot; checks if the current user has the authority specified by the getAuthority() method of a @Config bean.&lt;/p&gt;
    &lt;p&gt;To make this work, we need to define our Config class:&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;import org.springframework.beans.factory.annotation.Value;
    import org.springframework.stereotype.Component;
    import lombok.Getter;&lt;/p&gt;
    &lt;p&gt;@Component
    @Getter
    public class Config {
    @Value(&quot;${spring.application.authority}&quot;)
    private String authority;
    }&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4152cea6d018ce10a56780ec6aaa1349.js?file=Config.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This class reads the required authority from the application&apos;s configuration. In your application.yaml, you can specify the required authority:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4152cea6d018ce10a56780ec6aaa1349.js?file=application.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;the-challenge-of-unit-testing&quot;&gt;The Challenge of Unit Testing&lt;/h2&gt;
    &lt;p&gt;When it comes to unit testing a service with @PreAuthorize, we encounter some challenges. Let&apos;s look at a common approach that doesn&apos;t work as expected:&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;import org.junit.jupiter.api.Test;
    import org.junit.jupiter.api.extension.ExtendWith;
    import org.mockito.Mock;
    import org.mockito.InjectMocks;
    import org.mockito.junit.jupiter.MockitoExtension;
    import org.springframework.security.test.context.support.WithMockUser;
    import reactor.test.StepVerifier;
    import org.springframework.security.access.AccessDeniedException;
    import static org.mockito.Mockito.when;&lt;/p&gt;
    &lt;p&gt;@ExtendWith(MockitoExtension.class)
    public class AuthorizedServiceTest {
    @InjectMocks
    private AuthorizedService authorizedService;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;@Mock
    private Config config;
    @Test
    @WithMockUser(authorities = &quot;ADMIN&quot;)
    void testHasAuthority_withAccess() {
    when(config.getAuthority()).thenReturn(&quot;ADMIN&quot;);
    StepVerifier.create(authorizedService.hasAuthority())
    .expectNext(true)
    .verifyComplete();
    }
    @Test
    void testHasAuthority_withoutAccess() {
    StepVerifier.create(authorizedService.hasAuthority())
    .expectError(AccessDeniedException.class)
    .verify();
    } }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4152cea6d018ce10a56780ec6aaa1349.js?file=AuthorizedServiceTest.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;It fails with following error :&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;org.mockito.exceptions.misusing.UnnecessaryStubbingException: 
    Unnecessary stubbings detected.
    Clean &amp;amp; maintainable test code requires zero unnecessary code.
    Following stubbings are unnecessary (click to navigate to relevant line of code):&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4152cea6d018ce10a56780ec6aaa1349.js?file=error.txt&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This approach fails because Mockito-created mocks are not proxied by Spring Security. As a result, the @PreAuthorize annotation is not processed, and the security checks are not performed during the test.&lt;/p&gt;
    &lt;h2 id=&quot;the-solution-integration-testing&quot;&gt;The Solution: Integration Testing&lt;/h2&gt;
    &lt;p&gt;To properly test methods annotated with @PreAuthorize, we need to use integration tests that load the entire Spring context. Here&apos;s how we can modify our test:&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;import org.junit.jupiter.api.Test;
    import org.junit.jupiter.api.extension.ExtendWith;
    import org.mockito.Mock;
    import org.mockito.InjectMocks;
    import org.mockito.junit.jupiter.MockitoExtension;
    import org.springframework.security.test.context.support.WithMockUser;
    import reactor.test.StepVerifier;
    import org.springframework.security.access.AccessDeniedException;
    import static org.mockito.Mockito.when;&lt;/p&gt;
    &lt;p&gt;@SpringBootTest(properties = {&quot;spring.profiles.active=test&quot;})
    public class AuthorizedServiceIntegrationTest {&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;@Autowired
    private AuthorizedService authorizedService;
    @Mock
    private PropertyConfig propertyConfig;
    @Test
    @WithMockUser(authorities = &quot;ADMIN&quot;)
    void testHasKafkaAllowedAuthority_withAccess() {
    when(propertyConfig.getKafkaAllowedAuthority()).thenReturn(&quot;ADMIN&quot;);
    StepVerifier.create(authorizedService.hasAuthority())
    .expectNext(true)
    .verifyComplete();
    }
    @Test
    void testHasKafkaAllowedAuthority_withoutAccess() {
    StepVerifier.create(authorizedService.hasAuthority())
    .expectError(AccessDeniedException.class)
    .verify();
    } }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4152cea6d018ce10a56780ec6aaa1349.js?file=AuthorizedServiceIntegrationTest.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2024-09-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/testing-preauthorize-spring-boot</link>
<guid isPermaLink="true">https://randomwits.com/blog/testing-preauthorize-spring-boot</guid>
</item>
<item>
  <title>Method Overloading and Varargs in Java</title>
  <description>&lt;p&gt;Method overloading is a fundamental concept in object-oriented programming that allows multiple methods to share the same name within a class, differentiated by their parameter lists. This feature enhances code readability and provides type safety at compile-time.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Method overloading is a fundamental concept in object-oriented programming that allows multiple methods to share the same name within a class, differentiated by their parameter lists. This feature enhances code readability and provides type safety at compile-time.&lt;/p&gt;
    &lt;h3 id=&quot;key-characteristics&quot;&gt;Key Characteristics:&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Compile-time Polymorphism&lt;/strong&gt;: The compiler determines which method to call based on the number and types of arguments.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Type Safety&lt;/strong&gt;: Each overloaded method can have a distinct implementation tailored to specific parameter types.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Performance&lt;/strong&gt;: Method resolution occurs at compile-time, resulting in minimal runtime overhead.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;example-implementation&quot;&gt;Example Implementation:&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ef1af44ec430026b0a94a6a3f148d4c3.js?file=StringPrinter.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;usage&quot;&gt;Usage:&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ef1af44ec430026b0a94a6a3f148d4c3.js?file=StringPrinter2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;variable-arguments-varargs-flexibility-through-variadic-functions&quot;&gt;Variable Arguments (Varargs): Flexibility Through Variadic Functions&lt;/h2&gt;
    &lt;p&gt;Introduced in Java 5, varargs provide a more flexible approach to method parameter handling. This feature allows methods to accept zero or more arguments of a specified type, simplifying method calls and reducing the need for overloading in certain scenarios.&lt;/p&gt;
    &lt;h3 id=&quot;key-characteristics-1&quot;&gt;Key Characteristics:&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Runtime Flexibility&lt;/strong&gt;: The number of arguments is determined at runtime.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Simplified Method Calls&lt;/strong&gt;: Allows for more natural method invocations with a variable number of arguments.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Potential for Ambiguity&lt;/strong&gt;: Care must be taken to avoid conflicts with overloaded methods.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;example-implementation-1&quot;&gt;Example Implementation:&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ef1af44ec430026b0a94a6a3f148d4c3.js?file=EnhancedStringPrinter.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;usage-1&quot;&gt;Usage:&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ef1af44ec430026b0a94a6a3f148d4c3.js?file=EnhancedStringPrinter2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;comparative-analysis&quot;&gt;Comparative Analysis&lt;/h2&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Aspect&lt;/th&gt;
    &lt;th&gt;Method Overloading&lt;/th&gt;
    &lt;th&gt;Variable Arguments&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;Syntax&lt;/td&gt;
    &lt;td&gt;Multiple method definitions&lt;/td&gt;
    &lt;td&gt;Single method with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;...&lt;/code&gt; syntax&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Type Safety&lt;/td&gt;
    &lt;td&gt;Strong, compile-time checking&lt;/td&gt;
    &lt;td&gt;Weaker, runtime array conversion&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Performance&lt;/td&gt;
    &lt;td&gt;Slightly better due to compile-time resolution&lt;/td&gt;
    &lt;td&gt;Minor overhead from array creation&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Flexibility&lt;/td&gt;
    &lt;td&gt;Limited to predefined parameter lists&lt;/td&gt;
    &lt;td&gt;Accepts any number of arguments&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Readability&lt;/td&gt;
    &lt;td&gt;Clear parameter expectations&lt;/td&gt;
    &lt;td&gt;Potentially unclear parameter count&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Backwards Compatibility&lt;/td&gt;
    &lt;td&gt;Excellent&lt;/td&gt;
    &lt;td&gt;Introduced in Java 5, may require refactoring&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;best-practices-and-considerations&quot;&gt;Best Practices and Considerations&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Use Method Overloading When&lt;/strong&gt;:
    &lt;ul&gt;
    &lt;li&gt;You have a fixed set of parameter variations.&lt;/li&gt;
    &lt;li&gt;Type safety is crucial.&lt;/li&gt;
    &lt;li&gt;Performance is a critical concern.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Use Varargs When&lt;/strong&gt;:
    &lt;ul&gt;
    &lt;li&gt;The number of parameters is truly variable.&lt;/li&gt;
    &lt;li&gt;You want to simplify the API for method callers.&lt;/li&gt;
    &lt;li&gt;Backwards compatibility with pre-Java 5 code is not a concern.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Avoid Varargs Overuse&lt;/strong&gt;:
    &lt;ul&gt;
    &lt;li&gt;Be cautious with varargs in overloaded methods to prevent ambiguity.&lt;/li&gt;
    &lt;li&gt;Consider using collections or arrays for large numbers of parameters.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Performance Considerations&lt;/strong&gt;:
    &lt;ul&gt;
    &lt;li&gt;Varargs create an array for each method call, which may impact performance in high-frequency invocations.&lt;/li&gt;
    &lt;li&gt;Method overloading avoids this overhead but requires more boilerplate code.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
  </description>
  <pubDate>2024-08-27T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/method-overloading-varargs-java</link>
<guid isPermaLink="true">https://randomwits.com/blog/method-overloading-varargs-java</guid>
</item>
<item>
  <title>Car Registration in North Carolina</title>
  <description>&lt;p&gt;Car Registration in North Carolina.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Car Registration in North Carolina.&lt;/p&gt;
    &lt;h2 id=&quot;prerequisite-before-going-to-dmv&quot;&gt;Prerequisite before going to DMV&lt;/h2&gt;
    &lt;h3 id=&quot;state-inspection&quot;&gt;State Inspection&lt;/h3&gt;
    &lt;p&gt;Went to Jiffy Lube. Car inspection failed because of headlights. Went to Advanced AutoParts and bought &amp;amp; replaced lights for Honda Accord&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;H11 for lower beam light&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;9005 for higher beam light&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Following tutorials were helpful -&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/ZeMVNjDnkoc?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/ZeMVNjDnkoc?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/ZeMVNjDnkoc/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/yMYcVQmHx54?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/yMYcVQmHx54?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/yMYcVQmHx54/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2024-08-24T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/car-registration-nc-2024-08-19-25</link>
<guid isPermaLink="true">https://randomwits.com/blog/car-registration-nc-2024-08-19-25</guid>
</item>
<item>
  <title>Where to play Badminton in Charlotte NC</title>
  <description>&lt;p&gt;I regularly play badminton at the Marion Diehl Recreation Center and Pool, where intermediate sessions are held every Wednesday from 7:00 pm to 9:00 pm. To secure a spot, you can make a reservation by calling +1 980-314-1300. From my experience, if you&apos;re looking to reserve a spot for the entire month, it&apos;s best to call on the 15th of the preceding month.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I regularly play badminton at the Marion Diehl Recreation Center and Pool, where intermediate sessions are held every Wednesday from 7:00 pm to 9:00 pm. To secure a spot, you can make a reservation by calling +1 980-314-1300. From my experience, if you&apos;re looking to reserve a spot for the entire month, it&apos;s best to call on the 15th of the preceding month.&lt;/p&gt;
    &lt;p&gt;Be sure to bring your own racket. While there are usually birdies available, you might want to bring your own just in case.&lt;/p&gt;
  </description>
  <pubDate>2024-08-24T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/badminton-charlotte-nc</link>
<guid isPermaLink="true">https://randomwits.com/blog/badminton-charlotte-nc</guid>
</item>
<item>
  <title>Understanding Object References in JavaScript</title>
  <description>&lt;p&gt;When working with JavaScript, it&apos;s important to understand that objects are reference types. This means that when you assign an object to a new variable, you&apos;re not creating a new copy of the object—instead, both variables reference the same object in memory. This can lead to some unexpected behavior if you&apos;re not careful.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When working with JavaScript, it&apos;s important to understand that objects are reference types. This means that when you assign an object to a new variable, you&apos;re not creating a new copy of the object—instead, both variables reference the same object in memory. This can lead to some unexpected behavior if you&apos;re not careful.&lt;/p&gt;
    &lt;h3 id=&quot;javascript-object-references&quot;&gt;JavaScript Object References&lt;/h3&gt;
    &lt;p&gt;Let&apos;s start with a simple example:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9dac8e798dac9501d4426ded1fb023fb.js?file=ex1.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In this case, &lt;strong&gt;x&lt;/strong&gt; and &lt;strong&gt;y&lt;/strong&gt; are primitive types (numbers), changing it doesn&apos;t change value since it&apos;s copied to different memory location.&lt;/p&gt;
    &lt;p&gt;However, objects in JavaScript work differently:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9dac8e798dac9501d4426ded1fb023fb.js?file=ex2.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Here, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;originalObj&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;newObj&lt;/code&gt; reference the same object in memory. When you modify the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;age&lt;/code&gt; property using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;newObj&lt;/code&gt;, the change is reflected in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;originalObj&lt;/code&gt; as well, because both variables point to the same memory location.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;shallow-copy-with-the-spread-operator&quot;&gt;Shallow Copy with the Spread Operator&lt;/h3&gt;
    &lt;p&gt;If you want to create a copy of an object without affecting the original, you might consider using the spread operator &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;...&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9dac8e798dac9501d4426ded1fb023fb.js?file=ex3.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;The spread operator creates a &lt;strong&gt;shallow copy&lt;/strong&gt; of the object. In this example, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;originalObj&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;newObj&lt;/code&gt; are separate objects. Changing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;newObj&lt;/code&gt; does not affect &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;originalObj&lt;/code&gt;.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;However, since the copy is shallow, nested objects within the original object are still shared between the original and the copied object:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9dac8e798dac9501d4426ded1fb023fb.js?file=ex4.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;While &lt;strong&gt;newObj.a&lt;/strong&gt; is independent of &lt;strong&gt;originalObj.a&lt;/strong&gt;, the nested object &lt;strong&gt;b&lt;/strong&gt; is still shared. Thus, changes to &lt;strong&gt;newObj.b.c&lt;/strong&gt; affect &lt;strong&gt;originalObj.b.c&lt;/strong&gt;.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;deep-copy-with-structuredclone&quot;&gt;Deep Copy with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;structuredClone&lt;/code&gt;&lt;/h3&gt;
    &lt;p&gt;To avoid the pitfalls of shallow copying, you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;structuredClone&lt;/code&gt;, which creates a deep copy of the object, including all nested objects:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9dac8e798dac9501d4426ded1fb023fb.js?file=ex5.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;structuredClone&lt;/code&gt; method ensures that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;newObj&lt;/code&gt; is a completely independent copy of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;originalObj&lt;/code&gt;, with no shared references.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;comparing-javascript-with-java&quot;&gt;Comparing JavaScript with Java&lt;/h3&gt;
    &lt;p&gt;The concept of references in JavaScript is similar to how Java handles data types, particularly when comparing primitive types and reference types.&lt;/p&gt;
    &lt;h4 id=&quot;primitive-types-in-java&quot;&gt;Primitive Types in Java&lt;/h4&gt;
    &lt;p&gt;Primitive types in Java (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;float&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;char&lt;/code&gt;) store their values directly. When you assign one primitive variable to another, the value is copied:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9dac8e798dac9501d4426ded1fb023fb.js?file=Ex6.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Here, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b&lt;/code&gt; are independent of each other after the assignment.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;reference-types-in-java&quot;&gt;Reference Types in Java&lt;/h4&gt;
    &lt;p&gt;Reference types in Java (e.g., objects, arrays) work similarly to JavaScript objects. They store a reference to the actual data in memory:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9dac8e798dac9501d4426ded1fb023fb.js?file=Ex7.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Both &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list1&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list2&lt;/code&gt; reference the same ArrayList object in memory. Changes made through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list2&lt;/code&gt; are reflected when accessing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list1&lt;/code&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2024-08-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/cloning-objects-in-javascript</link>
<guid isPermaLink="true">https://randomwits.com/blog/cloning-objects-in-javascript</guid>
</item>
<item>
  <title>Using kcat with Kafka and SASL Authentication</title>
  <description>&lt;p&gt;kcat (formerly known as kafkacat) is a versatile command-line tool for Apache Kafka. It allows you to consume and produce Kafka messages and interact with Kafka clusters efficiently. This guide will help you set up and use kcat with SASL authentication to consume and produce messages.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;kcat (formerly known as kafkacat) is a versatile command-line tool for Apache Kafka. It allows you to consume and produce Kafka messages and interact with Kafka clusters efficiently. This guide will help you set up and use kcat with SASL authentication to consume and produce messages.&lt;/p&gt;
    &lt;h3 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h3&gt;
    &lt;p&gt;Ensure that kcat is installed on your system. If not, you can find installation instructions in the &lt;a href=&quot;https://github.com/edenhill/kcat&quot;&gt;kcat GitHub repository&lt;/a&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;prepare-your-sasl-authentication-details&quot;&gt;Prepare Your SASL Authentication Details&lt;/h3&gt;
    &lt;p&gt;You&apos;ll need the following SASL authentication details:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;SASL username&lt;/li&gt;
    &lt;li&gt;SASL password&lt;/li&gt;
    &lt;li&gt;SASL mechanism (typically PLAIN or SCRAM-SHA-256/SHA-512)&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;consuming-messages&quot;&gt;Consuming Messages&lt;/h3&gt;
    &lt;h4 id=&quot;basic-consumption-command&quot;&gt;Basic Consumption Command&lt;/h4&gt;
    &lt;p&gt;To consume messages from a Kafka topic using kcat with SASL authentication, use the following command:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kcat &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; broker1:9092,broker2:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; &amp;lt;topic&amp;gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; security.protocol&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;sasl_ssl &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.mechanisms&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;SCRAM-SHA-512 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.username&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;username&amp;gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.password&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;password&amp;gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; ssl.ca.location&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;path_to_ca_cert&amp;gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-J&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Options Explained:&lt;/strong&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;`-C`: Consume mode.&lt;/li&gt;
    &lt;li&gt;`-b`: List of brokers.&lt;/li&gt;
    &lt;li&gt;`-t`: Topic name.&lt;/li&gt;
    &lt;li&gt;`-X security.protocol=sasl_ssl`: Use SASL_SSL for communication.&lt;/li&gt;
    &lt;li&gt;`-X sasl.mechanisms=SCRAM-SHA-512`: Specify the SASL mechanism.&lt;/li&gt;
    &lt;li&gt;`-X sasl.username=&lt;username&gt;\`: SASL username.&lt;/username&gt;&lt;/li&gt;
    &lt;li&gt;`-X sasl.password=&lt;password&gt;\`: SASL password.&lt;/password&gt;&lt;/li&gt;
    &lt;li&gt;`-X ssl.ca.location=&lt;path_to_ca_cert&gt;\`: Path to the CA certificate.&lt;/path_to_ca_cert&gt;&lt;/li&gt;
    &lt;li&gt;`-o -1`: Start consuming from the latest message.&lt;/li&gt;
    &lt;li&gt;`-e`: Exit after the last message is received.&lt;/li&gt;
    &lt;li&gt;`-J`: Output messages in JSON format.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h4 id=&quot;example-json-output&quot;&gt;Example JSON Output&lt;/h4&gt;
    &lt;p&gt;When consuming messages with the above command, the output will be in JSON format, including metadata such as offset, partition, and timestamp.&lt;/p&gt;
    &lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;topic&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sample-topic&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;partition&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;offset&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12345&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tstype&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;create&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;ts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1626894728000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;key&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;payload&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;{&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;eventType&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;EVENT_TYPE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;,&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;SOURCE_SYSTEM&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;}&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;additional-consumption-scenarios&quot;&gt;Additional Consumption Scenarios&lt;/h4&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Consume from the Earliest Offset&lt;/strong&gt;&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kcat &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; broker1:9092,broker2:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; your-topic &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; security.protocol&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;sasl_ssl &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.mechanisms&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;SCRAM-SHA-512 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.username&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;your-username &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.password&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;your-password &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; ssl.ca.location&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/path/to/ca.pem &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; beginning &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-J&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Consume from the Latest Offset&lt;/strong&gt;&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kcat &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; broker1:9092,broker2:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; your-topic &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; security.protocol&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;sasl_ssl &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.mechanisms&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;SCRAM-SHA-512 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.username&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;your-username &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.password&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;your-password &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; ssl.ca.location&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/path/to/ca.pem &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; end &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-J&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;producing-messages&quot;&gt;Producing Messages&lt;/h3&gt;
    &lt;p&gt;To publish messages to a Kafka topic, use the following command:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{&quot;key&quot;:&quot;value&quot;, &quot;anotherKey&quot;:123}&apos;&lt;/span&gt; | kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; broker1:9092,broker2:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; &amp;lt;topic&amp;gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; security.protocol&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;sasl_ssl &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.mechanisms&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;SCRAM-SHA-512 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.username&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;your-username &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.password&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;your-password &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; ssl.ca.location&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/path/to/ca.pem
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;For larger or more complex JSON payloads, consider using a file or another program to generate the JSON and pipe it into kcat.&lt;/p&gt;
    &lt;h4 id=&quot;using-a-json-file&quot;&gt;Using a JSON File&lt;/h4&gt;
    &lt;ol&gt;
    &lt;li&gt;Create a file, `message.json`:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;key&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;value&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;anotherKey&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;Produce the message from the file:&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kcat &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; broker1:9092,broker2:9092 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; your-topic &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; security.protocol&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;sasl_ssl &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.mechanisms&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;SCRAM-SHA-512 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.username&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;your-username &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; sasl.password&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;your-password &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; ssl.ca.location&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/path/to/ca.pem &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; message.json
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;understanding-sasl-authentication-in-kafka&quot;&gt;Understanding SASL Authentication in Kafka&lt;/h3&gt;
    &lt;p&gt;&lt;strong&gt;SASL (Simple Authentication and Security Layer)&lt;/strong&gt; is a framework for authentication and data security in internet protocols. In the context of Kafka, SASL provides a way to authenticate clients to Kafka brokers.&lt;/p&gt;
    &lt;p&gt;Kafka supports multiple SASL mechanisms, including:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;PLAIN&lt;/strong&gt;: Uses plain text username and password for authentication. It’s simple but not secure without SSL.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;SCRAM-SHA-256&lt;/strong&gt;: Uses the SCRAM (Salted Challenge Response Authentication Mechanism) with SHA-256 hashing. It is more secure than PLAIN.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;SCRAM-SHA-512&lt;/strong&gt;: Uses SCRAM with SHA-512 hashing, providing even stronger security than SHA-256.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;strong&gt;How Kafka Uses SASL Internally:&lt;/strong&gt;&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Authentication&lt;/strong&gt;: When a client connects to a Kafka broker, it uses the specified SASL mechanism to authenticate. The broker validates the credentials against its configuration or a user management system.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Encryption&lt;/strong&gt;: When combined with SSL (SASL_SSL), the data transmitted between the client and the broker is encrypted, providing both authentication and confidentiality.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
    &lt;p&gt;Using `kcat` with SASL authentication enables secure communication with Kafka clusters. By understanding and utilizing the different options and scenarios, you can efficiently consume and produce messages while ensuring the security of your Kafka interactions. Whether you&apos;re dealing with simple messages or complex JSON payloads, `kcat` provides a robust toolset for working with Kafka.&lt;/p&gt;
  </description>
  <pubDate>2024-08-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/kcat-with-kafka-sasl-authentication</link>
<guid isPermaLink="true">https://randomwits.com/blog/kcat-with-kafka-sasl-authentication</guid>
</item>
<item>
  <title>Handling Multiple Beans of the Same Type in Spring with Qualifier</title>
  <description>&lt;p&gt;In Spring application, it&apos;s common to have multiple beans of the same type. However, this can lead to issues when Spring tries to autowire these beans, as it doesn&apos;t know which bean to inject. This problem can be resolved using Qualifier annotation.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In Spring application, it&apos;s common to have multiple beans of the same type. However, this can lead to issues when Spring tries to autowire these beans, as it doesn&apos;t know which bean to inject. This problem can be resolved using Qualifier annotation.&lt;/p&gt;
    &lt;h2 id=&quot;problem-of-multiple-beans&quot;&gt;Problem of multiple beans&lt;/h2&gt;
    &lt;p&gt;Suppose you have two beans of same type like&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d3879dba90ba8946da656b1d032913be.js?file=Bean1.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;When Spring encounters these beans, it will throw an error due to the ambiguity of which bean to autowire.&lt;/p&gt;
    &lt;h2 id=&quot;solution-using-qualifier&quot;&gt;Solution using Qualifier&lt;/h2&gt;
    &lt;p&gt;To differentiate these beans, you can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Qualifier&lt;/code&gt; annotation. This annotation helps Spring identify which bean to inject when multiple beans of the same type exist.&lt;/p&gt;
    &lt;h3 id=&quot;define-beans-with-qualifier&quot;&gt;Define Beans with @Qualifier:&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d3879dba90ba8946da656b1d032913be.js?file=Bean2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;autowire-beans-with-qualifier&quot;&gt;Autowire Beans with Qualifier&lt;/h3&gt;
    &lt;p&gt;Use the&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt; @Qualifier&lt;/code&gt; annotation to specify which bean to inject in your components:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d3879dba90ba8946da656b1d032913be.js?file=Bean3.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Using the @Qualifier annotation in Spring allows you to manage multiple beans of the same type efficiently. By specifying unique qualifiers for each bean and using these qualifiers during autowiring, you can avoid conflicts and ensure your application runs smoothly.&lt;/p&gt;
  </description>
  <pubDate>2024-08-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/handling-multipe-beans-of-same-type-in-spring-using-qualifier</link>
<guid isPermaLink="true">https://randomwits.com/blog/handling-multipe-beans-of-same-type-in-spring-using-qualifier</guid>
</item>
<item>
  <title>Git Stash Tutorial</title>
  <description>&lt;p&gt;git stash is a powerful and nifty feature in Git that allows you to temporarily set aside changes you&apos;ve made to your working directory. This can be incredibly useful when you need to switch branches but aren&apos;t ready to commit your changes. Here’s a comprehensive guide on how to use git stash effectively.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;git stash is a powerful and nifty feature in Git that allows you to temporarily set aside changes you&apos;ve made to your working directory. This can be incredibly useful when you need to switch branches but aren&apos;t ready to commit your changes. Here’s a comprehensive guide on how to use git stash effectively.&lt;/p&gt;
    &lt;h2 id=&quot;the-basics-of-git-stash&quot;&gt;The Basics of git stash&lt;/h2&gt;
    &lt;p&gt;Imagine you are working on a branch and you need to check out another branch. However, you have uncommitted changes that you don&apos;t want to lose. This is where git stash comes into play.&lt;/p&gt;
    &lt;p&gt;To stash your changes, simply run:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This command will save your modified tracked files and staged changes in a new stash and revert your working directory to match the HEAD commit.&lt;/p&gt;
    &lt;h2 id=&quot;retrieving-your-changes&quot;&gt;Retrieving Your Changes&lt;/h2&gt;
    &lt;p&gt;When you&apos;re ready to retrieve your stashed changes, you have a couple of options:&lt;/p&gt;
    &lt;h3 id=&quot;git-stash-pop&quot;&gt;git stash pop&lt;/h3&gt;
    &lt;p&gt;This command will apply the most recent stash and then remove it from the stash list.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash pop
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If there are conflicts, you’ll need to resolve them manually before proceeding.&lt;/p&gt;
    &lt;h3 id=&quot;git-stash-apply&quot;&gt;git stash apply&lt;/h3&gt;
    &lt;p&gt;If you prefer to apply the stash but keep it in the stash list (perhaps you want to keep it for later use), use git stash apply:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash apply
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;After resolving any conflicts, you can remove the stash entry with:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash drop
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;stashing-specific-files&quot;&gt;Stashing Specific Files&lt;/h2&gt;
    &lt;p&gt;If you only want to stash changes to a specific file or set of files, you can use the push option with the file path:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash push path/to/your/file
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will stash only the specified file while leaving other changes in your working directory.&lt;/p&gt;
    &lt;h3 id=&quot;viewing-and-managing-stashes&quot;&gt;Viewing and Managing Stashes&lt;/h3&gt;
    &lt;p&gt;You can view a list of all stashes you have saved with:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash list
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will show you a list of all stash entries, each with an index and a description.&lt;/p&gt;
    &lt;p&gt;To apply a specific stash from the list, use its index:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash apply stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;index&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;For example:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash apply stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To drop a specific stash from the list, again use its index:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash drop stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;index&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;applying-stash-with-untracked-files&quot;&gt;Applying Stash with Untracked Files&lt;/h2&gt;
    &lt;p&gt;By default, git stash only stashes tracked files. If you want to stash untracked files as well, use the -u option:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;creating-a-stash-with-a-message&quot;&gt;Creating a Stash with a Message&lt;/h2&gt;
    &lt;p&gt;You can add a custom message to your stash entry to make it easier to identify later:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash save &lt;span class=&quot;s2&quot;&gt;&quot;Testing my stash&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;examples-and-scenarios&quot;&gt;Examples and Scenarios&lt;/h2&gt;
    &lt;h3 id=&quot;switching-branches-with-uncommitted-changes&quot;&gt;Switching Branches with Uncommitted Changes&lt;/h3&gt;
    &lt;p&gt;You&apos;re working on feature-branch and need to switch to main to review a pull request, but you have uncommitted changes:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout main
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;After reviewing, you can return to your branch and reapply your changes:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout feature-branch
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash pop
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;stashing-part-of-your-work&quot;&gt;Stashing Part of Your Work&lt;/h3&gt;
    &lt;p&gt;You&apos;re working on multiple files but only want to stash changes to file1.txt:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash push path/to/file1.txt
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The rest of your working directory remains unchanged.&lt;/p&gt;
    &lt;h3 id=&quot;resolving-conflicts-with-git-stash-apply&quot;&gt;Resolving Conflicts with git stash apply&lt;/h3&gt;
    &lt;p&gt;To handle conflicts better, use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git stash&lt;/code&gt;apply followed by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git stash drop&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash apply
    &lt;span class=&quot;c&quot;&gt;# Resolve conflicts&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash drop
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;stashing-multiple-times-and-applying-a-specific-stash&quot;&gt;Stashing Multiple Times and Applying a Specific Stash&lt;/h3&gt;
    &lt;p&gt;Sometimes, you might need to stash changes multiple times and later apply a specific stash. Here’s how you can manage multiple stashes:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash save &lt;span class=&quot;s2&quot;&gt;&quot;WIP: Implementing feature A&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash save &lt;span class=&quot;s2&quot;&gt;&quot;WIP: Fixing bug B&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash save &lt;span class=&quot;s2&quot;&gt;&quot;WIP: Refactoring module C&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To list all your stashes:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash list
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This might output something like:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;: WIP: Refactoring module C
    stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;: WIP: Fixing bug B
    stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;2&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;: WIP: Implementing feature A
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To apply a specific stash, for example, the one for fixing bug B:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash apply stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;After resolving any conflicts, you can drop the applied stash:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash drop stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git stash&lt;/code&gt; is an essential tool for any developer using Git. It allows you to temporarily shelve your changes, giving you the flexibility to switch contexts without losing your progress.&lt;/p&gt;
  </description>
  <pubDate>2024-07-29T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/git-stash-tutorial</link>
<guid isPermaLink="true">https://randomwits.com/blog/git-stash-tutorial</guid>
</item>
<item>
  <title>Review of The Molecule of More by Daniel Z. Lieberman, Michael E. Long</title>
  <description>&lt;p&gt;What&apos;s a dopamine? It&apos;s a molecule secreated by part of brain. Often dubbed pleasure molecule, it&apos;s presumed to be released when we experience pleasures. However this book explores how dopamine is a molecule of more not just pleasure. Like the author said the dopamine activity is not a marker of pleasure. It&apos;s a reaction to the unexpected - to possibility and anticipation.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;!-- disclaimer --&gt;
    &lt;div style=&quot;margin: 0 auto&quot; class=&quot;cl disclaimer&quot;&gt;
    &lt;span style=&quot;color:black&quot;&gt; &amp;nbsp;&amp;nbsp;These are my rough notes while reading this book
    &lt;/span&gt; 
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;What&apos;s a dopamine? It&apos;s a molecule secreated by part of brain. Often dubbed pleasure molecule, it&apos;s presumed to be released when we experience pleasures. However this book explores how dopamine is a molecule of more not just pleasure. Like the author said the dopamine activity is not a marker of pleasure. It&apos;s a reaction to the unexpected - to possibility and anticipation&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Love is a need, a craving, a drive to seek&apos;s life greatest prize&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;The pathway to dopamine in the brain is called &lt;strong&gt;reward circuit&lt;/strong&gt;. It reminds me of Pavlov dog. Ringing of a bell caused him to salivate. Did dog released dopamine at the sound of the bell?&lt;/p&gt;
    &lt;p&gt;One problem with dopamine excitement is that it doesn&apos;t last forever. That&apos;s if you need to do something new to get more release of dopamine. Example if you like a dish so much, dopamine will be released in your brain. If you have the same delcious dish everyday, dopamine would stop releasing for the same dish.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Dopamine has a very specific job: maximizing resources that will be available to us in the future; the pursuit of better things&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;I guess doesn&apos;t that makes dopamine drives us to get better. So can we equate dopamine with motivation? Are they different?&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;If you live under a bridge, dopamine makes you want a tent. If you live in a tent, dopmaine makes you want a house. If you live in the most expensive mansion in the world, dopmaine makes you want a castle on the moon. Dopmaine has no standard for good, and seeks no finish line. The dopmaine circuits in the brain can be stimulated only by the possiblity of whatever is shiny and new, never mind how perfect things are at the moment. The dopamine motto is &quot;More&quot;&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;So dopamine makes you desire more but is never statisfied. You can&apos;t rely on dopamine alone to find happiness in our daily life.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Vasopressin acted like a &quot;good-husband harmone&quot;. Dopamine does the opposite. Human beings who have genes that produces high levels of dopamine have the highest number of sexual partners and the lowest age of first sexual intercourse….Just as dopamine is the molecule of obsessive yearning, the chemicals mostly associated with long-term relationships are oxytocin and vasopressin. Oxytocin is more active in women and vasopressin in menj.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;What&apos;s vasopressin? It&apos;s a molecule like dopmaine. It&apos;s a primarily acts as a hormone. What&apos;s a hormone? They are chemical messengers that are released by a gland and is released into the bloodstream. They travel to different parts of body to regularte various physiological processes like growth, metabolism and mood. Hormones influence the functions of the body’s cells by binding to large proteins known as receptors, whose shape and electrical charge interact with one particular hormone. When a hormone binds to its receptor protein, it causes a change in the receptor’s shape that triggers changes within the cell. So a molecule can be a hormone. But not all molecules can act as a hormone. What about proteins? Proteins are a complex molecule and can also act as a hormone. E.g. Insulin regulates blood sugar levels.&lt;/p&gt;
    &lt;p&gt;If you hypothetically inject vasopressin in a promiscous male, would he change behavior? Are there any any food that promotes vasopressin?&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Endorphins (your brain&apos;s version of morphine), and a class of chemicals called endocannabinoids (your brains&apos; version of marijuana). As opposed to the please of anticipation via dopamine, these chemicals give us pleasure from sensation and emotion. In fact, one of the endocannabinoid molecule is called anandamide, named after a Sanskrit word that means joy, bliss, and delight.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;So if I release more endorphins in my body, will I get the same feeling as high on morphine?&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Under more normal conditions, though, dopamine activation in the desire circuit triggers energy, enthusiasm, and hope. It feels good In fact, some people spend the majority of their lives pursuing this feeling - a feeling of anticipation, a feeling that life is about to get better.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;But isn&apos;t what we call hope? A janitor does his job diligently in a hope that he would save money and get better job in future.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;the future isn&apos;t real. It&apos;s made up of bundle of possibilities that exist only in our minds. Those possibilities tend to be idealized - we usually don&apos;t imagine a mediocre outcome.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;blockquote&gt;
    &lt;p&gt;What happens when the future becomes the present - when the dinner is in your mouth or your lover is in your arms? The feeling of excitement, enthusiasm, and energy dissipate. Dopamine has shut down. Dopamine circuits doen&apos;t process experience in the rela world, only imaginary future possibilities.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;So we need something else to keep feeling good after we achieve our goals?&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;In the early 1960s, doctors prescribed large amounts of dopamine-boosting amphetamine to promote &quot;cheerfullness, mental alertness, and optimisim&quot;&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;ADHD = Attention Deficit Hyperactivity Disorder. People with ADHD have poor focus, less concentration and more impulsive.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;They may start pyaing bills, then switch to doing the laundry, then change a light bulb, then site down and watch TV with everything strewn all over the place…not listen to what people say to them. Sometimes they don&apos;t keep track of time, making them late, and they may lose things, such as car keys, call phones, even passports.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;ADHD is ofen seen on children because their frontal lobes which control dopamine acts, develop last and do not fully connect to the rest of the brain until a person finishes adolescence and enters adulthood. Can we say that frontal lobes in the brain control dopamine acts? Dopamine is produced in other parts of brain and it affects frontal lobes which is responsible for highly cognitive functions like decisions making.&lt;/p&gt;
    &lt;p&gt;Frontal lobes are the last parts of brain to fully develop which might be in mid-20s. That&apos;s why teenagers are impulsive.&lt;/p&gt;
    &lt;p&gt;Can we say adrenaline as norepinephrine are similar? Both are neurotransmitter. Adrenaline is produced by adrenal gland. Adrenal gland is just above the kidneys. Norepinephrine is mainly produced by the nervous system, though some is also made by the adrenal glands. Norepinephrine is a H&amp;amp;N emotion of the moment. It&apos;s involved in immediate responses, particularly in the &quot;fight or flight&quot; response. Where as dopamine is involved in more cerebral approach.&lt;/p&gt;
    &lt;p&gt;What&apos;s the detachment score? People who are focused on present moments, H&amp;amp;N circuts are activated and the warm, emotional aspects of our personality comes out. When we&apos;re engaged in the extrapersonal - at a distance, thinking abscractly, focusted on the future - the rational, emotionless parts of our personality are more likely to be seen.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Willpower can help an alchoholic say not to a drink once, but it&apos;s probably not going to work if he has to say no over and over again for months or years. Willpower is like a muscle. It becomes fatirgued with use, and after a farily short period of time, it gives out.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;Resisting temptation seems to have produced a psychic cost, in the sense that afterward particiapants were more inclined to give up easily in the face of frustration.&quot; If you&apos;re on a diet, the more times you resist temptation, the more likely you are to fail the next time around. Willpower is a limited resource.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;blockquote&gt;
    &lt;p&gt;You can&apos;t beat drugs with willpower alone…They have to combined with some form of psychotherapy.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Unlike dopamine, which is associated with reward and pleasure, serotonin is often linked to feelings of happiness and contentment. One interesting aspect of serotonin is its influence on harm aversion.&lt;/p&gt;
    &lt;p&gt;Studies have shown that serotonin-boosting drugs, such as selective serotonin reuptake inhibitors (SSRIs), can increase an individual&apos;s aversion to harm. This means that when serotonin levels are elevated, people are more likely to focus on avoiding harm rather than enforcing fairness or justice. This shift in focus can have various implications, particularly in decision-making and social interactions.&lt;/p&gt;
    &lt;p&gt;For example, in situations where a person must choose between a fair outcome that involves some risk and a safer option that may be less fair, higher serotonin levels might lead them to choose the safer option. This behavior underscores the role of serotonin in promoting cautious and risk-averse behavior, which can be beneficial in avoiding potential dangers but may also lead to more conservative decision-making.&lt;/p&gt;
    &lt;p&gt;Dopamine is a neurotransmitter, meaning it helps nerve cells communicate. Although only about 0.0005% of brain cells produce dopamine, it plays an outsized role in regulating mood, motivation, and creativity. Higher dopamine levels are associated with enhanced creativity but may also increase the risk of psychosis, as some dopamine pathways are involved in both creativity and schizophrenia.&lt;/p&gt;
    &lt;p&gt;The dopamine transporter is a protein that recycles dopamine after it transmits a signal. Cocaine blocks this transporter, leading to dopamine buildup in the brain and intense euphoria. However, this can disrupt the brain’s reward system, making natural activities less pleasurable and fostering addiction.&lt;/p&gt;
    &lt;p&gt;Interestingly, about 4.4% of the U.S. population experiences bipolar disorder, while only 0.7% are affected in Japan. Some theories suggest that immigrants, potentially with higher dopamine activity, may be more prone to certain mental health conditions and a desire for new experiences, known as “itchy feet.”&lt;/p&gt;
    &lt;p&gt;Chemists originally classified molecules into two groups: organic and inorganic compounds. Substances extracted from plants and animals were labeled &quot;organic,&quot; while other compounds were considered &quot;inorganic.&quot; Scientists once believed that organic compounds had a unique &quot;vital force&quot; that distinguished them from inorganics. However, the laboratory synthesis of organic compounds from inorganic materials (e.g., urea by Friedrich Wöhler) disproved this theory. Today, “organic” refers to compounds containing both carbon and hydrogen, so substances like diamond are not considered organic.&lt;/p&gt;
    &lt;p&gt;Multitasking is generally counterproductive, as almost any experience improves with full attention — as highlighted by Kelly McGonigal.&lt;/p&gt;
    &lt;p&gt;Exposure to nature stimulates two brain processes: subcortical arousal (associated with desire and dopamine release) and cortical attention control (linked to managing dopamine and focus). This balance contributes to why natural environments are beneficial for our well-being, promoting relaxation and improved focus.&lt;/p&gt;
  </description>
  <pubDate>2024-07-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/review-book-the-molecule-of-more</link>
<guid isPermaLink="true">https://randomwits.com/blog/review-book-the-molecule-of-more</guid>
</item>
<item>
  <title>Weekly Logs from July 15 to 21, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from from July 15 to 21, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A227:T239?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;freecycleorg&quot;&gt;FreeCycle.org&lt;/h2&gt;
    &lt;p&gt;Stumbled upon this &lt;a href=&quot;https://www.freecycle.org/&quot;&gt;website&lt;/a&gt;. Though you can hardly get anything brand new, but sometimes you can find some good cheap recyclable stuffs.&lt;/p&gt;
    &lt;h2 id=&quot;crowdstrike-outrage&quot;&gt;Crowdstrike Outrage&lt;/h2&gt;
    &lt;p&gt;We were suppose to fly to Anchorage, Alaska today with Delta. The flights were delayed so we missed our connecting flight. We had to hop to MSP airport and were on a standy ticket for the last flight. The flight was almost full and we got lucky and were the last lucky members to board the flight. The flight was meh. Just served snack and a beverage in a five hour flight.&lt;/p&gt;
    &lt;p&gt;It seems like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Crowdstrike&lt;/code&gt; pushed an update which ran on kernel mode and crashed all windows machine. Airports worldwide are affected by this issue. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crwd&lt;/code&gt; stocks was also bearish.&lt;/p&gt;
    &lt;p&gt;Crowdstrike wrote a &lt;a href=&quot;https://www.crowdstrike.com/blog/falcon-update-for-windows-hosts-technical-details/&quot;&gt;blog&lt;/a&gt; explaining what happened. There was a logic error resulting in a system crash and blue screen (BSOD) on impacted systems.&lt;/p&gt;
  </description>
  <pubDate>2024-07-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-07-15-21</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-07-15-21</guid>
</item>
<item>
  <title>Weekly Logs from July 1 to 7, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from from July 1 to 7, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A214:T226?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-07-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-07-01-07</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-07-01-07</guid>
</item>
<item>
  <title>Who Destroyed Nalanda University</title>
  <description>&lt;p&gt;Nalanda University, located in present-day Bihar, India, was one of the most renowned centers of learning in the ancient world. Its destruction marks a significant loss to global intellectual heritage, but the question of who destroyed this great institution remains a subject of debate among historians and scholars. &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Nalanda University, located in present-day Bihar, India, was one of the most renowned centers of learning in the ancient world. Its destruction marks a significant loss to global intellectual heritage, but the question of who destroyed this great institution remains a subject of debate among historians and scholars.&lt;/p&gt;
    &lt;p&gt;Nalanda flourished as a Buddhist center of learning from the 5th century CE until its decline in the late 12th century. At its peak, it attracted scholars from across Asia and housed a vast library known as Dharmaganja or &quot;Treasury of Truth.&quot;&lt;/p&gt;
    &lt;p&gt;Most left centric academia tends to blame the Brahmins. Here&apos;s a excerpt from the left-wing portal &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;thewire&lt;/code&gt;&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; by Ram Puniyani, a current president of the Executive Council of the Centre for Study of Society and Secularism (CSSS) :&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;All reliable sources point to the fact that Brahmins burnt the library as revenge. Bringing in Khilji fits into the general Islamophobic propaganda against Muslims and, at the same time, hides the true story of the persecution of Buddhists during that period.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;How about a counter from a right-wing prespective. Here&apos;s an article published in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swarajya&lt;/code&gt; &lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; by Makarand Paranjape, a former professor at JNU university:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;But the old Nalanda was finished by Islamic invaders. Around 1200 CE, it was reportedly looted and burned by a local Turkic-Afghan chieftain-adventurer, Bakhtiyar Khilji. Legend has it that Khilji and his 18 horsemen went on to capture Bengal. So popular is this view that Al Mahmud, the Bangladeshi writer, not only reprises it in Bakhtiyarer Ghora (Bakhtiyar’s Horses), but, some would argue, glorifies Khilji.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Interestingly Amartya Sen, who won the Nobel Prize in Economics in 1998 and is also left-leaning, has this to say about Nalanda&lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Nalanda was violently destroyed in an Afghan attack, led by the ruthless conqueror, Bakhtiyar Khilji, in 1193, shortly after the beginning of Oxford University and shortly before the initiation of Cambridge.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;So what&apos;s the truth? Was Nalanda university destoryed by Brahmins or Islamic invaders?&lt;/p&gt;
    &lt;p&gt;One source is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tabakat e Nasiri&lt;/code&gt; by Minhaj-i-Siraj Juzjani, you can read the English translation online&lt;sup id=&quot;fnref:4&quot;&gt;&lt;a href=&quot;#fn:4&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt; on page 552&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;There were two brothers of Farghānah, men of learning, one Nizam-ud-Din, the other Şamṣām-ud-Din [by name], in the service of Muḥammad-i-Bakht-yār; and the author of this book. These two wise brothers were soldiers&apos; among that band of holy warriors when they reached the gateway of the fortress and began the attack, at which time Muḥammad-i-Bakht-yār, by the force of his intrepidity, threw himself into the postern of the gateway of the place, and they captured the fortress, and acquired great booty. The greater number of the inhabitants of that place were Brahmans, and the whole of those Brahmans had their heads shaven; and they were all slain. There were a great number of books&apos; there; and, when all these books came under the observation of the Musalmāns, they summoned a number of Hindus that they might give them information respecting the import of those books; but the whole of the Hindūs had been killed&apos;. On becoming acquainted [with the contents of those books], it was found that the whole of that fortress and city was a college, and in the Hindui tongue, they call a college Bihār.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;blockquote&gt;
    &lt;p&gt;The Zubdat-ut-Tawarikh which quotes our author verbatim on most occassions, says they sent for a number of Hindus, who made them acquainted with the contents of the books, and in them it was written that fortress and city was called a college, but, correctly, a Budhist monastery.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;I only quoted a single historical source, and other ancient documents may present differing perspectives. The problem with history is that unlike science, hypotheses cannot be tested through repeatable experiments. It&apos;s more susceptible to interpretation and inaccuracies.&lt;/p&gt;
    &lt;p&gt;However I think in this case I would more likely agree with the right. I think the left-leaning historians in India occasionally behave as &lt;a href=&quot;https://en.wikipedia.org/wiki/Regressive_left&quot;&gt;regresssive left&lt;/a&gt;.&lt;/p&gt;
    &lt;p&gt;Whatever the truth may be about Nalanda&apos;s fall, it&apos;s crucial to remember that history should not be weaponized to settle present-day scores. The past can offer valuable lessons, but an obsessive focus on historical grievances can be detrimental to societal progress.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt; 
    &lt;a href=&quot;https://thewire.in/history/did-bakhtiyar-khilji-destroy-nalanda-university&quot; target=&quot;_blank&quot;&gt;Did Bakhtiyar Khilji Destroy Nalanda University?&lt;/a&gt; 
    &lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt; 
    &lt;a href=&quot;https://swarajyamag.com/magazine/and-thus-fell-nalanda&quot; target=&quot;_blank&quot;&gt;And Thus Fell Nalanda&lt;/a&gt; 
    &lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt; 
    &lt;a href=&quot;https://www.thehindu.com/opinion/op-ed/Nalanda-and-the-pursuit-of-science/article15519635.ece&quot; target=&quot;_blank&quot;&gt;Nalanda and the pursuit of science&lt;/a&gt; 
    &lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot;&gt;
    &lt;p&gt;
    &lt;a href=&quot;https://www.cristoraul.org/ENGLISH/readinghall/Doors-of-Wisdom/Biographies/BABAR/pdf/Tabaqat-i-Nasiri-Volume-1.pdf&quot; target=&quot;_blank&quot;&gt;Tabakat e Nasiri&lt;/a&gt;
    &lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-06-26T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/who-destroyed-nalanda-university</link>
<guid isPermaLink="true">https://randomwits.com/blog/who-destroyed-nalanda-university</guid>
</item>
<item>
  <title>Issuelink With Jira</title>
  <description>&lt;p&gt;Issue Links in Jira allow you to create meaningful relationships between different issues. These links help in maintaining traceability and provide a clear context for related work items.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Issue Links in Jira allow you to create meaningful relationships between different issues. These links help in maintaining traceability and provide a clear context for related work items.&lt;/p&gt;
    &lt;p&gt;Before creating a link, it&apos;s important to know what types of links are available in your Jira instance. You can retrieve this information using the following API endpoint:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET https://your-jira-instance.atlassian.net/rest/api/3/issueLinkType
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This request will return a list of all available issue link types. The response will include entries like:&lt;/p&gt;
    &lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;issueLinkTypes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Relates&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;inward&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;relates to&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;outward&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;relates to&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Report&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;inward&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;is report of&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;outward&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;has report&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;types&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;For linking a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Test Execution Report&lt;/code&gt; to a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Test Plan&lt;/code&gt;, the &quot;Report&quot; link type is particularly relevant.&lt;/p&gt;
    &lt;p&gt;Once you&apos;ve identified the appropriate link type, you can create the link between your Test Execution Report and Test Plan. Here&apos;s a Groovy script that demonstrates how to do this:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    def linkIssueToTestPlan&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;linkType, issueKey, testPlanKey&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    def issueLink &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://your-jira-instance.atlassian.net/rest/api/3/issueLink&quot;&lt;/span&gt;
    def payload &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&quot;{
    &quot;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;: {
    &quot;&lt;/span&gt;name&lt;span class=&quot;s2&quot;&gt;&quot;: &quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$linkType&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;
    },
    &quot;&lt;/span&gt;inwardIssue&lt;span class=&quot;s2&quot;&gt;&quot;: {
    &quot;&lt;/span&gt;key&lt;span class=&quot;s2&quot;&gt;&quot;: &quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$testPlanKey&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;
    },
    &quot;&lt;/span&gt;outwardIssue&lt;span class=&quot;s2&quot;&gt;&quot;: {
    &quot;&lt;/span&gt;key&lt;span class=&quot;s2&quot;&gt;&quot;: &quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$issueKey&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;
    }
    }&quot;&quot;&quot;&lt;/span&gt;
    try &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    def response &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; sh&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;script: &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&quot;
    curl -s -u &quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\$&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;JIRA_USER&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;:&lt;span class=&quot;se&quot;&gt;\$&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;JIRA_TOKEN&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
    -X POST &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
    -H &quot;&lt;/span&gt;Content-Type: application/json&lt;span class=&quot;s2&quot;&gt;&quot; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
    &quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;issueLink&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
    -d &apos;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;JsonOutput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.toJson(payload)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&apos;
    &quot;&quot;&quot;&lt;/span&gt;, returnStdout: &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;.trim&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    println &lt;span class=&quot;s2&quot;&gt;&quot;Link created successfully: &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; catch&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    error&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Error occurred while linking issue to test plan: &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.getMessage()&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2024-06-26T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/issuelink-with-jira</link>
<guid isPermaLink="true">https://randomwits.com/blog/issuelink-with-jira</guid>
</item>
<item>
  <title>Weekly Logs from June 24 to 30, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from from June 24 to 30, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A201:T213?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-06-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-06-24-30</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-06-24-30</guid>
</item>
<item>
  <title>Whoosh train from Jakarta to Bandung</title>
  <description>&lt;p&gt;Whoosh is Indonesia&apos;s first bullet train, zipping between Jakarta and Bandung. This project came to life thanks to China outbidding Japan in a tight race.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Whoosh is Indonesia&apos;s first bullet train, zipping between Jakarta and Bandung. This project came to life thanks to China outbidding Japan in a tight race.&lt;/p&gt;
    &lt;p&gt;You can grab your ticket &lt;a href=&quot;https://ticket.kcic.co.id/webTrade/#/home/index&quot;&gt;online&lt;/a&gt; or swing by the station to pick one up in person. Heads up, though: seats can fill up fast, so booking ahead is smart. Oh, and don&apos;t forget your passport – you&apos;ll need it to buy your ticket. Also, Jakarta traffic can be a nightmare, so plan to get to the station at least 30 minutes before your train leaves.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://miro.medium.com/v2/resize:fit:1400/format:webp/1*X4VNdIMzhC2Pnd5Kq1Yrgw.jpeg&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/nESuAG2_i_s?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/nESuAG2_i_s?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/nESuAG2_i_s/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Whoosh in Jakarta&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2024-06-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/whoosh-train-jakarta-bandung</link>
<guid isPermaLink="true">https://randomwits.com/blog/whoosh-train-jakarta-bandung</guid>
</item>
<item>
  <title>Food Safari in Indonesia</title>
  <description>&lt;p&gt;Tale of my food adventures.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;food&quot; class=&quot;album&quot;&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;br /&gt;&lt;span class=&quot;image-text&quot;&gt;Chicken sate lilit. Didn&apos;t like it too much&lt;/span&gt;
    &lt;span class=&quot;cl fa fa-thumbs-down checked&quot;&gt;&lt;/span&gt;&lt;br /&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://miro.medium.com/v2/resize:fit:1400/format:webp/1*GH0JX3MsZwzJhEng4pCqww.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://miro.medium.com/v2/resize:fit:600/format:webp/1*GH0JX3MsZwzJhEng4pCqww.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;br /&gt;&lt;span class=&quot;image-text&quot;&gt;Lontong Sayur Kari. One of my favourite dish in Bandung&lt;/span&gt;
    &lt;span class=&quot;cl fa fa-thumbs-up checked&quot;&gt;&lt;/span&gt;&lt;br /&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://miro.medium.com/v2/resize:fit:1400/format:webp/1*xkVS2BGmy7HxYEtM-JUf-w.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://miro.medium.com/v2/resize:fit:600/format:webp/1*xkVS2BGmy7HxYEtM-JUf-w.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;br /&gt;&lt;span class=&quot;image-text&quot;&gt;Loved avacado drink without sugar at Bali airport&lt;/span&gt;
    &lt;span class=&quot;cl fa fa-thumbs-up checked&quot;&gt;&lt;/span&gt;&lt;br /&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://miro.medium.com/v2/resize:fit:1400/format:webp/1*YlEpODKqoR3oisNXe5Yc0Q.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://miro.medium.com/v2/resize:fit:600/format:webp/1*YlEpODKqoR3oisNXe5Yc0Q.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;br /&gt;&lt;span class=&quot;image-text&quot;&gt;Fried banana was más o menos&lt;/span&gt;
    &lt;span class=&quot;cl fa fa-meh checked&quot;&gt;&lt;/span&gt; &lt;br /&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://miro.medium.com/v2/resize:fit:1400/format:webp/1*CWIGRogzSLPZe0pDoSfAQw.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://miro.medium.com/v2/resize:fit:600/format:webp/1*CWIGRogzSLPZe0pDoSfAQw.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;a id=&quot;album-left&quot; href=&quot;#&quot;&gt;&amp;lsaquo;&lt;/a&gt;
    &lt;a id=&quot;album-right&quot; href=&quot;#&quot;&gt;&amp;rsaquo;&lt;/a&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-06-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/food-safari-in-indonesia</link>
<guid isPermaLink="true">https://randomwits.com/blog/food-safari-in-indonesia</guid>
</item>
<item>
  <title>Publish your Java Library to Maven Local Using Gradle</title>
  <description>&lt;p&gt;You can publish your Java libraries to the Maven Local repository, enabling developers to easily test and share their work within their local environment. Maven Local is a local repository on your machine that cache downloaded dependencies and stores your own project&apos;s artifacts (e.g. JAR files). This allows for faster builds and provide an easy way to share artifact across different projects without the need to publish them to a remote repository.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;You can publish your Java libraries to the Maven Local repository, enabling developers to easily test and share their work within their local environment. Maven Local is a local repository on your machine that cache downloaded dependencies and stores your own project&apos;s artifacts (e.g. JAR files). This allows for faster builds and provide an easy way to share artifact across different projects without the need to publish them to a remote repository.&lt;/p&gt;
    &lt;p&gt;Gradle, on the other hand, is an open-source build automation tool designed to be flexible enough to build almost any type of software. It uses a domain-specific language based on Groovy or Kotlin, making it more expressive and concise compared to XML-based build scripts used in Maven.&lt;/p&gt;
    &lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;
    &lt;p&gt;To begin, open your project&apos;s build.gradle file and ensure that the maven-publish plugin is applied. This plugin provides the capability to publish artifacts to Maven repositories. You can apply the plugin by adding the following line to your script:&lt;/p&gt;
    &lt;div class=&quot;language-groovy highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;plugins&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;maven-publish&apos;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next, you need to specify where you want to publish your artifacts. In this case, we&apos;ll be publishing to Maven Local. Add the following configuration to your build.gradle:&lt;/p&gt;
    &lt;div class=&quot;language-groovy highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;publishing&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;repositories&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;mavenLocal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Within the publishing block, you must also define the details of what you are publishing. This typically involves specifying the groupId, artifactId, and version of your library, along with the components to publish. Here&apos;s an example configuration:&lt;/p&gt;
    &lt;div class=&quot;language-groovy highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;publishing&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;publications&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;mavenJava&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MavenPublication&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;components&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;java&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;publishing&quot;&gt;Publishing&lt;/h2&gt;
    &lt;p&gt;With the configuration in place, you&apos;re now ready to publish your Java library to Maven Local. Open IntelliJ IDEA and navigate to the Gradle tool window on the right. Expand your project&apos;s tasks, and under the &quot;publishing&quot; category, you&apos;ll find the publishToMavenLocal task. Double-click this task to execute it.&lt;/p&gt;
    &lt;p&gt;Or you can publish using command line&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ ./gradlew publishToMavenLocal
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;verification&quot;&gt;Verification&lt;/h2&gt;
    &lt;p&gt;After the task completes, navigate to your local Maven repository to verify that your library has been published successfully. The default location on UNIX-based systems like macOS and Linux is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/Users/&amp;lt;YourUsername&amp;gt;/.m2/repository&lt;/code&gt;. On Windows, it&apos;s typically located at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Users\&amp;lt;YourUsername&amp;gt;\.m2\repository&lt;/code&gt;.&lt;/p&gt;
  </description>
  <pubDate>2024-06-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/publish-your-java-library-to-maven-local-using-gradle</link>
<guid isPermaLink="true">https://randomwits.com/blog/publish-your-java-library-to-maven-local-using-gradle</guid>
</item>
<item>
  <title>Weekly Logs from June 17 to 23, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from from June 17 to 23, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A188:T201?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-06-18T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-06-17-23</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-06-17-23</guid>
</item>
<item>
  <title>Rent a Scooter in Cozumel, Mexico</title>
  <description>&lt;p&gt;Cozumel, a jewel in the Caribbean Sea, is famed for its crystal-clear waters, vibrant coral reefs, and lush green landscapes. While this Mexican island offers a plethora of activities for the eager tourist, one of the best ways to explore its natural beauty and hidden gems is by renting a scooter.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Cozumel, a jewel in the Caribbean Sea, is famed for its crystal-clear waters, vibrant coral reefs, and lush green landscapes. While this Mexican island offers a plethora of activities for the eager tourist, one of the best ways to explore its natural beauty and hidden gems is by renting a scooter.&lt;/p&gt;
    &lt;p&gt;Upon arrival from the ferry, you might be tempted to rent a scooter from the first vendor you see near the ferry terminal. My advice? Resist the urge. These spots often come with a higher price tag and a crowd of touts looking to capitalize on freshly-arrived tourists. Instead, take a leisurely walk or a short cab ride further into the island, where numerous rental shops offer more competitive rates.&lt;/p&gt;
    &lt;p&gt;My initial offer for a scooter rental was 500 pesos until 7 PM. However, with a bit of haggling, I managed to secure a 24-hour rental for 450 Mexican Pesos. Based on my experience, and with a bit of persistence, you might be able to push that price down to 400 Pesos or even lower.&lt;/p&gt;
    &lt;p&gt;One of the perks of your rental will be receiving a scooter with a full tank. From my journey around the island, which covered most of the accessible roads, I discovered that only half a tank was necessary for a full day’s adventure. Keep in mind, though, you&apos;ll need to return the scooter with a full tank. This is standard practice, so plan a stop at a gas station before returning your ride.&lt;/p&gt;
    &lt;p&gt;When it comes to insurance, rental shops will likely nudge you towards additional coverage, which could add another 200 to 300 Pesos to your bill. Based on my experience, if you plan to drive cautiously (which you should), opting for just the basic insurance should suffice. It’s an island, after all, where the pace of life—including traffic—is naturally slower.&lt;/p&gt;
    &lt;p&gt;I used my U.S. license without any issues. However, make sure they return your license after copying it. There have been instances where travelers were asked to leave their license, a practice that’s unnecessary and can lead to complications. Always keep your documentation in your possession.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*HbElFlC61zepsThA2xWIYA.jpeg&quot; alt=&quot;Scooter&quot; style=&quot;max-width:100%; height:auto;&quot; align=&quot;center&quot; loading=&quot;lazy&quot; /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/LlsCUrdCKZs?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/LlsCUrdCKZs?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/LlsCUrdCKZs/hqdefault.jpg alt=&apos;LlsCUrdCKZs&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;LlsCUrdCKZs&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2024-05-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/rent-scooter-cozumel-mexico</link>
<guid isPermaLink="true">https://randomwits.com/blog/rent-scooter-cozumel-mexico</guid>
</item>
<item>
  <title>Lazy lizard in Cozumel, Mexico</title>
  <description>&lt;p&gt;How often do you come across a lizard so relaxed it seems almost lazy? After flying thousands of miles and encountering a variety of lizards, one sultry afternoon presented me with a particularly memorable moment. I spotted this cute fellow, quite literally, yawning away without a care in the world.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;How often do you come across a lizard so relaxed it seems almost lazy? After flying thousands of miles and encountering a variety of lizards, one sultry afternoon presented me with a particularly memorable moment. I spotted this cute fellow, quite literally, yawning away without a care in the world.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/6uaiy02qElg?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/6uaiy02qElg?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/6uaiy02qElg/hqdefault.jpg alt=&apos;6uaiy02qElg&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;6uaiy02qElg&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2024-05-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/lazy-lizard-in-cozumel-mexico</link>
<guid isPermaLink="true">https://randomwits.com/blog/lazy-lizard-in-cozumel-mexico</guid>
</item>
<item>
  <title>Best Restaurant in Cozumel: Restaurante El Cedral</title>
  <description>&lt;p&gt;During my week-long stay in Cozumel, I explored numerous restaurants. However, it was not until the last day that I discovered Restaurante El Cedral, leaving me with the sole regret of not finding it sooner.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;f9581a45-c107-44bf-b8f2-7c54935206ff&quot; style=&quot;width:100%;height:568px;&quot; class=&quot; jekyll-map&quot;&gt;&lt;/div&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    jekyllMaps.register(
    &apos;f9581a45-c107-44bf-b8f2-7c54935206ff&apos;,
    [{&quot;latitude&quot;:20.5067,&quot;longitude&quot;:-86.9458,&quot;title&quot;:&quot;Best Restaurant in Cozumel: Restaurante El Cedral&quot;,&quot;icon&quot;:null,&quot;url&quot;:&quot;/blog/best-restaurant-in-cozumel-mexico&quot;,&quot;url_text&quot;:null,&quot;image&quot;:&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*oG9ecEdDA58VnUl8j7kymg.jpeg&quot;,&quot;popup_html&quot;:&quot;&quot;}],
    {&quot;baseUrl&quot;:&quot;/&quot;,&quot;useCluster&quot;:true,&quot;showMarker&quot;:true,&quot;showMarkerPopup&quot;:false,&quot;markerIcon&quot;:null,&quot;styles&quot;:&quot;[]&quot;,&quot;customZoom&quot;:15}
    );
    &lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;During my week-long stay in Cozumel, I explored numerous restaurants. However, it was not until the last day that I discovered Restaurante El Cedral, leaving me with the sole regret of not finding it sooner.&lt;/p&gt;
    &lt;h2 id=&quot;things-i-liked-about-this-restaurant&quot;&gt;Things I liked about this restaurant:&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Firstly, its location, far removed from the tourist hub and ferry terminal, resulted in a more affordable dining experience, with prices around 150 pesos.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Despite its small size, the restaurant was not crowded, which added to its charm.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;It gave complimentary water which was surprisingly lacking in other restaurants.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Food was delicious and host was nice.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;div id=&quot;cozumel&quot; class=&quot;album&quot;&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*oG9ecEdDA58VnUl8j7kymg.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*oG9ecEdDA58VnUl8j7kymg.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*zHIcD6Qd1dbv26hn9NSEnA.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*zHIcD6Qd1dbv26hn9NSEnA.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*bbUREvgmG4FMCEaM8Dz3nw.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*bbUREvgmG4FMCEaM8Dz3nw.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*CoAKkPVHIDQQaSlof550Yg.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*CoAKkPVHIDQQaSlof550Yg.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*RLIqVNyKcBJI5fAneMGebQ.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*RLIqVNyKcBJI5fAneMGebQ.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*2btNlCsG_uK-W0I1NO34Hg.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*2btNlCsG_uK-W0I1NO34Hg.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*7iyWC1XXnqwAqYVHr3I4Eg.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*7iyWC1XXnqwAqYVHr3I4Eg.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*LSmUUD82jXk85trqkEyjDA.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:668/format:webp/1*LSmUUD82jXk85trqkEyjDA.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;a id=&quot;album-left&quot; href=&quot;#&quot;&gt;&amp;lsaquo;&lt;/a&gt;
    &lt;a id=&quot;album-right&quot; href=&quot;#&quot;&gt;&amp;rsaquo;&lt;/a&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-05-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/best-restaurant-in-cozumel-mexico</link>
<guid isPermaLink="true">https://randomwits.com/blog/best-restaurant-in-cozumel-mexico</guid>
</item>
<item>
  <title>Weekly Logs From May 6 to May 12, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from May 6 to May 12, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from May 6 to May 12, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A174:T187?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-05-09T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-05-06-12</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-05-06-12</guid>
</item>
<item>
  <title>Weekly Logs From Apr 22 to 28</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Apr 22 to Apr 28, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Apr 22 to Apr 28, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;southwest-airline&quot;&gt;Southwest Airline&lt;/h2&gt;
    &lt;p&gt;This was my first time using Wouthwest airline. It had open seating which means that there are no seat number assigned to you in the boarding pass. Only the division is by group number.&lt;/p&gt;
    &lt;p&gt;I boarded my flight from Raleigh to Cancun via Baltimore. Luckily it was not crowded and I enjoyed open seating which meant I got to pick my own seat. However I am not sure if this is a good option for a crowded flights.&lt;/p&gt;
  </description>
  <pubDate>2024-04-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-04-22-28</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-04-22-28</guid>
</item>
<item>
  <title>Weekly Logs From Apr 8 to Apr 14, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Apr 8 to Apr 14, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Apr 8 to Apr 14, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A146:T159?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;an-honest-beggar&quot;&gt;An Honest Beggar&lt;/h2&gt;
    &lt;p&gt;On my way home from work, I caught sight of a beggar displaying a unique placard. At least he was being honest.&lt;/p&gt;
    &lt;div id=&quot;beggar&quot; class=&quot;album&quot;&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*eOSuTgVoAab5dYCNJLSVeQ.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*eOSuTgVoAab5dYCNJLSVeQ.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*NxauLHmElGpr0tz4j7CvAw.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*NxauLHmElGpr0tz4j7CvAw.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;a id=&quot;album-left&quot; href=&quot;#&quot;&gt;&amp;lsaquo;&lt;/a&gt;
    &lt;a id=&quot;album-right&quot; href=&quot;#&quot;&gt;&amp;rsaquo;&lt;/a&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-04-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-04-08-14</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-04-08-14</guid>
</item>
<item>
  <title>How to call Ebay Real live Person Customer Service</title>
  <description>&lt;p&gt;I bought a ping pong table on eBay, only to endure an agonizing wait of over a month. When it finally arrived, the table bore no resemblance to the one advertised in the pictures. Eager to fast-track my return, I discovered that contacting eBay directly via phone was not an option. The customer service numbers provided no straightforward path to speak with a live representative. Engaging directly with a person often speeds up resolution processes, but finding that human connection proved to be a challenge in this case.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I bought a ping pong table on eBay, only to endure an agonizing wait of over a month. When it finally arrived, the table bore no resemblance to the one advertised in the pictures. Eager to fast-track my return, I discovered that contacting eBay directly via phone was not an option. The customer service numbers provided no straightforward path to speak with a live representative. Engaging directly with a person often speeds up resolution processes, but finding that human connection proved to be a challenge in this case.&lt;/p&gt;
    &lt;p&gt;So here&apos;s a trick to get to talk to a person in ebay custoemr care.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;First go to &lt;a href=&quot;https://www.ebay.com/help/home&quot;&gt;help&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Scroll to the bottom, and click on contact us&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2400/1*xeSAsvS5f3BmMjhlvUGBIg.png&quot; alt=&quot;Contact Us&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;ol&gt;
    &lt;li&gt;Select anything under &quot;Contact Us&lt;/li&gt;
    &lt;/ol&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2400/1*GtQhBZMPd1CxhrJ7Z9CW4w.png&quot; alt=&quot;Contact Us&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2400/1*KT5jrKbDcDCQKMacrlOOnw.png&quot; alt=&quot;Contact Us&quot;&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;ol&gt;
    &lt;li&gt;Next on the left side , click on &lt;strong&gt;Chat with our automated assistant&lt;/strong&gt;&lt;/li&gt;
    &lt;/ol&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2400/1*Iefzq1CD5saBXe4kfVU8hA.png&quot; alt=&quot;Contact Us&quot;&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;ol&gt;
    &lt;li&gt;Type, &lt;strong&gt;contact an agent&lt;/strong&gt;&lt;/li&gt;
    &lt;/ol&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2400/1*kDMyHE5JSR62NuG5Wz1EKA.png&quot; &amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2024-04-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/how-to-call-ebay-real-live-person-customer-service</link>
<guid isPermaLink="true">https://randomwits.com/blog/how-to-call-ebay-real-live-person-customer-service</guid>
</item>
<item>
  <title>Weekly Logs From Apr 1 to Apr 7, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Apr 1 to Apr 7, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Apr 1 to Apr 7, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A132:T145?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;magnesium-supplements&quot;&gt;Magnesium supplements&lt;/h2&gt;
    &lt;p&gt;I usually take two supplements -&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;B12 on empty stomach&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;D3 with food&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Recently I cam across multiple tweets extolling magnesium supplements&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Which foods are rich in magnesium? Like nuts and seeds like almonds, cashews. Green vegetables like spinach, kale, etc. Fruits like avacado, banana, etc. Fish like salmon, etc&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Can there be an overdose of magnesium? In healthy individuals, an overdose of magnesium from dietary sources is rare because the kidneys efficiently eliminate any excess amounts. However, it&apos;s essential to approach magnesium supplements with caution, as they can lead to adverse effects if consumed in excessively high quantities, especially in individuals with kidney dysfunction.&lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Lastly, do we need supplments if we dont have a deficiency? There&apos;s a huge market for supplements so I&apos;m skeptical in taking any supplements that is touted as a wonder pill. If people lost weight just by drinking green tea or cured baldness by just applying rosemary / mustard / bla oil, there would be no overweight or bald person in the entire world?&lt;/p&gt;
  </description>
  <pubDate>2024-04-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-04-01-07</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-04-01-07</guid>
</item>
<item>
  <title>Unsolicited Advice - The noise of Well Meaning Strangers</title>
  <description>&lt;p&gt;Consider the following scenario: You&apos;re sitting on a bus when a stranger initiates a conversation. &quot;What do you do for a living?&quot; he asks. At this time, I was unemployed. &quot;I&apos;m currently in between jobs,&quot; I responded.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Consider the following scenario: You&apos;re sitting on a bus when a stranger initiates a conversation. &quot;What do you do for a living?&quot; he asks. At this time, I was unemployed. &quot;I&apos;m currently in between jobs,&quot; I responded.&lt;/p&gt;
    &lt;p&gt;&quot;And for how long have you been seeking employment?&quot; he probed. I generally prefer not to share too much personal information, especially with strangers. &quot;I might consider becoming a stock broker,&quot; I replied, attempting to lighten the mood.&lt;/p&gt;
    &lt;p&gt;Seizing the opportunity, the stranger launched into a lengthy critique about the pitfalls of the stock market. He argued that even the most skilled data scientists struggle to profit, suggesting that the system is fundamentally flawed and unnecessary.&lt;/p&gt;
    &lt;p&gt;Would this stranger be willing to pay for my lunch? &quot;Could you please pay for my lunch at the next stop?&quot; I requested, &quot;I forgot my wallet at home.&quot; His tone changed, and he said that he had to leave soon. Why was he not kind enough to pay for my lunch yet so gregarious a moment ago? Did this mean his advice was worth less than a meal? I began to wonder, why are people so eager to offer unsolicited advice?&lt;/p&gt;
    &lt;p&gt;It seems humans have an inherent tendency to give advice. This behaviour can be traced back to our evolutionary roots. As primates, we are hardwired for communication, and there is a certain satisfaction in imparting wisdom. However, when asked to part with our resources, our survival instincts kick in, reminding us of the importance of self-preservation. This dichotomy explains why individuals can be generous with advice but frugal with their wallets.&lt;/p&gt;
    &lt;p&gt;However, is advice without context truly valuable? Steve Jobs famously advocated for following one&apos;s dreams after he dropped out of college. Yet, this advice may not be universally applicable. Similarly, Elon Musk has stated that attending college is not necessary for acquiring knowledge. Nevertheless, job listings at his companies, such as Tesla and SpaceX, often require a degree.&lt;/p&gt;
    &lt;p&gt;Beware of generic advice. Many say that hard work leads to success, but if that were the case, a hardworking donkey would be the owner of the farm.&lt;/p&gt;
    &lt;p&gt;Seek advice from those who are accountable for their words. For instance, a doctor who prescribes medication can be held liable for mistakes. This form of advice is more reliable than that from a well-intentioned stranger shouting on the street.&lt;/p&gt;
    &lt;p&gt;Similarly, consider advice from those who have a vested interest in your success, such as a paid tennis coach or your parents.&lt;/p&gt;
    &lt;p&gt;In a world filled with noise, it&apos;s crucial to seek advice that carries weight, advice backed by accountability, expertise, and genuine concern.&lt;/p&gt;
  </description>
  <pubDate>2024-03-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/unsolicited-advice</link>
<guid isPermaLink="true">https://randomwits.com/blog/unsolicited-advice</guid>
</item>
<item>
  <title>Optimizing SQL Queries - Understanding and Refreshing Materialized Views</title>
  <description>&lt;p&gt;When to use a materialized view? And how does it perform against a normal view. Benchmarking using docker.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When to use a materialized view? And how does it perform against a normal view. Benchmarking using docker.&lt;/p&gt;
    &lt;h2 id=&quot;whats-a-view&quot;&gt;What&apos;s a view?&lt;/h2&gt;
    &lt;p&gt;A view is a virtual table based on a result-set of a SQL query. It&apos;s not physically materialized, the query is run every time the view is referenced.&lt;/p&gt;
    &lt;h2 id=&quot;materialized-view&quot;&gt;Materialized view&lt;/h2&gt;
    &lt;p&gt;A materialized view is a physical table that contains the result of a query. It&apos;s used when the query is complex and involves large amounts of data, making it unfeasible to execute each time. Instead, results are pre-computed and stored in the view.&lt;/p&gt;
    &lt;h2 id=&quot;stale-data&quot;&gt;Stale data&lt;/h2&gt;
    &lt;p&gt;Data can become stale after a time in a materialized view. Since the data is pre-computed and stored, it can get out of sync with the underlying base tables if those tables are updated.&lt;/p&gt;
    &lt;p&gt;The concurrency option is more resource-intensive and might not be suitable for all scenarios.&lt;/p&gt;
    &lt;h2 id=&quot;solutions&quot;&gt;Solutions&lt;/h2&gt;
    &lt;h3 id=&quot;traditional-refresh&quot;&gt;Traditional refresh&lt;/h3&gt;
    &lt;p&gt;Drop the old version of the view and replace it with new one. This can cause issues as it can block other queries from reading the view during the refresh process.&lt;/p&gt;
    &lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;refresh&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;materialized&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;view&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;view_name&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;concurrent-refresh&quot;&gt;Concurrent refresh&lt;/h3&gt;
    &lt;p&gt;Queries can read the view even when the view is getting refreshed as the update can be performed concurrently in the background. In order to use this approach, a unique index must be added to the materialized view. This unique index acts as a lookup table while the table is refreshing.&lt;/p&gt;
    &lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;unique&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;my_unique_index&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;programs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;program_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;refresh&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;materialized&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;view&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;concurrently&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;view_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;benchmarking-with-docker&quot;&gt;Benchmarking with Docker&lt;/h2&gt;
    &lt;h3 id=&quot;dockerfile&quot;&gt;Dockerfile&lt;/h3&gt;
    &lt;div class=&quot;language-dockerfile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; postgres:latest&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /data/postgres
    &lt;span class=&quot;k&quot;&gt;COPY&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; schema.sql /docker-entrypoint-initdb.d/&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;EXPOSE&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; 5432&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;ENTRYPOINT&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; [&quot;docker-entrypoint.sh&quot;, &quot;postgres&quot;]&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dockerfile&lt;/code&gt; defines a container based on official PostgreSQL image. It creates a directory for persistent data and copies a schema file (containing the materialized view definition and sample data) to the initialization directory, ensuring the schema is applied when the container starts.&lt;/p&gt;
    &lt;h3 id=&quot;schemasql&quot;&gt;schema.sql&lt;/h3&gt;
    &lt;p&gt;This schema creates a courses table and a programs materialized view contianing the count of courses grouped by ID. Additionally, it defines a unique index on the course_id column of the materialized view, which is necessary for concurrent refresh.&lt;/p&gt;
    &lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;courses&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;course_id&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;serial&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;primary&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;course_name&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;materialized&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;view&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;programs&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; 
    &lt;span class=&quot;k&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;course_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;program_count&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;courses&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;c&lt;/span&gt; 
    &lt;span class=&quot;k&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;by&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;course_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;unique&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;idx_programs&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;programs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;course_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;deploy-postgres-container&quot;&gt;Deploy postgres container&lt;/h3&gt;
    &lt;p&gt;Build and run the container using docker-&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker build &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; my_postgres_image &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker run &lt;span class=&quot;nt&quot;&gt;--name&lt;/span&gt; my_postgres_container &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 5432:5432 &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;password my_postgres_image
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;install-dependencies&quot;&gt;Install dependencies&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;python3 &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; venv myenv 
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; myenv/bin/activate
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;psycopg2-binary
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;python benchmark.py
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;python-script&quot;&gt;Python script&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/2089f8af1ba720e91e29e206a28f7430.js?file=benchmark.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;result&quot;&gt;Result&lt;/h3&gt;
    &lt;p&gt;Traditional refresh are usually faster than concurrent refresh. However traditional refresh take longer time for queries due to lock mechanism.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;***Traditional Refresh***
    Refresh time:  1.312699794769287
    Fetch time:  1.4531309604644775
    ***Concurrent Refresh***
    Refresh time:  6.476271152496338
    Fetch time:  1.2998201847076416
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2024-03-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/refresh-materialized-views-concurrently</link>
<guid isPermaLink="true">https://randomwits.com/blog/refresh-materialized-views-concurrently</guid>
</item>
<item>
  <title>Resolving chromedrive verification error in MacOS</title>
  <description>&lt;p&gt;The MacOS Catalina (v 10.15.3) has a security feature known as Gatekeeper, which verifies downloaded applications. When you encounter the error: &quot;chromedriver&quot; cannot be opened because the developer cannot be verified, it&apos;s due to Gatekeeper restricting the execution of the chromedriver executable. This is because it doesn&apos;t recognize the developer, which is a common issue for developers and testers who use chromedriver for browser automation.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;The MacOS Catalina (v 10.15.3) has a security feature known as Gatekeeper, which verifies downloaded applications. When you encounter the error: &quot;chromedriver&quot; cannot be opened because the developer cannot be verified, it&apos;s due to Gatekeeper restricting the execution of the chromedriver executable. This is because it doesn&apos;t recognize the developer, which is a common issue for developers and testers who use chromedriver for browser automation.&lt;/p&gt;
    &lt;p&gt;Chromedriver is a separate executable that WebDriver uses to control Chrome. It&apos;s part of the Selenium project, which is a framework for conducting automated testing of web applications. WebDriver is an open standard for automating browsers, providing a way to interact with them in a way that mimics a human user.&lt;/p&gt;
    &lt;p&gt;Error while runing the chromedriver :&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Error: &quot;chromedriver&quot; cannot be opened because the developer cannot be verified
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can manually override this security feature for the chromedriver executable.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;xattr &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; com.apple.quarantine &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;which chromedriver&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The command uses xattr, a utility for viewing and modifying extended attributes of file system objects. Extended attributes are metadata components that can be unique to specific files and applications. In this case, xattr -d is used to delete a specific extended attribute.&lt;/p&gt;
    &lt;p&gt;The attribute in question is com.apple.quarantine. This attribute is assigned to files downloaded from the internet or received via AirDrop to indicate that the file might be unsafe.&lt;/p&gt;
    &lt;p&gt;The $(which chromedriver) part of the command is a command substitution that finds the path of the chromedriver executable. which is a command-line utility that shows the full path of shell commands.&lt;/p&gt;
    &lt;p&gt;By deleting the com.apple.quarantine attribute from the chromedriver executable, you&apos;re effectively telling MacOS that the chromedriver is safe, and it can be run without Gatekeeper&apos;s intervention. That&apos;s why the error &quot;chromedriver&quot; cannot be opened because the developer cannot be verified is resolved after running this command.&lt;/p&gt;
  </description>
  <pubDate>2024-03-03T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/resolving-chromedrive-verification-error-macos</link>
<guid isPermaLink="true">https://randomwits.com/blog/resolving-chromedrive-verification-error-macos</guid>
</item>
<item>
  <title>Disabling Enabling Globalprotect Vpn On Macos</title>
  <description>&lt;p&gt;GlobalProtect is a security platform that extends the capabilities of a firewall to end-user devices. It is a product of Palo Alto Networks and it provides a network security infrastructure that prevents cyber threats regardless of what device is being used and from where. However, there might be instances where you would want to stop or disable this service. This can be done by modifying a specific system file, known as the LaunchAgent property list (plist) for GlobalProtect.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;GlobalProtect is a security platform that extends the capabilities of a firewall to end-user devices. It is a product of Palo Alto Networks and it provides a network security infrastructure that prevents cyber threats regardless of what device is being used and from where. However, there might be instances where you would want to stop or disable this service. This can be done by modifying a specific system file, known as the LaunchAgent property list (plist) for GlobalProtect.&lt;/p&gt;
    &lt;p&gt;The LaunchAgent plist is a type of file used by macOS systems to control the behavior of various services and applications. These files are written in XML and dictate when and how certain apps or services are launched, among other settings. In the case of GlobalProtect, the plist file of interest is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;com.paloaltonetworks.gp.pangpa.plist&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;Open you terminal and type&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/535f32457db9bd385482c2d0c704ffc5.js?file=file1.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;If you wish to enable it again, type&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/535f32457db9bd385482c2d0c704ffc5.js?file=file2.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Also you can disable it at startup:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/535f32457db9bd385482c2d0c704ffc5.js?file=file3.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;To revert the changes and enable the GlobalProtect service again, the following command can be used:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/535f32457db9bd385482c2d0c704ffc5.js?file=file4.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Sometimes , &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Content Filter&lt;/code&gt; is enabled which restricts access to internet despite disabling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Global Protect&lt;/code&gt;. You can remove this file and restart your computer (This file is autogenerated everytime global protect runs)&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/535f32457db9bd385482c2d0c704ffc5.js?file=file5.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2024-03-03T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/disabling-enabling-globalprotect-vpn-on-macos</link>
<guid isPermaLink="true">https://randomwits.com/blog/disabling-enabling-globalprotect-vpn-on-macos</guid>
</item>
<item>
  <title>Weekly logs from Feb 26 to March 3, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Feb 26 to Mar 3, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Feb 26 to Mar 3, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A104:T117?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-02-26T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-02-03-26-03</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-02-03-26-03</guid>
</item>
<item>
  <title>Weekly Logs from Feb 19 to Feb 25</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Feb 19 to Feb 25, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Feb 19 to Feb 25, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A90:T103?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;tom-and-jerry&quot;&gt;Tom and Jerry&lt;/h2&gt;
    &lt;p&gt;Tom and Jerry producer Fred Quimbly, though not involved in the creative process, took all credit for the cartoon&apos;s success. Each time the cartoon won the Academy Award for Animated Short Film, he accepted it without inviting the animators, William Hanna and Joseph Barbera.&lt;/p&gt;
    &lt;p&gt;This reminds me of quote by Calvin Coolidge-&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Nothing in this world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. The slogan &apos;Press On!&apos; has solved and always will solve the problems of the human race.&lt;/p&gt;
    &lt;/blockquote&gt;
  </description>
  <pubDate>2024-02-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-02-19-25</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-02-19-25</guid>
</item>
<item>
  <title>Handling File Operations in Jenkins Pipeline</title>
  <description>&lt;p&gt;Jenkins pipelines are a powerful tool for automating continuous integration and delivery workflows. However, when dealing with file operations in a Jenkins pipeline, developers often encounter a common pitfall related to file handling.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Jenkins pipelines are a powerful tool for automating continuous integration and delivery workflows. However, when dealing with file operations in a Jenkins pipeline, developers often encounter a common pitfall related to file handling.&lt;/p&gt;
    &lt;h3 id=&quot;understanding-the-pitfall-with-javaiofile&quot;&gt;Understanding the Pitfall with java.io.File&lt;/h3&gt;
    &lt;p&gt;In a Jenkins pipeline, the conventional way to handle file operations is to use java.io.File. However, this method operates on the file system of the JVM where the Groovy script is running, which is the master node in the case of a Jenkins pipeline. This means that when you use java.io.File, it refers to files on the master machine where Jenkins is running, not in the workspace of the slave machine where your job might be running. This discrepancy can lead to a FileNotFoundException.&lt;/p&gt;
    &lt;p&gt;For example, consider the following code snippet:&lt;/p&gt;
    &lt;div class=&quot;language-groovy highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;homeDir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${steps.WORKSPACE}&quot;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;settingsFile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;homeDir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;settings.gradle&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;In this example, if the job is running on a slave machine, the settings.gradle file will be looked for in the workspace of the master machine, not the slave machine, potentially resulting in a FileNotFoundException.&lt;/p&gt;
    &lt;h3 id=&quot;use-readfile-instead&quot;&gt;Use readFile Instead&lt;/h3&gt;
    &lt;p&gt;The Jenkins pipeline provides a global function called readFile. Unlike java.io.File, the readFile function operates on the file system of the agent node where the job is running. This means it can access files in the workspace irrespective of whether the job runs on the master or a slave node.&lt;/p&gt;
    &lt;p&gt;Here&apos;s how you can use readFile:&lt;/p&gt;
    &lt;div class=&quot;language-groovy highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;homeDir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${steps.WORKSPACE}&quot;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;settingsFilePath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${homeDir}/settings.gradle&quot;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;settingsFile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;readFile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;settingsFilePath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;In this example, readFile will correctly locate the settings.gradle file in the workspace of the machine where the job is running, avoiding the FileNotFoundException.&lt;/p&gt;
  </description>
  <pubDate>2024-02-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/handling-file-operations-in-jenkins-pipeline</link>
<guid isPermaLink="true">https://randomwits.com/blog/handling-file-operations-in-jenkins-pipeline</guid>
</item>
<item>
  <title>Weekly Logs from Feb 12 to Feb 18</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Feb 12 to Feb 18, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Feb 12 to Feb 18, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A77:T89?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;notes&quot;&gt;Notes&lt;/h2&gt;
    &lt;h3 id=&quot;jekyll-build-error&quot;&gt;Jekyll Build Error&lt;/h3&gt;
    &lt;p&gt;I was building my jekyll site when I encountered this error&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ JEKYLL_ENV=production bundle exec jekyll build
    bundler: failed to load command: jekyll (/Users/USER/.gem/ruby/3.1.2/bin/jekyll)
    /Users/USER/.gem/ruby/3.1.2/gems/addressable-2.8.6/lib/addressable/uri.rb:2344:in `to_s&apos;: Cannot assemble URI string with ambiguous path: &apos;:&apos; (Addressable::URI::InvalidURIError)
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;I tried to check if there was issue with the gems installed in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Gemfile&lt;/code&gt;. The issue turned out to be rather silly. On my terminal , there was a file with filename as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:&lt;/code&gt;. Colons as filename are prohibited in the Windows, as they conflict with drive letter naming convention (C:). However there&apos;s no such restriction on Linux/Mac.&lt;/p&gt;
  </description>
  <pubDate>2024-02-12T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-02-12-18</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-02-12-18</guid>
</item>
<item>
  <title>North Carolina Museum of Natural Sciences</title>
  <description>&lt;p&gt;I went to North Carolina Museum of Natural Sciences on a damp morning with Richu and her mom. There is no entrance fee and the street parking was easy to find. I was particularly enamored with the fossils of dinosaurs and whales which are pretty humongous. There&apos;s also a cafe inside if you get tired from walking. Below are some of the highlights of my visit.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;8dc55799-2eab-4d97-bffe-06b82ae597ac&quot; style=&quot;width:100%;height:568px;&quot; class=&quot; jekyll-map&quot;&gt;&lt;/div&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    jekyllMaps.register(
    &apos;8dc55799-2eab-4d97-bffe-06b82ae597ac&apos;,
    [{&quot;latitude&quot;:35.7822,&quot;longitude&quot;:-78.6393,&quot;title&quot;:&quot;North Carolina Museum of Natural Sciences&quot;,&quot;icon&quot;:null,&quot;url&quot;:&quot;/blog/north-carolina-museum-of-natural-sciences&quot;,&quot;url_text&quot;:null,&quot;image&quot;:&quot;https://cdn-images-1.medium.com/v2/resize:fit:800/1*goRpzwmqRR3Hevhv6KnNlQ.jpeg&quot;,&quot;popup_html&quot;:&quot;&quot;}],
    {&quot;baseUrl&quot;:&quot;/&quot;,&quot;useCluster&quot;:true,&quot;showMarker&quot;:true,&quot;showMarkerPopup&quot;:false,&quot;markerIcon&quot;:null,&quot;styles&quot;:&quot;[]&quot;,&quot;customZoom&quot;:15}
    );
    &lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;I went to North Carolina Museum of Natural Sciences on a damp morning with Richu and her mom. There is no entrance fee and the street parking was easy to find. I was particularly enamored with the fossils of dinosaurs and whales which are pretty humongous. There&apos;s also a cafe inside if you get tired from walking. Below are some of the highlights of my visit.&lt;br /&gt;&lt;/p&gt;
    &lt;div id=&quot;museum&quot; class=&quot;album&quot;&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*9bc3CTmkJpa5LqFgR9pEdw.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*9bc3CTmkJpa5LqFgR9pEdw.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*mk5xbWBa88B1dcHfdxYa1g.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*mk5xbWBa88B1dcHfdxYa1g.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*yAKJXclZDHOcuA-hqGsElA.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*yAKJXclZDHOcuA-hqGsElA.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*awoqkGFXzXy7hmXjBXr1Kw.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*awoqkGFXzXy7hmXjBXr1Kw.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*Yg7WsvBbZZVYd_26mP8udA.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*Yg7WsvBbZZVYd_26mP8udA.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*oT-IFG_4nS_hMK-mbuB8_g.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*oT-IFG_4nS_hMK-mbuB8_g.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*4oWOuW5rmcQzaJz4O8TRMg.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*4oWOuW5rmcQzaJz4O8TRMg.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*69dzALU3XrAFrZohyg4zvg.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*69dzALU3XrAFrZohyg4zvg.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*yzVBW8CnW_6ncv9HZVHj6A.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*yzVBW8CnW_6ncv9HZVHj6A.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*p0NBLexR_Mc_w1YG1u9i5Q.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*p0NBLexR_Mc_w1YG1u9i5Q.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*goRpzwmqRR3Hevhv6KnNlQ.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*goRpzwmqRR3Hevhv6KnNlQ.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*vj67_k7y2VhcbZSH7IGlYw.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*vj67_k7y2VhcbZSH7IGlYw.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*KUH6OgBraSZ9_qW0n5-X-Q.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*KUH6OgBraSZ9_qW0n5-X-Q.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;album-item&quot;&gt;
    &lt;a data-lightbox=&quot;gallery&quot; href=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*_bQRF9fPcTEle_GgalyMKQ.jpeg&quot; class=&quot;album-image&quot; title=&quot;&quot;&gt;
    &lt;br /&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:200/1*_bQRF9fPcTEle_GgalyMKQ.jpeg&quot; style=&quot;height: 200px; object-fit: cover; width: auto;&quot; /&gt;&lt;br /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
    &lt;a id=&quot;album-left&quot; href=&quot;#&quot;&gt;&amp;lsaquo;&lt;/a&gt;
    &lt;a id=&quot;album-right&quot; href=&quot;#&quot;&gt;&amp;rsaquo;&lt;/a&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; src=&quot;https://drive.google.com/file/d/10_QpTw52_-19jaJVJAjkQ45xMmKsLPm3/preview&quot; width=&quot;640&quot; height=&quot;480&quot; loading=&quot;lazy&quot;&gt;&lt;/iframe&gt;
  </description>
  <pubDate>2024-02-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/north-carolina-museum-of-natural-sciences</link>
<guid isPermaLink="true">https://randomwits.com/blog/north-carolina-museum-of-natural-sciences</guid>
</item>
<item>
  <title>Weekly Logs from Feb 5 to Feb 11</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Feb 5 to Feb 11, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Feb 5 to Feb 11, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A64:T76?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;notes&quot;&gt;Notes&lt;/h2&gt;
    &lt;h3 id=&quot;gradle-cache&quot;&gt;Gradle Cache&lt;/h3&gt;
    &lt;p&gt;I was testing if the gradle cache pod I deployed was successful or not. So a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt; is convenient way to test different endpoints&lt;/p&gt;
    &lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ping:
    @echo &quot;Pinging $(url):5071&quot;
    @curl -sw &apos;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&apos; --fail-with-body --show-error
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;And then you can test it like&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make ping &lt;span class=&quot;nv&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http://localhost
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make ping &lt;span class=&quot;nv&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http://some/server
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;gradle&quot;&gt;Gradle&lt;/h3&gt;
    &lt;p&gt;To locate your Gradle installation, you can use the where command:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;where gradle
    /opt/homebrew/bin/gradle
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Inspect the symbolic link to find the current Gradle location:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; /opt/homebrew/bin/gradle 
    /opt/homebrew/bin/gradle -&amp;gt; ../Cellar/gradle/8.5/bin/gradle
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To manually update Gradle, download the new Gradle version and move it to the location found above. For example, if /path/to/new/gradle is the location of your downloaded Gradle folder:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mv&lt;/span&gt; /path/to/new/gradle ../Cellar/gradle/8.5/bin/gradle
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;heic-to-jpg&quot;&gt;HEIC to JPG&lt;/h3&gt;
    &lt;p&gt;On Mac you can convert heic images to jpg format&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;imagemagick
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;magick convert foo.HEIC foo.jpg
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2024-02-05T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-02-05-11</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-02-05-11</guid>
</item>
<item>
  <title>Weekly Logs from Jan 29 to Feb 4, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Jan 29 to Feb 4, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my weekly logs from Jan 29 to Feb 4, 2024.&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A51:T63?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;jan-31-2024&quot;&gt;Jan 31, 2024&lt;/h2&gt;
    &lt;p&gt;At a casual lunch, my colleague told me an intriguing story of &quot;Typhoid Mary&quot;. Mary Mallon was an Irish immigrant who worked as cook in the United States during the early 20th century. Many of those who ate her meals, fell ill yet she remained unaffected.&lt;/p&gt;
    &lt;p&gt;Mary was a carrier of Salmonella typhi, the bacterium responsible for typhoid fever, hence the moniker &quot;Typhoid Mary.&quot; She was a asymptomatic carrier. This means that although she carried the bacteria and could transmit it to others, she did not exhibit any symptoms of the disease herself.&lt;/p&gt;
    &lt;p&gt;Mary Mallon&apos;s saga took a dramatic turn when she was arrested and quarantined by the health authorities. However, she contested her confinement and was eventually released on the condition that she would not return to her previous profession. Unfortunately, Mary violated this agreement and resumed her work as a cook, which led to further outbreaks of typhoid fever.&lt;/p&gt;
    &lt;p&gt;Why do some people are asymptomatic and some are not? Even with SARS-CoV-2, some people remained asymptomatic.&lt;/p&gt;
    &lt;h2 id=&quot;feb-2-2024&quot;&gt;Feb 2, 2024&lt;/h2&gt;
    &lt;p&gt;What&apos;s the difference between virtual machine and docker?&lt;/p&gt;
    &lt;p&gt;Virtual Machine includes a full fledged Operating System (OS) that runs on a software layer that manages resources called &lt;strong&gt;hypervisor&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt;Docker on other hand, share the host machine&apos;s kernel but operate in isolated user space. Docker relies on on lightweight images that include only the necessary components, resulting in faster deployment and more efficient utilization.&lt;/p&gt;
    &lt;h2 id=&quot;feb-3-2024&quot;&gt;Feb 3, 2024&lt;/h2&gt;
    &lt;h3 id=&quot;spanish&quot;&gt;Spanish&lt;/h3&gt;
    &lt;p&gt;If I say,&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tu me partiste el corozon
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;It means you broke my heart. But If I have to say like&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tu me rompiste me vaso
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&quot;Rompiste&quot; is specifically used for breaking in the sense of shattering or damaging something, like a glass. On the other hand, &quot;partiste&quot; is more commonly used for breaking in an emotional or figurative sense, such as breaking someone&apos;s heart.&lt;/p&gt;
    &lt;h3 id=&quot;chromedriver&quot;&gt;Chromedriver&lt;/h3&gt;
    &lt;p&gt;I got this error today:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ERROR:root:Message: session not created: This version of ChromeDriver only supports Chrome version 114
    Current browser version is 121.0.6167.139 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Solution is to go to &lt;a href=&quot;https://googlechromelabs.github.io/chrome-for-testing/&quot;&gt;Google Chrome Labs&lt;/a&gt; and download chromedriver based on your platform.&lt;/p&gt;
    &lt;p&gt;On Mac&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;where chromedriver
    /usr/local/bin/chromedriver
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo mv &lt;/span&gt;downloaded/chromedriver /usr/local/bin/chromedriver
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;israel&quot;&gt;Israel&lt;/h3&gt;
    &lt;p&gt;Malaysian passport bears the inscription &quot;This passport is valid for all countries except Israel&quot;. This reminded me of Pakistan has similar inscription on its passport, &quot;This passport is valid for all countries of the world except Israel&quot;.&lt;/p&gt;
    &lt;p&gt;Israel doesn&apos;t have diplotmatic relations with either Malaysia or Pakistan. The conflict of Israel-Palestine has significantly affected the sentiments of Muslim majority in both Malaysia and Pakistan.&lt;/p&gt;
    &lt;p&gt;Also, Bangladesh doesn&apos;t recognize Israel. In Nov 2003, Bangladeshi journalist Salah Choudhury was arrested for attempting to fly to Tel Aviv to attend a seminar and was booked for &quot;sedition, treason and blasphemy&quot;.&lt;/p&gt;
    &lt;h2 id=&quot;feb-4-2024&quot;&gt;Feb 4, 2024&lt;/h2&gt;
    &lt;h3 id=&quot;sublime-text&quot;&gt;Sublime Text&lt;/h3&gt;
    &lt;p&gt;On Mac , if you want to open submlime text via command line :&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /Applications/Sublime&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/.
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;subl &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;reading-quantitative-finance-with-python-by-chris-kelliher&quot;&gt;Reading Quantitative Finance with Python by Chris Kelliher&lt;/h3&gt;
    &lt;p&gt;Difference between futures and options. With a future contract, you are obligated to buy/sell that asset at later date. It&apos;s like pre-ordering something at a fixed price, no matter how the actual market price changes.&lt;/p&gt;
    &lt;p&gt;Options contracts gives you a right rather than a obligation whether to buy/sell that asset in future. But you pay a fee for that choice. If you select not to buy/sell that item, you lose that fee.&lt;/p&gt;
    &lt;p&gt;With Options, a call options is like having the right to buy and a put option is a right to sell.&lt;/p&gt;
    &lt;p&gt;The payoff for a call option is&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;C = max(S&lt;sub&gt;T&lt;/sub&gt; - K, 0)&lt;/p&gt;
    &lt;p&gt;P = max(K - S&lt;sub&gt;T&lt;/sub&gt;, 0)&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;K is the strike price (the price at which you sell the stock)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;S&lt;sub&gt;T&lt;/sub&gt; is current stock price.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2024-01-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-01-29-02-04</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-01-29-02-04</guid>
</item>
<item>
  <title>Weekly Logs from Jan 22 to Jan 28, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Jan 22 to Jan 28, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A39:T50?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;buying-a-stock&quot;&gt;Buying a stock&lt;/h2&gt;
    &lt;h3 id=&quot;kr-stock&quot;&gt;kr stock&lt;/h3&gt;
    &lt;p&gt;Here&apos;s a moving average:&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*M1UGwLJI9jGDBe2sPLEVDg.jpeg&quot;  /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Lets look at some metrics&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;Dividend&lt;/td&gt;
    &lt;td&gt;2.51%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;RSI(14)&lt;/td&gt;
    &lt;td&gt;57.20&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Lets compare it with S&amp;amp;P&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*rVffMBPU9g7ulr_twMgvEQ.jpeg&quot;  /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Why not just invest in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VOO&lt;/code&gt; then if it doesn&apos;t give more return than S&amp;amp;P?&lt;/p&gt;
    &lt;h3 id=&quot;qcom-stock&quot;&gt;qcom stock&lt;/h3&gt;
    &lt;p&gt;First lets compare against it S&amp;amp;P&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*OFayJNLyJcnZjJuCVOJPww.jpeg&quot;  /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Lets look at some metrics&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;Dividend&lt;/td&gt;
    &lt;td&gt;2.12%&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;RSI(14)&lt;/td&gt;
    &lt;td&gt;64.54&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;EPS&lt;/td&gt;
    &lt;td&gt;1.98 (12/25/2022)&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;PEG&lt;/td&gt;
    &lt;td&gt;2.15&lt;/td&gt;
    &lt;td&gt;Stock is relatively high compared to its earning growth rate&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;How about moving average?&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*ZMOXhYKFc4FOQyp8JXEhbQ.jpeg&quot;  /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2024-01-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-01-22-28</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-01-22-28</guid>
</item>
<item>
  <title>Weekly Logs from Jan 15 to Jan 21, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Jan 15 to Jan 21, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A28:T37?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-01-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-01-15-21</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-01-15-21</guid>
</item>
<item>
  <title>Optimizing Builds with Gradle Build Cache</title>
  <description>&lt;p&gt;Gradle build cache is an essential tool for optimizing build times in software development. By storing build outputs either locally or remotely, it significantly reduces the time and resources required for rebuilding similar tasks. This cache mechanism is especially beneficial in continuous integration environments where builds occur frequently.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Gradle build cache is an essential tool for optimizing build times in software development. By storing build outputs either locally or remotely, it significantly reduces the time and resources required for rebuilding similar tasks. This cache mechanism is especially beneficial in continuous integration environments where builds occur frequently.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Note : Tested with gradle 8.5&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;setting-up-the-build-cache-node&quot;&gt;Setting Up the Build Cache Node&lt;/h2&gt;
    &lt;h3 id=&quot;running-the-build-cache-node-locally&quot;&gt;Running the Build Cache Node Locally&lt;/h3&gt;
    &lt;p&gt;After downloading the  &lt;a href=&quot;https://docs.gradle.com/build-cache-node/jar/build-cache-node-18.0.jar&quot;&gt;jar&lt;/a&gt; file, you can start the build cache node locally:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;java &lt;span class=&quot;nt&quot;&gt;-jar&lt;/span&gt; build-cache-node-18.0.jar start
    WARNING: Using default data &lt;span class=&quot;nb&quot;&gt;dir &lt;/span&gt;location &lt;span class=&quot;s1&quot;&gt;&apos;/tmp/build-cache-node&apos;&lt;/span&gt; which is &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;temp space and could be deleted at any &lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;use &lt;span class=&quot;s1&quot;&gt;&apos;--data-dir=&amp;lt;dir&amp;gt;&apos;&lt;/span&gt; to specify a persistent location&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    WARNING: This build cache is unusable as a build cache due to its access control settings - anonymous access is disabled and no &lt;span class=&quot;nb&quot;&gt;users &lt;/span&gt;are defined.
    Starting Develocity build cache node &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;18.0&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
    UI access is protected by generated username and password:
    Build cache node started &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;port: 5071&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This command will output several messages, including warnings and information about the default settings:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Default Data Directory:&lt;/strong&gt; It warns about using the default data directory located in temporary space (/tmp/build-cache-node). For persistent caching, it&apos;s recommended to specify a directory using –data-dir=&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;dir&amp;gt;&lt;/code&gt;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Access Control Settings:&lt;/strong&gt; By default, anonymous access to the build cache is disabled. To enable your application to access the cache, you need to configure access control settings.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;configuring-access-for-a-java-application&quot;&gt;Configuring Access for a Java Application&lt;/h2&gt;
    &lt;h3 id=&quot;generating-a-hashed-salt-password&quot;&gt;Generating a Hashed Salt Password&lt;/h3&gt;
    &lt;p&gt;For enhanced security, the Gradle build cache requires a hashed salt password. You can generate this using the build-cache-node jar.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;java &lt;span class=&quot;nt&quot;&gt;-jar&lt;/span&gt; build-cache-node-18.0.jar &lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;dockerfile&quot;&gt;Dockerfile&lt;/h3&gt;
    &lt;p&gt;Let&apos;s set up a Docker container to deploy the cache node easily in any environment. Below is the Dockerfile for creating such a container:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/a7a291a9e4a5d16c8a2f298ec508bd05.js?file=Dockerfile&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Replace &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;hashed_password&amp;gt;&lt;/code&gt; with the hashed password generated earlier.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Note: If you&apos;re using podman, ensure to specify the full path of the Dockerfile like&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;FROM docker.io/library/amazoncorretto:17-alpine-jdk
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Build and run your Docker container:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Build the Docker container&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker build &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; gradle-cache &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# Run the container&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker run &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 5071:5071 gradle-cache  
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;verify-the-gradle-cache&quot;&gt;Verify the Gradle Cache&lt;/h2&gt;
    &lt;h3 id=&quot;using-curl&quot;&gt;Using Curl&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-sw&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;n &lt;span class=&quot;nt&quot;&gt;--fail-with-body&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--show-error&lt;/span&gt; http://localhost:5071/ping
    SUCCESS
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;creating-a-simple-application&quot;&gt;Creating a Simple Application&lt;/h3&gt;
    &lt;p&gt;Go to &lt;a href=&quot;https://start.spring.io/&quot;&gt;start.initializr&lt;/a&gt; and create a simple application. Ensure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gradle.properties&lt;/code&gt; contains:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;org.gradle.caching=true
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Update your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;settings.gradle&lt;/code&gt; to configure the remote build cache:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/a7a291a9e4a5d16c8a2f298ec508bd05.js?file=settings.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;building-the-application&quot;&gt;Building the Application&lt;/h3&gt;
    &lt;p&gt;Finally, build your application:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./gradlew clean build
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;By setting up and utilizing the Gradle build cache, you significantly reduce build times and enhance the efficiency of your development workflow. It&apos;s a powerful feature that, when configured correctly, can provide substantial benefits in both local and CI/CD environments.&lt;/p&gt;
  </description>
  <pubDate>2024-01-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/deploy-gradle-build-cache</link>
<guid isPermaLink="true">https://randomwits.com/blog/deploy-gradle-build-cache</guid>
</item>
<item>
  <title>Weekly Logs from Jan 8 to Jan 14, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Jan 8 to Jan 14, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A19:T27?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;jan-8-2024&quot;&gt;Jan 8, 2024&lt;/h2&gt;
    &lt;h3 id=&quot;sharing-highlighted-code-in-browser&quot;&gt;Sharing highlighted code in Browser&lt;/h3&gt;
    &lt;p&gt;Sometimes its useful to highlight part of code when sharing the code via browser . In &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bitbucket&lt;/code&gt; , you can highlight lines by appending &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#&lt;/code&gt; after the url followed by line numbers. For example to highlight from line 1 to 24, you can do&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://${BITBUCKET}/${repo}/${file}#1-24
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will hightlight line 1 to 24.&lt;/p&gt;
    &lt;p&gt;In &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Github&lt;/code&gt; you can do similar like&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://github.com/${repo}/${file}#L1-L24
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;jan-13-2024&quot;&gt;Jan 13, 2024&lt;/h2&gt;
    &lt;p&gt;In Mac, I use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew&lt;/code&gt; for installing most of the services.&lt;/p&gt;
    &lt;p&gt;To view a list of services&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew services list
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Staring a service&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew services start service_name
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Stopping a service&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew services stop service_name
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Restarting a service&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew services restart service_name
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2024-01-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-01-08-14</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-01-08-14</guid>
</item>
<item>
  <title>Weekly Logs from Jan 1, 2024 to Jan 7, 2024</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Jan 1, 2024 to Jan 7, 2024.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A9:T17?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2024-01-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2024-01-01-07</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2024-01-01-07</guid>
</item>
<item>
  <title>Weekly logs from Dec 25 to Dec 31, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my weekly logs from Dec 25,2023 to Dec 31, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;snapshot-of-my-habits&quot;&gt;Snapshot of my habits&lt;/h2&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .sketch-cirlce{
    position:relative;
    }
    .sketch-cirlce:before{
    content:&quot;&quot;;
    color: white;
    z-index:-1;
    left:-0.5em;
    top:-0.1em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    position:absolute;
    border-right-color:transparent;
    width:100%;
    height:1em;
    transform:rotate(2deg);
    opacity:0.7;
    border-radius:50%;
    padding:0.1em 0.25em;
    }
    .sketch-cirlce:after{
    content:&quot;&quot;;
    z-index:-1;
    left:-0.5em;
    top:0.1em;
    padding:0.1em 0.25em;
    border-width:2px;
    border-style:solid;
    border-color:#39c;
    border-left-color:transparent;
    border-top-color:transparent;
    position:absolute;
    width:100%;
    height:1em;
    transform:rotate(-1deg);
    opacity:0.7;
    border-radius:50%;
    }
    &lt;/style&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    var req = new XMLHttpRequest();
    req.responseType = &apos;json&apos;;
    var url = &quot;https://sheets.googleapis.com/v4/spreadsheets/1Xb4wV0AOQiGWwXaciIBX-rkFebzg8DlAcRcClshyAnA/values/Habits!A1:T8?alt=json&amp;key=AIzaSyCgYRKf_apK3TUSYGO9WhQ5dN-ukY4H0gw&quot;;
    var apiKey = &quot;&quot;; 
    var startRow = &quot;&quot;; 
    var endRow = &quot;&quot;; 
    if (url &amp;&amp; startRow &amp;&amp; endRow) {
    url += `${startRow}:${endRow}?alt=json`;
    if (apiKey) {
    url += `&amp;key=${apiKey}`;
    }
    }
    req.open(&apos;GET&apos;, url, true);
    req.onload  = function() {
    var data = req.response[&quot;values&quot;];
    let i;
    let getDate = [];
    for (i = 1; i &lt; data.length; i++) {
    let activity = data[i][0];
    let streak  = data[i][1];
    let logging = data[i][6];
    let count = data[i][19];
    let todayDate = (data[i][7] === &quot;yes&quot;) ? &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayDate = (data[i][8] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusOneDate = (data[i][9] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusTwoDate = (data[i][10] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusThreeDate = (data[i][11] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFourDate = (data[i][12] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    let yesterdayMinusFiveDate = (data[i][13] === &quot;yes&quot;) ?  &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check cl\&quot;&gt;&lt;/i&gt;&quot;: &quot;&lt;i style=\&quot;font-size:24px\&quot; class=\&quot;icon-check-empty cl\&quot;&gt;&lt;/i&gt;&quot;;
    if(data[i][18]) {
    getDate.push(data[i][18]);
    }
    if (parseInt(streak) &gt; 0) {
    activity = &quot;&lt;span class=\&quot;sketch-cirlce\&quot; &gt;&quot; + activity + &quot;&lt;/span&gt;&quot;;
    }
    document.getElementById(&quot;demo&quot;).innerHTML +=
    &quot;&lt;tr&gt;&quot; +
    &quot;&lt;td style=\&quot;white-space:nowrap;\&quot; &gt;&quot; + 
    activity +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    todayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusOneDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusTwoDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusThreeDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFourDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    yesterdayMinusFiveDate +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    streak +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    count +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;td&gt;&quot; +
    logging +
    &quot;&lt;/td&gt;&quot; +
    &quot;&lt;/tr&gt;&quot;;
    }
    document.getElementById(&quot;today&quot;).innerHTML = getDate[0];
    document.getElementById(&quot;yesterday&quot;).innerHTML = getDate[1];
    document.getElementById(&quot;yesterdayOneMinus&quot;).innerHTML = getDate[2];
    document.getElementById(&quot;yesterdayTwoMinus&quot;).innerHTML = getDate[3];
    document.getElementById(&quot;yesterdayThreeMinus&quot;).innerHTML = getDate[4];
    document.getElementById(&quot;yesterdayFourMinus&quot;).innerHTML = getDate[5];
    document.getElementById(&quot;yesterdayFiveMinus&quot;).innerHTML = getDate[6];
    };
    req.send(null);
    &lt;/script&gt;
    &lt;!-- dummy box begins --&gt;
    &lt;div style=&quot;padding-bottom:10px; padding-top:20px; background : white;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;container my-5&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;col-md-7 mb-4 mb-md-0&quot;&gt;
    &lt;!-- Table --&gt;
    &lt;table class=&quot;table table-striped&quot; style=&quot;font-size: 16px;&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Activity&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;today&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterday&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayOneMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayTwoMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayThreeMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFourMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;&lt;span id=&quot;yesterdayFiveMinus&quot;&gt;&lt;/span&gt;&lt;/th&gt;
    &lt;th&gt;Streak&lt;/th&gt;
    &lt;th&gt;Count&lt;/th&gt;
    &lt;th&gt;Logging&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id=&quot;demo&quot;&gt;&lt;/tbody&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;daily-logs&quot;&gt;Daily logs&lt;/h2&gt;
    &lt;h3 id=&quot;dec-29-2023&quot;&gt;Dec 29, 2023&lt;/h3&gt;
    &lt;p&gt;I forgot the credentials of jenkins running at my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:8080&lt;/code&gt; on Mac. So an easier way is to disable authentication by editing the file : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/Users/&amp;lt;USERNAME&amp;gt;/.jenkins/config.xml&lt;/code&gt; and set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;useSecurity&lt;/code&gt; to false&lt;/p&gt;
    &lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;useSecurity&amp;gt;&lt;/span&gt;false&lt;span class=&quot;nt&quot;&gt;&amp;lt;/useSecurity&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next restart the server:&lt;/p&gt;
    &lt;div class=&quot;language-zsh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew services
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;brew services restart jenkins
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;dec-28-2023&quot;&gt;Dec 28, 2023&lt;/h3&gt;
    &lt;p&gt;Gradle uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GRADLE_USER_HOME&lt;/code&gt; environment variable to determine where to store its cache and configuration files. So in our groovy pipeline we can set it like&lt;/p&gt;
    &lt;div class=&quot;language-groovy highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;pipeline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;environment&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;GRADLE_USER_HOME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/home/jenkins/.gradle/${env.JOB_NAME}&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;A study in PLOS Medicine (2015) reported that overweight individuals who are physically active have a lower risk of mortality than normal-weight individuals who are inactive. So that means that a overweight person who exercises regularly would outlive a skinny person who doesn&apos;t exercises. So that&apos;s a motivation I need for the new year since weighing machine is a biggest let down for me.&lt;/p&gt;
    &lt;h3 id=&quot;dec-27-2023&quot;&gt;Dec 27, 2023&lt;/h3&gt;
    &lt;p&gt;What is the purpose of life? I&apos;m not sure. But what about the purpose of a day? That&apos;s easier to answer. Each day follows a similar cycle: you wake up, go to the bathroom, eat, drink, and sleep. Then there are the chores that need to be done, such as grocery shopping, filing taxes, etc. What about the rest of your time? Perhaps you could watch something, listen to music, develop some skills, pursue a hobby, or connect with people. As the day ends, what remains are the memories of what you did and the regrets over things you couldn&apos;t complete or even attempt.&lt;/p&gt;
    &lt;p&gt;Today, we visited the USPS to get a money order. Yesterday, we were frantically searching for a money order like headless chicken accross stores like CVS, Walgreens and Harris Teeter. It seemed that the money order machines were down everywhere. I had no idea what that meant.&lt;/p&gt;
    &lt;p&gt;I skipped the gym today and I&apos;m feeling pretty awful about it. To make matters worse, I lost my AirPods again. Going to the gym without music feels dull and demotivating, which seemed like a good enough excuse for me to forgive myself. Fortunately, I managed to find them using the &lt;strong&gt;Find My&lt;/strong&gt; app. Hopefully, I&apos;ll make it to the gym tomorrow, or else I&apos;ll need to come up with another good excuse!&lt;/p&gt;
    &lt;p&gt;I use &lt;strong&gt;wsl&lt;/strong&gt; linux terminal on my Windows Computer. I got stuck on the terminal because there was a typo in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.bashrc&lt;/code&gt; file and I couldn&apos;t terminate it or return to terminal. The fix was simple as to open the Ubuntu File System on Windows by going to the following location:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;\\wsl$\Ubuntu\home\YourUsername
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;YouUserName is your actual Window username.&lt;/p&gt;
    &lt;p&gt;I also installed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oh-my-zsh&lt;/code&gt; on the terminal with &lt;strong&gt;powerlevel10k&lt;/strong&gt; theme. I keep the copy of my dotfiles &lt;a href=&quot;https://github.com/tushar-sharma/dotfiles&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;400&quot; src=&quot;/encrypted/2023-12-27-daily-logs-2023-12-27.html&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;
    &lt;/iframe&gt;
  </description>
  <pubDate>2023-12-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/weekly-logs-2023-12-25-31</link>
<guid isPermaLink="true">https://randomwits.com/blog/weekly-logs-2023-12-25-31</guid>
</item>
<item>
  <title>Maximum Width of Binary Tree</title>
  <description>&lt;p&gt;The problem statement, as given on LeetCode, asks us to find the maximum width of a binary tree. The width of a level is defined as the number of nodes at that level. The maximum width of the binary tree is the maximum width among all levels.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;The problem statement, as given on LeetCode, asks us to find the maximum width of a binary tree. The width of a level is defined as the number of nodes at that level. The maximum width of the binary tree is the maximum width among all levels.&lt;/p&gt;
    &lt;h2 id=&quot;solution&quot;&gt;Solution&lt;/h2&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab python&quot;&gt;&lt;a href=&quot;#python&quot;&gt;python&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample python&quot; id=&quot;python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/279fb609b7e6502db5e74eaab77c701b.js?file=width_of_binary_tree.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/279fb609b7e6502db5e74eaab77c701b.js?file=WidthOfBinaryTree.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h2 id=&quot;code-walkthrough&quot;&gt;Code Walkthrough&lt;/h2&gt;
    &lt;p&gt;Initialization: Start with the root node of the binary tree. Initialize a queue to hold nodes and their positions. Set a variable max_width to keep track of the maximum width seen so far (initially set to 0).&lt;/p&gt;
    &lt;p&gt;Breadth-First Search (BFS): Perform a BFS traversal of the binary tree. Begin with the root node and assign it a position of 0. Enqueue the root node along with its position into the queue.&lt;/p&gt;
    &lt;p&gt;While the Queue is not Empty:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Get the size of the queue, which represents the number of nodes at the current level.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Initialize left_index and right_index to track the indices of the leftmost and rightmost nodes at the current level.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Iterate through the nodes at the current level:&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Dequeue a node and its position from the queue.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Update left_index with the position of the leftmost node.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Update right_index with the position of the last node (rightmost) in the current level.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Calculate the width of the current level as right_index - left_index + 1.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Update max_width with the maximum of its current value and the width of the current level.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the node has a left child, enqueue the left child with a position calculated as (2 * current_position) + 1.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the node has a right child, enqueue the right child with a position calculated as (2 * current_position) + 2.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Return max_width: After processing all levels, max_width will hold the maximum width of the binary tree.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;time-complexity&quot;&gt;Time Complexity&lt;/h2&gt;
    &lt;p&gt;The time complexity is O(N), where N is the number of nodes in the binary tree. This is because both solutions traverse all nodes in the tree once using BFS.&lt;/p&gt;
  </description>
  <pubDate>2023-12-29T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/maximum-width-of-binary-tree</link>
<guid isPermaLink="true">https://randomwits.com/blog/maximum-width-of-binary-tree</guid>
</item>
<item>
  <title>Getting Started with Spring AI</title>
  <description>&lt;p&gt;In this blog, we&apos;ll explore how to create a simple Spring Boot application that leverages Spring AI for generating responses. We&apos;ll build a BooksApi application that can tell us which book won the booker prize for a given year.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In this blog, we&apos;ll explore how to create a simple Spring Boot application that leverages Spring AI for generating responses. We&apos;ll build a BooksApi application that can tell us which book won the booker prize for a given year.&lt;/p&gt;
    &lt;h3 id=&quot;initialize-your-project&quot;&gt;Initialize Your Project&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Go to &lt;a href=&quot;https://start.spring.io/&quot;&gt;start.spring.io&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Name your project as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BooksApi&lt;/code&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Add the dependencies: Spring Web, Spring Boot Dev Tools&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;adding-snapshot-repository-with-gradle&quot;&gt;Adding Snapshot Repository with Gradle&lt;/h3&gt;
    &lt;p&gt;Snapshot repositories store development versions of artifacts. The Spring Snapshot Repository contains the latest updates. Add this to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;build.gradle&lt;/code&gt; to access the Spring Snapshot Repository and Spring AI dependency:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/a180a0e9603e7fe9d018b220387465f6.js?file=build.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;api-keys&quot;&gt;API Keys&lt;/h3&gt;
    &lt;p&gt;Add your API key to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;src/main/resources/application.properties&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;spring.ai.openai.api-key=YOUR_API_KEY&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;controller&quot;&gt;Controller&lt;/h3&gt;
    &lt;p&gt;Create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;controller/BooksController.java&lt;/code&gt;`:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/a180a0e9603e7fe9d018b220387465f6.js?file=BooksController1.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In the above code, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;openAiClient&lt;/code&gt; is injected through constructor injection, which is a preferred method in Spring for dependency injection. The @Autowired annotation is not required when using constructor injection.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Quick Quiz: What&apos;s @RequestMapping Annotation?&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;button class=&quot;quiz-btn&quot; data-showing=&quot;false&quot; data-answer=&quot;answer1&quot;&gt;Show Answer&lt;/button&gt;&lt;/p&gt;
    &lt;div class=&quot;quiz-answer&quot; id=&quot;answer1&quot;&gt;
    @RequestMapping is an annotation used in Spring to map web requests to specific handler classes or handler methods. Here, it&apos;s used to map all requests starting with &lt;i&gt;/books&lt;/i&gt; to this controller.
    &lt;/div&gt;
    &lt;h3 id=&quot;using-prompttemplate&quot;&gt;Using PromptTemplate&lt;/h3&gt;
    &lt;p&gt;PromptTemplate is useful for dynamically constructing prompts with variables. It ensures cleaner code and easier manipulation of the prompt string.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/a180a0e9603e7fe9d018b220387465f6.js?file=BooksController2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;If you go to : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost:8080/books/booker/2003&lt;/code&gt;, it will output something like&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;The book that won the Booker Prize in 2003 is &quot;Vernon God Little&quot; by DBC Pierre.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Quick Quiz: What&apos;s @PathVariable Annotation?&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;button class=&quot;quiz-btn&quot; data-showing=&quot;false&quot; data-answer=&quot;answer2&quot;&gt;Show Answer&lt;/button&gt;&lt;/p&gt;
    &lt;div class=&quot;quiz-answer&quot; id=&quot;answer2&quot;&gt;
    A path variable is a part of the URL that is captured and used as a variable in your method. In this case, {year} in the URL /booker/{year} is a path variable.
    &lt;/div&gt;
    &lt;h3 id=&quot;creating-a-record-class&quot;&gt;Creating a record class&lt;/h3&gt;
    &lt;p&gt;A record class in Java is a concise way to create immutable data objects.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/a180a0e9603e7fe9d018b220387465f6.js?file=BookWinner.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;parsing-ai-response-into-java-object&quot;&gt;Parsing AI Response into Java Object&lt;/h3&gt;
    &lt;p&gt;BeanOutputParser is a utility in Spring AI that helps in parsing the output from AI into a Java Bean (in our case, BookerWinner).&lt;/p&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parser.getFormat()&lt;/code&gt; returns a string that represents the format in which the AI should return the data, making it easier to parse into the BookerWinner object.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/a180a0e9603e7fe9d018b220387465f6.js?file=BooksController3.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;If you go to : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost:8080/books/booker/2003&lt;/code&gt;, it will output something like&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{
    &quot;title&quot;: &quot;Vernon God Little&quot;,
    &quot;author&quot;: &quot;DBC Pierre&quot;,
    &quot;year&quot;: &quot;2003&quot;
    }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2023-12-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/getting-started-spring-ai</link>
<guid isPermaLink="true">https://randomwits.com/blog/getting-started-spring-ai</guid>
</item>
<item>
  <title>Binary Tree Right Side View Leetcode</title>
  <description>&lt;p&gt;We delve into a popular algorithmic problem from LeetCode: the &quot;Binary Tree Right Side View&quot;. This problem is an excellent exercise for understanding tree-based data structures and breadth-first traversal techniques.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;We delve into a popular algorithmic problem from LeetCode: the &quot;Binary Tree Right Side View&quot;. This problem is an excellent exercise for understanding tree-based data structures and breadth-first traversal techniques.&lt;/p&gt;
    &lt;h3 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h3&gt;
    &lt;p&gt;The &quot;Binary Tree Right Side View&quot; problem asks us to find the values of the nodes you can see when you look at a binary tree from the right side. This perspective means we only observe the rightmost node at each level of the tree.&lt;/p&gt;
    &lt;p&gt;example&lt;/p&gt;
    &lt;p&gt;Given a binary tree like this:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    1
    / \
    2   3
    \   \
    5   4
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The right side view will be [1, 3, 4].&lt;/p&gt;
    &lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;
    &lt;p&gt;To solve this problem, we employ a breadth-first search (BFS) approach using a queue. BFS allows us to traverse the tree level by level, ensuring we can access the rightmost element of each level.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab python&quot;&gt;&lt;a href=&quot;#python&quot;&gt;python&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample python&quot; id=&quot;python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/752705ffec52ff6a44ed559c49d0fd2f.js?file=right_side_view.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/752705ffec52ff6a44ed559c49d0fd2f.js?file=RightSideView.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h3 id=&quot;code-walkthrough&quot;&gt;Code Walkthrough&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Method Signature: The method rightSideView takes the root of a binary tree as its input and returns a list of integers representing the tree&apos;s right side view.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Base Case Check: We first check if the root is null. If it is, we return an empty list, as there&apos;s no tree to traverse.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Queue Initialization: We use a Deque to store nodes at each level.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;BFS Loop: We iterate through the tree using a while loop, processing nodes level by level.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Level Processing: For each level, we iterate through the nodes at that level. The key is to add the value of the last node of each level to our output list.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Child Nodes: We add the left and right child nodes of each processed node to the queue for subsequent processing.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;time-complexity&quot;&gt;Time Complexity&lt;/h3&gt;
    &lt;p&gt;The time complexity of this solution is O(N), where N is the number of nodes in the tree. This is because each node is visited exactly once during the BFS traversal.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Queue Operations: Each node is added and removed from the queue exactly once.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Level-wise Traversal: Since we process nodes level by level, we ensure that each node is considered only once.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2023-12-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/binary-tree-right-side-view-leetcode.md</link>
<guid isPermaLink="true">https://randomwits.com/blog/binary-tree-right-side-view-leetcode.md</guid>
</item>
<item>
  <title>Meetup at McColl School of Business at Queens University</title>
  <description>&lt;p&gt;I went to Charlotte Fintech Meetup. It was held in Room 326 of Sykes Hall, which is located in the McColl School of Business at Queens University. .&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I went to Charlotte Fintech Meetup. It was held in Room 326 of Sykes Hall, which is located in the McColl School of Business at Queens University.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://cdn-images-1.medium.com/v2/resize:fit:2600/1*8gpeGFhtT6I5J8IlPQ018g.jpeg&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;fama-french-three-factor-model&quot;&gt;Fama-French Three-Factor Model&lt;/h3&gt;
    &lt;p&gt;The Fama-French Model is an expansion of the Capital Asset Pricing Model (CAPM). It adds two additional factors to the market risk factor in CAPM. The model is often used to explain the performance of stock portfolios by examining how portfolios with different characteristics perform relative to risk factors. If a portfolio consistently invests in a small-cap or value stocks, it may have a positive SMB or HML factor, indicating that it&apos;s positioned to potentially benefit from the higher returns associated with these factors.&lt;/p&gt;
    &lt;h4 id=&quot;size-factor-smb-small-minus-big&quot;&gt;Size Factor (SMB: Small Minus Big)&lt;/h4&gt;
    &lt;p&gt;SMB stands for &quot;Small Minus Big&quot; and is one of the three factors in the Fama-Fench three-factor model. It represents the excess return of small-cap stocks over large-cap stocks.&lt;/p&gt;
    &lt;p&gt;The idea behind SMB is that small-cap stocks (with a small market capitalization) tends to have higher risk and potentially higher return to compensate for that risk. Over time, historically, small cap stocks have outperformed large-cap stocks on average.&lt;/p&gt;
    &lt;h4 id=&quot;value-factor-hml-high-minus-low&quot;&gt;Value Factor (HML: High Minus Low)&lt;/h4&gt;
    &lt;p&gt;HML stands for &quot;High Minus Low&quot; and represents the excess retrun of value stock (with high book-to-market ratios) over growth stocks (with low book to market ratios).&lt;/p&gt;
    &lt;p&gt;Value stocks are typically companies that are considered undervalued relative to their fundamental value as indicated by their financial statements. Growth stocks are companies that might not be undervalued but are expected to grow at an above-average rate compared to other companies. Historically, value stocks have outperformed growth stocks, which is what HML seek to capture.&lt;/p&gt;
    &lt;h3 id=&quot;markowitz-modern-portfolio-theory-mpt&quot;&gt;Markowitz Modern Portfolio Theory (MPT)&lt;/h3&gt;
    &lt;p&gt;Developed by Harry Markowitz in the 1950s, MPT is a framework for assembling a portfolio of assets such that the expected return is maximized for a given level of risk. It relies on diversification to reduce the risk.&lt;/p&gt;
    &lt;h3 id=&quot;return-of-a-financial-asset-r&quot;&gt;Return of a Financial Asset (R)&lt;/h3&gt;
    &lt;p&gt;The return of an asset from time t-1 to t is calculated as:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Return (R) = (Price at time t / Price at time t-1) - 1
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This formula gives us the percentage change in the asset&apos;s price.&lt;/p&gt;
    &lt;h3 id=&quot;time-periods&quot;&gt;Time Periods&lt;/h3&gt;
    &lt;p&gt;In financial analysis, time periods are crucial. They can be days, months, years, or any other interval used to measure performance.&lt;/p&gt;
    &lt;h3 id=&quot;r-squared-r2&quot;&gt;R-squared (R^2)&lt;/h3&gt;
    &lt;p&gt;R-squared is a statistical measure in a regression model that determines the proportion of the variance in the dependent variable that is predictable from the independent variable(s).&lt;/p&gt;
    &lt;p&gt;Formula: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;R^2 = 1 - (Unexplained Variance / Total Variance)&lt;/code&gt;&lt;/p&gt;
    &lt;h3 id=&quot;beta-coefficients-β&quot;&gt;Beta Coefficients (β)&lt;/h3&gt;
    &lt;p&gt;Beta is a measure of the volatility, or systematic risk, of a security or a portfolio in comparison to the market as a whole. It is used in the CAPM.&lt;/p&gt;
    &lt;p&gt;Formula: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;β = Covariance(Return of Asset, Return of Market) / Variance(Return of Market)&lt;/code&gt;&lt;/p&gt;
    &lt;h3 id=&quot;example-in-python&quot;&gt;Example in Python&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/a3938241e0d8a64c323787dc363916af.js?file=fama_french.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;interpretation-of-the-output&quot;&gt;Interpretation of the output&lt;/h3&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;The beta of AAPL is 1.2175729053938895
    The R-squared value is 0.6075157876617264
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The beta of a stock measures its volatility relative to the market. A beta of 1.22 suggests that Apple&apos;s stock is 22% more volatile than the market. If the market goes up by 1%, Apple&apos;s stock is expected to go up by 1.22% and vice versa. This implies a higher level of risk compared to the market, but also the potential for higher returns.&lt;/p&gt;
    &lt;p&gt;Trading Implication: As a trader, if you expect the market to rise, holding AAPL could yield better returns compared to a less volatile stock (with lower beta). Conversely, if the market falls, AAPL could potentially fall more. If you are averse to risk or if the market is expected to be bearish, you might consider diversifying your portfolio or looking into stocks with a lower beta.&lt;/p&gt;
    &lt;p&gt;R-squared values range from 0 to 1 and measure how closely the stock&apos;s price movements are related to the movements of the market index. An R-squared of 0.61 means that approximately 61% of the stock&apos;s price movements can be explained by changes in the S&amp;amp;P 500 index. The remaining 39% of price movements are influenced by factors specific to Apple or its industry.&lt;/p&gt;
    &lt;p&gt;Trading Implication: An R-squared of 0.61 indicates a moderate-to-high correlation with the market. For traders, this means that while Apple does follow the market to a significant extent, there&apos;s still a considerable portion of its price movement that is due to company or industry-specific factors. Hence, it&apos;s important to pay attention to Apple&apos;s own news, financial reports, and industry trends, in addition to overall market sentiment.
    What This Means for Trading
    When trading a stock like AAPL with a beta higher than 1 and a moderately high R-squared:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;In a bullish market, AAPL may provide higher returns than the market average.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;In a bearish market, AAPL may see larger losses than the market average.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;While AAPL moves with the market to a degree, individual factors are also at play, so it&apos;s not solely tied to market movements.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2023-12-13T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/meetup-mccoll-school-of-business-queens-university</link>
<guid isPermaLink="true">https://randomwits.com/blog/meetup-mccoll-school-of-business-queens-university</guid>
</item>
<item>
  <title>Getting started with Javascript Promises and Async Await</title>
  <description>&lt;p&gt;Getting started with Javascript Promises and Async Await&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Getting started with Javascript Promises and Async Await.&lt;/p&gt;
    &lt;h3 id=&quot;the-sequential-code-limitation&quot;&gt;The Sequential Code Limitation&lt;/h3&gt;
    &lt;p&gt;Lets&apos;s say you have the following code which executes sequentially&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/786d3bcfa40b6232e2c5ec24d1264ffd.js?file=seq.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This code executes sequentially. But what if you need to perform an operation that depends on data from a server or an API?&lt;/p&gt;
    &lt;h3 id=&quot;introducing-promises&quot;&gt;Introducing Promises&lt;/h3&gt;
    &lt;p&gt;A Promise in JavaScript is an object that represents the eventual completion (or failure) of an asynchronous operation, and its resulting value.&lt;/p&gt;
    &lt;p&gt;Consider the following example where we make an API request using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;axios&lt;/code&gt; library:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/786d3bcfa40b6232e2c5ec24d1264ffd.js?file=promise1.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This code will fail because the data property does not exist at the time of the console.log() statement. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;axios.get()&lt;/code&gt; method returns a Promise, which is an asynchronous operation.&lt;/p&gt;
    &lt;p&gt;The beauty of Promises is in their methods: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.then()&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.catch()&lt;/code&gt;. The .then() method is used for handling successful responses, while .catch() is used for handling errors.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/786d3bcfa40b6232e2c5ec24d1264ffd.js?file=promise2.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;simplifying-with-asyncawait&quot;&gt;Simplifying with Async/Await&lt;/h3&gt;
    &lt;p&gt;Async/Await is syntactic sugar over Promises, making asynchronous code easier to write and read. An async function returns a Promise, and the await keyword is used to wait for a Promise to resolve or reject.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/786d3bcfa40b6232e2c5ec24d1264ffd.js?file=promise3.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;This code is more readable and looks synchronous, even though it’s handling asynchronous operations.&lt;/p&gt;
    &lt;p&gt;Async functions are different from regular JavaScript functions in the sense that they can contain await expressions, allowing the function to pause and wait for the Promise to resolve or reject, before resuming execution and returning the resolved value. You don&apos;t have to use await inside an async function, but it&apos;s the primary reason for declaring a function as async.&lt;/p&gt;
    &lt;h3 id=&quot;callback-hell&quot;&gt;Callback hell&lt;/h3&gt;
    &lt;p&gt;Callback Hell typically occurs when you have several nested callbacks, creating a complex and hard-to-read code structure. This often happens when dealing with multiple asynchronous operations that need to be performed in sequence.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/786d3bcfa40b6232e2c5ec24d1264ffd.js?file=callbackHell.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;resolving-callback-hell&quot;&gt;Resolving Callback Hell&lt;/h3&gt;
    &lt;p&gt;Promises provide a cleaner way to handle asynchronous operations. Let’s refactor the above example using Promises:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/786d3bcfa40b6232e2c5ec24d1264ffd.js?file=callbackHell1.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Async/Await further simplifies asynchronous code, making it even more readable:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/786d3bcfa40b6232e2c5ec24d1264ffd.js?file=callbackHell2.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-12-12T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/javascript-promises-async-await</link>
<guid isPermaLink="true">https://randomwits.com/blog/javascript-promises-async-await</guid>
</item>
<item>
  <title>Beard Trim in Cartagena, Colombia</title>
  <description>&lt;p&gt;In search of a barber during my stay in Cartagena, I turned to Google Maps for assistance. It led me to Valentino Barberia, located at 130001, Cartagena de Indias, Bolívar. The ambiance of the place, complete with Spanish music playing softly in the background, immediately caught my attention. Upon entering, I requested a &quot;corte de barba,&quot; seeking a neat beard trim to freshen up my look.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In search of a barber during my stay in Cartagena, I turned to Google Maps for assistance. It led me to Valentino Barberia, located at 130001, Cartagena de Indias, Bolívar. The ambiance of the place, complete with Spanish music playing softly in the background, immediately caught my attention. Upon entering, I requested a &quot;corte de barba,&quot; seeking a neat beard trim to freshen up my look.&lt;/p&gt;
    &lt;p&gt;I saw a portrait of pabla escabar on the wall which was quite amusing.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://miro.medium.com/v2/resize:fit:1400/format:webp/1*4MzwBt9mDpFqWa7boiM3wQ.jpeg&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;The service I received at Valentino Barberia was truly commendable, leaving no room for disappointment. However, when the time came to settle the bill, I discovered that the establishment only accepted cash payments, excluding credit cards. Concerned about the situation, I kindly requested if I could locate an ATM nearby, and to my profound relief, the barber graciously agreed. Witnessing this display of trust, particularly from someone I had just encountered in an unfamiliar city, was both unexpected and heartwarming.&lt;/p&gt;
    &lt;p&gt;Being more familiar with Mexican pesos, the Colombian currency proved a bit tricky for me. The banknotes were much larger, and I initially found it difficult to differentiate between the denominations. When I returned from the ATM, I almost paid more than what was due. Thankfully, the barber was honest and kind, taking only the necessary amount and advising me to be more careful with the local currency in the future.&lt;/p&gt;
    &lt;p&gt;Here&apos;s the final result of the beard trim:&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://miro.medium.com/v2/resize:fit:1400/format:webp/1*NICOBh1R0kjPxzcqzKB8TQ.jpeg&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://miro.medium.com/v2/resize:fit:1400/format:webp/1*ho4bov76-IYTjuX6Dbp6gA.jpeg&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://miro.medium.com/v2/resize:fit:4800/format:webp/1*fQhqNIG9pBK1dxRmioHmhQ.jpeg&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2023-12-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/beard-trim-in-cartagena-colombia</link>
<guid isPermaLink="true">https://randomwits.com/blog/beard-trim-in-cartagena-colombia</guid>
</item>
<item>
  <title>Guide to Travel to Mexico</title>
  <description>&lt;p&gt;I flew to Mexico on the eve of Thanksgiving, November 22, 2023. Holding an Indian passport with a valid H1B visa stamped, I was eligible for visa-free entry to Mexico, as the country accepts travelers with a valid U.S. visa with at least six months validity. This made my travel plans smoother, requiring only that my passport be valid for the duration of my stay in Mexico.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I flew to Mexico on the eve of Thanksgiving, November 22, 2023. Holding an Indian passport with a valid H1B visa stamped, I was eligible for visa-free entry to Mexico, as the country accepts travelers with a valid U.S. visa with at least six months validity. This made my travel plans smoother, requiring only that my passport be valid for the duration of my stay in Mexico.&lt;/p&gt;
    &lt;h3 id=&quot;immigration&quot;&gt;Immigration&lt;/h3&gt;
    &lt;p&gt;Landing at Cancun airport, I was pleasantly surprised by the efficient immigration process, which took less than 10 minutes - a perk of traveling during the off-season, it seemed. The immigration officer&apos;s sole inquiry was about the length of my stay, to which I replied &quot;siete días&quot; (seven days).&lt;/p&gt;
    &lt;h3 id=&quot;atm&quot;&gt;ATM&lt;/h3&gt;
    &lt;p&gt;Post-immigration, I navigated to the &apos;Salida&apos; (exit) where conveniently located ATMs offered a seamless cash withdrawal experience. Utilizing my Bank of America debit card at an HSBC ATM, I obtained the necessary local currency without a hitch.&lt;/p&gt;
    &lt;h3 id=&quot;ado-bus&quot;&gt;ADO Bus&lt;/h3&gt;
    &lt;p&gt;My next step was locating the ADO bus service. Just outside the airport, I found an ADO booth where I secured a ticket to Merida, roughly a 5-hour journey from Cancun. The buses were stationed just across the road, making the transition smooth. The ride from Cancun to Merida is five hours.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://drive.google.com/uc?export=view&amp;amp;id=1qdlXaf-F71K3E_6KUhwGncR1dQ9RX4mm&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;merida&quot;&gt;Merida&lt;/h3&gt;
    &lt;p&gt;First thing I did in Merida, was to enroll in table tennis training at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Club Estyga de Tenis de Mesa&lt;/code&gt;. The price for 2 hours classes was 200 pesos. In US, an hour table tennis class would be at least 50 bucks.&lt;/p&gt;
    &lt;p&gt;For lunch, I tried Miyabi restaurant in Merida. It had kaisenjiru soup with avacado which was delicous.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://drive.google.com/uc?export=view&amp;amp;id=1A4G1IQxRKhrG2lYR9HCHrzRNnrYr1s_1&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Another nifty trick is to use ChatGPT to upload images and it will help you translate Spanish labels on products. Like I uploaded this picture of detergent on ChatGPT, here&apos;s the response I got&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://drive.google.com/uc?export=view&amp;amp;id=1Xl9MMTwx_EGjoD203EyqINAwIebjB74w&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;tulum&quot;&gt;Tulum&lt;/h3&gt;
    &lt;p&gt;Next, my travels took me to Tulum, where I indulged in an adventurous tour featuring a cenote visit, ATV rides, and zip-lining. The natural beauty of the cenote was a highlight of this excursion.&lt;/p&gt;
    &lt;h3 id=&quot;playa-del-carmen&quot;&gt;Playa del carmen&lt;/h3&gt;
    &lt;p&gt;In Playa del carmen (PDC), I took an airbnb experience for volleyball. The beach is beautiful, I wished I had more time in PDC than Tulum.&lt;/p&gt;
    &lt;p&gt;I skipped Cancun for this trip. Also missed islands like Cozumel and Isla Mujeres. May be next time these places will be on my radard.&lt;/p&gt;
    &lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Uber is not available in playa del carmen, cancun or tulum due to taxi drivers&lt;sup id=&quot;fnref:taxi&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:taxi&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. However it was available in Merida.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Buy mosquito repellant everytime you go outside as I had awful mosquitoes bites&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Buy only REEF sunscreen which is biodegradable. Biodegradable sunscreens use mineral-based ingredients like zinc oxide or titanium dioxide to protect against the sun&apos;s harmful rays. They are different from traditional sunscreens, which often contain harmful chemicals like oxybenzone and octinoxate.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h3&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:taxi&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.poresto.net/quintana-roo/2023/4/7/socios-de-uber-piden-piso-parejo-en-cancun-senalan-las-autoridades-de-beneficiar-los-taxistas-378539.html&quot;&gt;socios-de-uber-piden-piso-parejo-en-cancun-senalan-las-autoridades-de-beneficiar-los-taxistas&lt;/a&gt; &lt;a href=&quot;#fnref:taxi&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2023-11-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/guide-to-travel-to-mexico</link>
<guid isPermaLink="true">https://randomwits.com/blog/guide-to-travel-to-mexico</guid>
</item>
<item>
  <title>Git rebase tutorial</title>
  <description>&lt;p&gt;Git, a powerful version control system, is essential for managing and organizing files, especially in team environments. When working collaboratively, developers often create multiple branches to isolate their work. The git rebase command becomes crucial when you need to integrate changes from the master(sometimes can also be main) branch into your feature branch.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Git, a powerful version control system, is essential for managing and organizing files, especially in team environments. When working collaboratively, developers often create multiple branches to isolate their work. The git rebase command becomes crucial when you need to integrate changes from the master(sometimes can also be main) branch into your feature branch.&lt;/p&gt;
    &lt;h2 id=&quot;basic-rebase-command&quot;&gt;Basic Rebase Command:&lt;/h2&gt;
    &lt;p&gt;To perform a rebase, you&apos;ll first switch to your feature branch and then rebase it onto the master branch. This operation rewrites the project history by applying the changes made in the feature branch on top of the latest changes in the master branch.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout myBranch
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git rebase origin/master
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Rebasing is instrumental in maintaining a linear project history, which simplifies many aspects of version control. By avoiding the creation of unnecessary merge commits, it offers a cleaner alternative to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git merge&lt;/code&gt; command in certain workflows.&lt;/p&gt;
    &lt;h2 id=&quot;handling-conflicts&quot;&gt;Handling Conflicts&lt;/h2&gt;
    &lt;p&gt;Rebasing can sometimes lead to conflicts, especially if changes in the feature branch overlap with those in the master branch. To resolve these conflicts, you can use a merge tool, but in some scenarios, you might prefer a simpler solution.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout myBranch
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git rebase &lt;span class=&quot;nt&quot;&gt;--strategy-option&lt;/span&gt; ours origin/master
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git rebase &lt;span class=&quot;nt&quot;&gt;--strategy-option&lt;/span&gt; theirs origin/master
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The –strategy-option (or -X for short) flag allows you to specify how conflicts should be resolved:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;-X ours:&lt;/strong&gt; In case of a conflict, keep the changes from the master branch.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;-X theirs:&lt;/strong&gt; In case of a conflict, keep the changes from your feature branch (myBranch).&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h2 id=&quot;conflict-resolution-via-command-line&quot;&gt;Conflict Resolution via Command Line&lt;/h2&gt;
    &lt;p&gt;Open the conflicted files in your preferred text editor. Git marks the conflicts within the file. For example:&lt;/p&gt;
    &lt;pre&gt;&lt;code class=&quot;language-git&quot;&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; HEAD
    [Your branch&apos;s changes]
    =======
    [Conflicting changes from the branch you&apos;re rebasing onto]
    &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [Commit SHA]
    &lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;Manually edit the file to resolve the conflict. This often involves choosing between changes or merging them manually.&lt;/p&gt;
    &lt;p&gt;After resolving conflicts in all files, mark them as resolved using:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git add &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;file]
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Once all conflicts are resolved and changes are staged, continue the rebase process with:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git rebase &lt;span class=&quot;nt&quot;&gt;--continue&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Or you can use GUI tool to resolve conflicts like kdiff3, GitKraken, Sourcetree, or the Git integration in IDEs like Visual Studio Code.&lt;/p&gt;
    &lt;h2 id=&quot;best-practices&quot;&gt;Best Practices&lt;/h2&gt;
    &lt;p&gt;While using -X ours or -X theirs can be quick, it&apos;s often better to manually resolve conflicts using a merge tool. This approach ensures that you&apos;re making conscious decisions about the changes and maintaining the integrity of your codebase.&lt;/p&gt;
  </description>
  <pubDate>2023-11-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/git-rebase-tutorial</link>
<guid isPermaLink="true">https://randomwits.com/blog/git-rebase-tutorial</guid>
</item>
<item>
  <title>Understanding Kafka Deserializer</title>
  <description>&lt;p&gt;In Kafka, a deserializer is responsible for converting byte arrays from kafka topic into Java Objects. Kafka provides default deserializer for standard data types like strings and integers, but you can also implement custom deserializer for complex types.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In Kafka, a deserializer is responsible for converting byte arrays from kafka topic into Java Objects. Kafka provides default deserializer for standard data types like strings and integers, but you can also implement custom deserializer for complex types.&lt;/p&gt;
    &lt;p&gt;Usually you can encounter erro while consuming message from a kafka topic.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;No delegate deserializer configured&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;This error often occurs when using the &apos;ErrorHandlingDeserializer&apos; provided by Spring Kafka which acts as a wrapper around another deserializer (the delegate) to provide additional error-handling capabilities. If the delegate deserializer isn&apos;t configured properly, then &apos;ErrorHandlingDeserializer&apos; cannot function correctly.&lt;/p&gt;
    &lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Ensure that both the &apos;ErrorHandlingDeserializer&apos; and the delegate deserializer are correctly configured in &apos;application.yaml&apos;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Update the kafka consumer configuration in your Java code to use the correct deserializer classes based on the configuration.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;spring&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;kafka&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;consumer&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;key-deserializer&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;org.springframework.kafka.support.serializer.ErrorHandlingDeserializer&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;value-deserializer&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;org.springframework.kafka.support.serializer.ErrorHandlingDeserializer&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;properties&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;spring.deserializer.key.delegate.class&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;org.apache.kafka.common.serialization.StringDeserializer&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;spring.deserializer.value.delegate.class&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;org.apache.kafka.common.serialization.StringDeserializer&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can update our consumer to read those properties&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/78449a7e4798e0cff259776b097c8e02.js?file=Consumer.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-11-05T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/understanding-kafka-deserializer</link>
<guid isPermaLink="true">https://randomwits.com/blog/understanding-kafka-deserializer</guid>
</item>
<item>
  <title>Understanding Liskov Substitution Principle</title>
  <description>&lt;p&gt;The Liskov Substitution Principle, named after Barbara Liskov who introduced it in 1987, is one of the five SOLID principles of object-oriented design and programming. It states that&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;The Liskov Substitution Principle, named after Barbara Liskov who introduced it in 1987, is one of the five SOLID principles of object-oriented design and programming. It states that:&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;Objects of a superclass shall be replaceable with objects of a subclass without affecting the correctness of the program.&quot;&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;In simple terms, if a program is using a base class, it should be able to switch to a derived class without any unexpected behavior.&lt;/p&gt;
    &lt;h3 id=&quot;why-is-lsp-important&quot;&gt;Why is LSP Important?&lt;/h3&gt;
    &lt;p&gt;LSP emphasizes the importance of ensuring that a derived class doesn&apos;t just inherit the properties and behaviors of its base class but also adheres to its intended contract or behavior. By following LSP, developers can write more maintainable and scalable code, making it easier to add or modify subclasses without breaking existing functionality.&lt;/p&gt;
    &lt;h3 id=&quot;lsp-violated&quot;&gt;LSP Violated&lt;/h3&gt;
    &lt;p&gt;Imagine you&apos;re modeling a simple zoo management software and decide to use a basic inheritance hierarchy for birds.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Bird&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fly&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;I can fly&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Ostrich&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Bird&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fly&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UnsupportedOperationException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Ostriches can&apos;t fly&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;In this case, Ostrich is a subtype of Bird. However, since not all birds can fly (like the ostrich), our current design violates the Liskov Substitution Principle. If a function is designed to operate on a Bird, it might mistakenly call the fly method, causing an unexpected exception when an Ostrich object is passed.&lt;/p&gt;
    &lt;h3 id=&quot;a-better-design&quot;&gt;A Better Design&lt;/h3&gt;
    &lt;p&gt;To adhere to the LSP, we can refactor our design to ensure that every subtype of Bird can be replaced seamlessly.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
    &lt;span class=&quot;kd&quot;&gt;abstract&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Bird&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;abstract&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;move&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Sparrow&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Bird&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;move&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;I fly&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Ostrich&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Bird&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;move&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;I run&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;With this design, each bird defines its own move method. So, when a function expects a Bird, it can safely call the move method without any unexpected behavior.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;makeBirdMove&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Bird&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bird&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bird&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;move&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Sparrow&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mySparrow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Sparrow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Ostrich&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myOstrich&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Ostrich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;makeBirdMove&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mySparrow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// Outputs: &quot;I fly&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;makeBirdMove&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myOstrich&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// Outputs: &quot;I run&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2023-10-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/understanding-liskov-substitution-principle</link>
<guid isPermaLink="true">https://randomwits.com/blog/understanding-liskov-substitution-principle</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Oct 13, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Oct 13, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Oct 13, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;la-fitness&quot;&gt;La Fitness&lt;/h2&gt;
    &lt;p&gt;I ran a treadmill for over 2 miles. I took a break after every 0.5 mile. Since my right airpod is missing, I am learning to run without music. Not sure pros or cons of listening music while running. Nevertheless I dont have a choice.&lt;/p&gt;
    &lt;p&gt;Today was leg&apos;s day. Started with leg curl on machine. Next barbell squat and inclined leg press.&lt;/p&gt;
    &lt;h2 id=&quot;donnie-darko&quot;&gt;Donnie Darko&lt;/h2&gt;
    &lt;p&gt;I watched Donnie Darko today at Ayrsley Grand Cinema &lt;sup id=&quot;fnref:addr&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:addr&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. The film&apos;s conclusion, with its foray into time travel, genuinely piqued my interest. While its portrayal of wormholes and the underlying science felt somewhat superficial, it&apos;s evident that the movie leans more towards drama. From the outset, it paints a picture of a young man who seems to grapple with schizophrenia. The graphics may not have been groundbreaking, but the story&apos;s depth made up for it.&lt;/p&gt;
    &lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:addr&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;9110 Kings Parade Blvd, Charlotte, NC 28273 &lt;a href=&quot;#fnref:addr&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2023-10-13T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-10-13</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-10-13</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Oct 11, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log on Oct 11, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log on Oct 11, 2023.&lt;/p&gt;
    &lt;h3 id=&quot;doom-emacs&quot;&gt;Doom Emacs&lt;/h3&gt;
    &lt;p&gt;I wanted to try emacs again. I kind of ditched it since I started flirting with vim. First download emacs for &lt;a href=&quot;https://emacsformacosx.com/&quot;&gt;Mac&lt;/a&gt;. Next open you terminal&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone &lt;span class=&quot;nt&quot;&gt;--depth&lt;/span&gt; 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
    ~/.config/emacs/bin/doom &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;#  we need to make sure the directory does not exist&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; ~/.emacs.d/
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ~/.config/emacs/bin
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./doom &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Also, add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.config/emacs/bin&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;error-port-already-in-use&quot;&gt;Error: Port already in use&lt;/h3&gt;
    &lt;p&gt;Often we see error that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;port already in use&lt;/code&gt;. This happens when another process is already running on the port. Simpler solution is to restart the machine but sometimes that&apos;s too cumbersome.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Lets assume port 8082 is unavailable&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# we try to list all processs on this port&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;lsof &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; :8082
    &lt;span class=&quot;c&quot;&gt;# This will gives us the PID for each process&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# The (LISTEN) state indicates that this process is the one listening on the port&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# kill the process&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;kill&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-9&lt;/span&gt; PID
    &lt;span class=&quot;c&quot;&gt;# -9 option sends a SIGKILL signal, which forces the process to terminate immediately&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2023-10-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-10-11</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-10-11</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Oct 10, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log on Oct 10, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log on Oct 10, 2023.&lt;/p&gt;
    &lt;h3 id=&quot;from-coconut-to-peanuts&quot;&gt;From coconut to peanuts&lt;/h3&gt;
    &lt;p&gt;I recently came across a video where ISRO scientists were seen breaking a coconut, while their NASA counterparts shared &quot;lucky peanuts&quot;.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/RA4wZ5w8IIU?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/RA4wZ5w8IIU?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/RA4wZ5w8IIU/hqdefault.jpg alt=&apos; NASA-ISRO&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot; NASA-ISRO&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;The ritual of breaking a coconut is a customary practice not just in ISRO, but across various regions in India. The coconut, seen as a symbol of selflessness, is offered to ensure a successful venture. For ISRO, this has become a tradition before every satellite launch. Scientists and engineers break a coconut and offer prayers at a local shrine near the launch pad at the Sriharikota Range, hoping for a successful mission.&lt;/p&gt;
    &lt;p&gt;The tradition of lucky peanuts at NASA dates back to the Ranger missions in the 1960s. After facing six failures with Ranger missions aimed at the moon, the team at NASA&apos;s Jet Propulsion Laboratory (JPL) opened peanuts for good luck during the Ranger 7 launch. When the mission was a success, the &quot;lucky peanuts&quot; ritual was born. Since then, it has become customary for JPL staff to munch on peanuts during critical mission events, hoping for favorable outcomes.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;400&quot; src=&quot;/encrypted/2023-10-10-daily-logs-2023-10-10.html&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Daily log&quot;&gt;&lt;/iframe&gt;
    &lt;script&gt;
    $(document).ready(function() {
    $(&apos;iframe[title=&quot;Daily log&quot;]&apos;).on(&apos;load&apos;, function() {
    try {
    var iframeBody = this.contentWindow.document.body;
    var height = $(iframeBody).height();
    $(this).height(height);
    } catch (e) {
    console.error(&quot;Could not adjust iframe size:&quot;, e);
    }
    });
    });
    &lt;/script&gt;
  </description>
  <pubDate>2023-10-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-10-10</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-10-10</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Oct 7, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Oct 7, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Oct 7, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;musicophilia&quot;&gt;Musicophilia&lt;/h2&gt;
    &lt;p&gt;I am continuing reading &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Musicophilia&lt;/code&gt; by Olive Sacks. Below are the few notes I took while reading the book.&lt;/p&gt;
    &lt;h3 id=&quot;savant-syndrome&quot;&gt;Savant Syndrome&lt;/h3&gt;
    &lt;p&gt;It&apos;s a rare condition in which individuals with certain mental disabilities, like autism spectrum disorders, display remarkable talents or skills in specific areas such as music, mathematics, or art. Also people who sustain brain injuries may also unexpectedly develop savant-like abilities though this is rare.&lt;/p&gt;
    &lt;p&gt;The movie &lt;strong&gt;Rain Man&lt;/strong&gt; was inspired by Kim Peek, who had savant syndrome. This movie is on my bucket list.&lt;/p&gt;
    &lt;h3 id=&quot;is-blindness-connected-to-music&quot;&gt;Is Blindness connected to music?&lt;/h3&gt;
    &lt;p&gt;Thomas &quot;Blind Tom&quot; Wiggins was born into slavery in Georgia in the mid-19th century. Blind from birth, he exhibited prodigious musical talents from a young age. Remarkably, Wiggins could replicate complex musical pieces after hearing them just once, a talent that earned him widespread recognition as a musical savant. Beyond mere replication, he composed his own works and had an ability to improvise at the piano with great skill.&lt;/p&gt;
    &lt;p&gt;In India, Sūrdās, a 15th and 16th-century figure, was a renowned blind poet and musician. He is known for his writings on Lord Krishna, particularly the &quot;Sur Sagar,&quot; which is considered a central work in the Bhakti movement of North India.&lt;/p&gt;
    &lt;p&gt;Some research suggests that blind individuals, especially those who lose their sight early in life, often develop heightened auditory skills. This is attributed to their reliance on non-visual senses for perception. The brain, with its inherent plasticity, can adapt and reorganize, allowing regions initially devoted to visual processing to aid auditory functions. This compensatory mechanism can lead to an enhanced ability to discern musical tones, rhythms, and intricate structures, possibly providing a foundation for exceptional musical talents.&lt;/p&gt;
  </description>
  <pubDate>2023-10-07T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-10-07</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-10-07</guid>
</item>
<item>
  <title>Sunscreen for Dummies</title>
  <description>&lt;p&gt;When it comes to selecting sunscreen, the options might seem overwhelming. With an array of brands and SPF numbers on the shelves, it&apos;s essential to understand what these numbers mean and the importance of using sunscreen. Let&apos;s delve into the science behind it.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When it comes to selecting sunscreen, the options might seem overwhelming. With an array of brands and SPF numbers on the shelves, it&apos;s essential to understand what these numbers mean and the importance of using sunscreen. Let&apos;s delve into the science behind it.&lt;/p&gt;
    &lt;h3 id=&quot;what-is-sunscreen-and-why-do-we-need-it&quot;&gt;What is Sunscreen and Why Do We Need It?&lt;/h3&gt;
    &lt;p&gt;Sunscreen is a product designed to protect our skin from the sun&apos;s harmful ultraviolet (UV) rays. These UV rays are a type of electromagnetic radiation emitted by the sun. While the visible light that we perceive with our eyes ranges from approximately 400 to 700 nanometers (nm) in wavelength, the sun also emits UV rays which fall outside of this visible spectrum.&lt;/p&gt;
    &lt;p&gt;Specifically, UV rays are categorized into two primary types based on their wavelengths:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;UVA rays: These have wavelengths ranging from 315 to 400 nm. They are known for causing premature skin aging and potentially contributing to skin cancer.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;UVB rays: These have wavelengths ranging from 280 to 315 nm. They are primarily responsible for sunburn and play a key role in the development of skin cancer.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Fun Fact: Bees can see ultraviolet light, a capability that humans lack. This ability helps them locate flowers and navigate.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Sunscreen works by incorporating active ingredients that either absorb, reflect, or scatter harmful UV rays, preventing them from penetrating the skin.&lt;/p&gt;
    &lt;h3 id=&quot;understanding-spf&quot;&gt;Understanding SPF&lt;/h3&gt;
    &lt;p&gt;The term &quot;SPF&quot; stands for &quot;Sun Protection Factor.&quot; Contrary to common misconceptions, the SPF number does not represent the percentage of UV protection. Instead, it indicates how much longer you can stay in the sun without getting sunburned compared to not wearing any sunscreen. For example, an SPF 15 sunscreen theoretically allows you to stay in the sun 15 times longer without getting burned.&lt;/p&gt;
    &lt;p&gt;However, the protection is not linear:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;SPF 15 filters out about 93% of UVB rays&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;SPF 30 filters out about 97% of UVB rays&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;SPF 50 filters out about 98% of UVB rays&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;No sunscreen can block 100% of UV rays. While higher SPF sunscreens provide slightly better protection, the increase becomes marginal after a certain point.&lt;/p&gt;
    &lt;h3 id=&quot;is-there-a-concern-with-using-too-much-sunscreen&quot;&gt;Is There a Concern with Using Too Much Sunscreen?&lt;/h3&gt;
    &lt;p&gt;While sunscreen is vital for protecting against UV damage, some concerns have been raised about excessive use:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Vitamin D Deficiency:&lt;/strong&gt; Sunlight helps our skin produce vitamin D. Over-reliance on sunscreen can potentially reduce vitamin D production, leading to deficiencies. However, it&apos;s important to strike a balance – short periods of sun exposure without sunscreen can aid in vitamin D synthesis.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Chemical Exposure:&lt;/strong&gt; Some sunscreens contain chemicals that may have potential health concerns. For instance, ingredients like oxybenzone and octinoxate, while effective UV filters, have raised concerns due to their potential endocrine-disrupting properties.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Skin Cancer Concerns:&lt;/strong&gt; There&apos;s no direct evidence suggesting that sunscreen use promotes skin cancer. However, relying solely on sunscreen and neglecting other protective measures, like wearing hats and protective clothing, can give a false sense of security and potentially increase sun exposure, raising skin cancer risk.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Avoid sunscreen which contains oxybenzone and octinoxate&lt;/strong&gt;: Look for reef-safe and mineral-based sunscreens like Zinc Oxide and Titanium dioxide. These sit on skin and reflect UV rays instead of being absorbed. Zinc Oxide and Titanium dioxide are usually considered safe [^ewg].&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;reef-safe-sunscreens&quot;&gt;Reef-Safe Sunscreens&lt;/h3&gt;
    &lt;p&gt;With the increasing awareness of environmental concerns, many sunscreens now tout being &quot;reef-safe.&quot; These sunscreens are formulated without oxybenzone and octinoxate, two common sunscreen ingredients that have been found to be harmful to coral reefs. If you&apos;re planning a trip to an area with coral reefs or want to make an eco-conscious choice, it&apos;s advisable to opt for a reef-safe sunscreen.&lt;/p&gt;
    &lt;p&gt;Several tourist destinations around the world, particularly those with sensitive marine ecosystems, have started regulating the use of sunscreens. Some places have even gone to the extent of banning sunscreens that aren&apos;t labeled as &quot;reef-safe&quot;. These regulations are in response to scientific findings that certain chemicals found in many sunscreens, like oxybenzone and octinoxate, can cause coral bleaching and are harmful to marine life.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Hawaii:&lt;/strong&gt; In 2018, Hawaii became the first US state to pass a bill banning the sale of sunscreens containing the chemicals oxybenzone and octinoxate, effective from January 1, 2021.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Palau:&lt;/strong&gt; The Pacific island nation of Palau took a similar approach, banning sunscreens with any of the ten key ingredients believed to harm marine life. This regulation took effect in 2020.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Key West, Florida:&lt;/strong&gt; Following suit, Key West in Florida also voted to ban the sale of sunscreens containing oxybenzone and octinoxate from January 2021.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Mexican Caribbean:&lt;/strong&gt; Some parts of the Mexican Caribbean, including protected marine areas around Cancun, Cozumel, and Playa del Carmen, have regulations urging tourists to use only biodegradable or reef-safe sunscreens.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Many of these destinations either outright ban non-reef-safe sunscreens or strongly encourage tourists to opt for biodegradable alternatives. Some dive shops, hotels, and tour operators even provide reef-safe sunscreen samples or sell them as part of their commitment to marine conservation.&lt;/p&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
  </description>
  <pubDate>2023-10-05T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/guide-sunscreen</link>
<guid isPermaLink="true">https://randomwits.com/blog/guide-sunscreen</guid>
</item>
<item>
  <title>Delving into CommandLineRunner in Spring Boot</title>
  <description>&lt;p&gt;Spring Boot provides a range of functionalities that allow developers to run specific code blocks during the application&apos;s lifecycle. One such feature is the CommandLineRunner interface. This interface is specifically designed to execute a code block just once, right after the Spring Boot application has initialized. This can be particularly useful for tasks like database seeding, running sanity checks, or any other initialization logic you want to run before your application begins processing.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Spring Boot provides a range of functionalities that allow developers to run specific code blocks during the application&apos;s lifecycle. One such feature is the CommandLineRunner interface. This interface is specifically designed to execute a code block just once, right after the Spring Boot application has initialized. This can be particularly useful for tasks like database seeding, running sanity checks, or any other initialization logic you want to run before your application begins processing.&lt;/p&gt;
    &lt;p&gt;There are a few ways to utilize the CommandLineRunner in a Spring Boot application. Let&apos;s explore them:&lt;/p&gt;
    &lt;h2 id=&quot;using-component-annotation&quot;&gt;Using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Component&lt;/code&gt; Annotation&lt;/h2&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/e0d44e13920719e6b27abadcd03294e9.js?file=ApplicationStartupRunner.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&lt;strong&gt;Quiz:&lt;/strong&gt; What&apos;s the role of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Component&lt;/code&gt; annotation in Spring?&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;button class=&quot;quiz-btn&quot; data-showing=&quot;false&quot; data-answer=&quot;answer1&quot;&gt;Show Answer&lt;/button&gt;&lt;/p&gt;
    &lt;div class=&quot;quiz-answer&quot; id=&quot;answer1&quot;&gt;
    The `@Component` annotation is used in Spring to indicate that a class should be considered as a Spring-managed component. When the application context is being created, classes annotated with `@Component` are auto-detected and a bean instance is created for them in the Spring container.
    &lt;/div&gt;
    &lt;h2 id=&quot;integrating-with-springbootapplication&quot;&gt;Integrating with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@SpringBootApplication&lt;/code&gt;&lt;/h2&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/e0d44e13920719e6b27abadcd03294e9.js?file=DemoCommandLineApplication.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Quick Quiz: Explain the syntax &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;String....&lt;/code&gt; How is it different than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;String[] args&lt;/code&gt; in Java?&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;button class=&quot;quiz-btn&quot; data-showing=&quot;false&quot; data-answer=&quot;answer2&quot;&gt;Show Answer&lt;/button&gt;&lt;/p&gt;
    &lt;div class=&quot;quiz-answer&quot; id=&quot;answer2&quot;&gt;
    The String... syntax in Java denotes a varargs (variable number of arguments). It allows you to pass any number of arguments when invoking a method. Internally, varargs are treated as an array. The key difference between String... args and String[] args is in how you call the method. With varargs (String... args), you can call the method with multiple string arguments directly, without having to create an array. With String[] args, you&apos;d need to pass an array of strings. However, inside the method body, args behaves like an array in both cases.
    &lt;/div&gt;
  </description>
  <pubDate>2023-10-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/commandlinerunner-spring-boot</link>
<guid isPermaLink="true">https://randomwits.com/blog/commandlinerunner-spring-boot</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Oct 3, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Oct 3, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Oct 3, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;shingles&quot;&gt;Shingles&lt;/h2&gt;
    &lt;p&gt;I was talking to my collegue during lunch who told me about shingles. He previously worked in some litigation law firm. He said that stress on his previous job caused him shingles.&lt;/p&gt;
    &lt;p&gt;This is the first time I heard about shingles. What the heck is that and how is related to stress?&lt;/p&gt;
    &lt;p&gt;Shingles is a painful rash caused by viral infection that means it&apos;s caused by a virus and not bacteria. It&apos;s nothing but a chickenpox virus which is also called varicella-zoster virus. If it&apos;s a same virus, then why have two different names?&lt;/p&gt;
    &lt;p&gt;Chickenpox is a primary infection. It usually occurs in childhood. Symptoms include fever, fatigue, loss of appetite, and a characteristic itchy rash. The rash starts as red spots which become raised and then form fluid-filled blisters. These blisters can spread all over the body.&lt;/p&gt;
    &lt;p&gt;Once you&apos;ve been infected with the varicella-zoster virus (VZV) — the virus responsible for chickenpox — the virus doesn&apos;t completely leave your body. After the active chickenpox infection resolves, the virus becomes dormant and retreats to nerve cells near the spinal cord and brain, where it remains for the rest of a person&apos;s life.&lt;/p&gt;
    &lt;p&gt;Shingles is a reactivation of the varicella-zoster virus that has been dormant in the nerve cells since a person had chickenpox. What causes reactivation?&lt;/p&gt;
    &lt;p&gt;Stress can be a trigger for shingles in some individuals. When a person experiences significant stress, their immune system may weaken, making it less effective at keeping the varicella-zoster virus in check. Anecdotal evidence of my collegue also confirms that stress can cause shingles.&lt;/p&gt;
    &lt;p&gt;This is one more reason not to take stress in life.&lt;/p&gt;
  </description>
  <pubDate>2023-10-03T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-10-03</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-10-03</guid>
</item>
<item>
  <title>Empty s3 bucket and Delete using Jenkins and AWS CLI</title>
  <description>&lt;p&gt;Amazon Simple Storage Service (s3) is a scalable object storage service provided by AWS. It allows users to store and retrieve vast amount of data, make it a fundamental building block for many applications hosted on AWS. Deleting a s3 bucket is a two step process: empty a s3 bucket and then delete a s3 bucket.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Amazon Simple Storage Service (s3) is a scalable object storage service provided by AWS. It allows users to store and retrieve vast amount of data, make it a fundamental building block for many applications hosted on AWS. Deleting a s3 bucket is a two step process: empty a s3 bucket and then delete a s3 bucket.&lt;/p&gt;
    &lt;h3 id=&quot;deleting-bucket-without-versioning&quot;&gt;Deleting bucket without versioning&lt;/h3&gt;
    &lt;p&gt;If a bucket has no versioning, we can empty s3 bucket using aws cli via jenkins&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/eec7e619c93f9f2c2874d26833200bce.js?file=pipeline1.groovy&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;If there&apos;s versioning, then it will fail with the following error:&lt;/p&gt;
    &lt;pre&gt;&lt;code class=&quot;language-none&quot;&gt;The bucket you tried to delete is not empty. You must delte all versions in the bucket.
    &lt;/code&gt;&lt;/pre&gt;
    &lt;h3 id=&quot;understanding-s3-versioning-and-delete-markers&quot;&gt;Understanding s3 versioning and delete markers&lt;/h3&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Versioning&lt;/strong&gt;: It allows you to preserve, retrieve, and restore every version of every object in a bucket. Once enabled, it cannot be suspended, only disabled.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Delete Markers&lt;/strong&gt;: Once you delete a versioned object in s3, a delete marker is inserted. This marker becomes the current version, simulating a &quot;delete&quot; operatings but not actually removing the object.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;deleting-bucket-with-versioning&quot;&gt;Deleting bucket with versioning&lt;/h3&gt;
    &lt;p&gt;We need to delete all versions and delete markers to empty the s3 bucket.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/eec7e619c93f9f2c2874d26833200bce.js?file=pipeline2.groovy&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-09-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/s3-bucket-empty-delete-aws-cli-jenkins</link>
<guid isPermaLink="true">https://randomwits.com/blog/s3-bucket-empty-delete-aws-cli-jenkins</guid>
</item>
<item>
  <title>Understanding final vs Static final in Java</title>
  <description>&lt;p&gt;Java provides various modifiers to control the behavior of classes, methods, and variables. Two such modifiers are final and static final. Let&apos;s delve deeper into their significance and differences.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Java provides various modifiers to control the behavior of classes, methods, and variables. Two such modifiers are final and static final. Let&apos;s delve deeper into their significance and differences.&lt;/p&gt;
    &lt;h2 id=&quot;final-modifier&quot;&gt;Final modifier&lt;/h2&gt;
    &lt;p&gt;When you come across the final keyword in Java, think of it as a way to make something unchangeable or immutable.&lt;/p&gt;
    &lt;h3 id=&quot;variables&quot;&gt;Variables&lt;/h3&gt;
    &lt;p&gt;When the final keyword is applied to variables, it ensures that once a variable is assigned a value, it cannot be reassigned. Every instance of the class will have its own separate copy of this final variable.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4222e65309873ad070e54a467871ec68.js?file=MyClass.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;methods&quot;&gt;Methods&lt;/h3&gt;
    &lt;p&gt;A final method cannot be overridden in subclasses. This is useful when you want to lock the behavior of a method, ensuring that no subclass can change its implementation.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4222e65309873ad070e54a467871ec68.js?file=ChildClass.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;classes&quot;&gt;Classes&lt;/h3&gt;
    &lt;p&gt;A final class cannot be subclassed. This is often done for security reasons or to ensure the design integrity of a class.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4222e65309873ad070e54a467871ec68.js?file=FinalClass.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;static-final&quot;&gt;Static Final&lt;/h2&gt;
    &lt;h3 id=&quot;variables-1&quot;&gt;Variables&lt;/h3&gt;
    &lt;p&gt;A static final variable belongs to the class and not any specific instance. It&apos;s also immutable. Value can only be assigned at point of declaration or within a static initizlizer block. An initializer block is a chunk of code that runs when the class is first loaded into memory. It runs only once, regardless of how many instance of the class.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4222e65309873ad070e54a467871ec68.js?file=StaticFinal.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-08-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/understanding-java-final-static-final</link>
<guid isPermaLink="true">https://randomwits.com/blog/understanding-java-final-static-final</guid>
</item>
<item>
  <title>Getting Started With Parquet File Format</title>
  <description>&lt;p&gt;Data can be broadly categorized into three types based on its structure: Unstructured, semi-unstructured, structured data.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h3 id=&quot;overview&quot;&gt;Overview&lt;/h3&gt;
    &lt;p&gt;Data can be broadly categorized into three types based on its structure:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Unstructured Data: This includes formats like CSV, TXT which don&apos;t have a specific structure or schema.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Semi-Structured Data: Data formats like XML and JSON fall into this category. They have a flexible schema but still maintain some level of structure.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Structured Data: Formats like Avro and Parquet are considered structured as they have a defined schema.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;parquet-overview&quot;&gt;Parquet Overview&lt;/h3&gt;
    &lt;p&gt;Parquet is a popular choice for big data processing tasks, and here&apos;s why:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Binary Format with Efficient Compression: Parquet is a binary file format. By default, it uses the Snappy compression algorithm when used with Apache Spark, which provides a good balance between compression ratio and speed.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Columnar Storage: Unlike row-based files, Parquet is columnar. This means it supports column pruning and predicate pushdown, which can significantly speed up queries.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Optimized for WORM: Parquet is optimized for Write Once, Read Many (WORM) operations. This makes it a preferred choice for data lakes and big data processing tasks.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;how-to-choose-a-good-partition-column&quot;&gt;How to Choose a Good Partition Column&lt;/h3&gt;
    &lt;p&gt;When working with Parquet in big data systems like Spark, choosing the right partition column is crucial. Here are some guidelines:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Avoid High Cardinality Columns: If a column has a lot of unique values, it will create numerous directories. This leads to more overhead during parsing.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Filterable Columns: Choose columns that are frequently used as filters in queries. For example, if you often filter data by a specific &quot;date&quot; or &quot;region&quot;, those might be good partitioning candidates.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Low Cardinality Columns: Columns with low cardinality create a small number of directories but each directory contains a large amount of data. This can optimize read operations.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Trial and Error: Sometimes, the best way to determine the optimal partition column is through experimentation. Monitor the performance of your queries and adjust accordingly.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;benchmarking-txt-vs-parquet&quot;&gt;Benchmarking TXT vs. Parquet&lt;/h3&gt;
    &lt;p&gt;Ensure you have the necessary libraries:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip install pyspark pandas pyarrow
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Benchmarking with Spark&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/fa3ac375801b222a3f1268939bd3a608.js?file=benchmark.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Output is&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/fa3ac375801b222a3f1268939bd3a608.js?file=benchmark.txt&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-08-28T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/getting-started-with-parquet-file-format</link>
<guid isPermaLink="true">https://randomwits.com/blog/getting-started-with-parquet-file-format</guid>
</item>
<item>
  <title>Resolving Netty&apos;s DNS Resolution Error on MacOS M1 Systems</title>
  <description>&lt;p&gt;Developers using Netty on MacOS M1 systems may encounter an error indicating a missing DNS resolver library. This error arises because Netty utilizes native code for optimal DNS resolution, and the necessary library might not be present on M1 systems.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Developers using Netty on MacOS M1 systems may encounter an error indicating a missing DNS resolver library. This error arises because Netty utilizes native code for optimal DNS resolution, and the necessary library might not be present on M1 systems.&lt;/p&gt;
    &lt;h2 id=&quot;error&quot;&gt;Error&lt;/h2&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;Unable to load io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider, fallback to system defaults. This may result in incorrect DNS resolutions on MacOS. Check whether you have a dependency on &apos;io.netty:netty-resolver-dns-native-macos&apos;.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b25327b11fa0d1f42f9ccd2f05235817.js?file=Error.txt&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;cause&quot;&gt;Cause&lt;/h2&gt;
    &lt;p&gt;Netty uses native code to interface with the system&apos;s DNS resolver for optimal performance. On MacOS systems, especially those with the M1 chip, the required native library might be missing, leading to the aforementioned error. The solution is to explicitly provide this native library.&lt;/p&gt;
    &lt;h2 id=&quot;solution&quot;&gt;Solution&lt;/h2&gt;
    &lt;p&gt;For projects managed with Gradle, you need to include the following dependency in your build.gradle file:&lt;/p&gt;
    &lt;h3 id=&quot;gradle&quot;&gt;Gradle&lt;/h3&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;runtimeOnly(&quot;io.netty:netty-resolver-dns-native-macos:4.1.76.Final:osx-aarch_64&quot;)&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b25327b11fa0d1f42f9ccd2f05235817.js?file=build.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;maven&quot;&gt;Maven&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b25327b11fa0d1f42f9ccd2f05235817.js?file=pom.xml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-08-26T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/unable-to-load-io-netty-resolver-dns-macos-macosdnsserveraddressstreamprovider</link>
<guid isPermaLink="true">https://randomwits.com/blog/unable-to-load-io-netty-resolver-dns-macos-macosdnsserveraddressstreamprovider</guid>
</item>
<item>
  <title>Week3 August Reflection 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is third weekly reflection for Aug, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is third weekly reflection for Aug, 2023.&lt;/p&gt;
    &lt;h3 id=&quot;picking-a-stock&quot;&gt;Picking a stock&lt;/h3&gt;
    &lt;p&gt;It&apos;s been months since I bought any stocks. Recently I sold &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$SAIC&lt;/code&gt; stock. But picking a stocks is a tedious process for me. I want to invest in stock or ETF this month.&lt;/p&gt;
    &lt;p&gt;First I calculate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;moving average&lt;/code&gt; for each stocks.&lt;/p&gt;
    &lt;p&gt;Another filter I try use is to pick stocks with dividend. Even if the stocks plummet in its value, you can still grow your portfolios by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reinvesting dividend&lt;/code&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;commute-to-office&quot;&gt;Commute to office&lt;/h3&gt;
    &lt;p&gt;It takes me almost 30 minutes to reach to office. Most of the time I am stuck at morning traffic. I have few options how to utilitze this time while on car&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Call home (talk to parents at Indian time)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Listen to music.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Listen to audiobooks or a podcast.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Watch a movie.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Listen to pink/white noise.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Learn spanish.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Watching a movie always make me nervous as it may not be legal to watch while driving. Even audiobooks distracts me. I have sleep apnea so I don&apos;t like talking to anyone in the morning. If I was commuting on a train, I would probably add reading. So it boils down to these choices.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Listen to music.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Listen to pink/white noise.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Learn Spanish.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;food&quot;&gt;Food&lt;/h3&gt;
    &lt;h4 id=&quot;restaurants&quot;&gt;Restaurants&lt;/h4&gt;
    &lt;p&gt;I bought P.F. Chang&apos;s Chicken Lo Mein from Food lion. It was frozen and I probably not going to purchase it again. The only frozen noodles that I liked so far were Ajinomoto Vegetable Yakisoba from costco. But I dont have costco membership anymore.&lt;/p&gt;
    &lt;p&gt;I also ate at following resturants this week (I would probably would go bankrupt spending money on food):&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Chipotle: Bowl with no rice, both beans, chicken, fajitas, tomatoes, corn, guac, no lettuce.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Panera: Buy two option. Baja Bowl (extra avacado) with tomato soup.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Taco Bell: Power menu bowl with chicken and black bean chalupa supreme.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Tikka Shack: Spinach Masala with extra veggies, chicken and rice.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Ilios crafted greek: Chicken Sandwitch with beet salad.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Chick-fil-A: Grilled sandwitch wtih Cobb salad. I really liked Charred Tomato Crispy Red Bell Peppers.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h4 id=&quot;recipe&quot;&gt;Recipe&lt;/h4&gt;
    &lt;ol&gt;
    &lt;li&gt;Rajma (kidney beans)&lt;/li&gt;
    &lt;/ol&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Soak Rajma overnight in water.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Pressure cook in Insatapot for 20 min with water.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Add avacado oil on a pan. Saute with mustard seeds. Add chopped onion, masala, chopped tomatoes. Let it cook in medium heat for 10 minutes.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Mix rajma in the gravy.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Best enjoyed with cooked rice on the side.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;video-games&quot;&gt;Video Games&lt;/h3&gt;
    &lt;p&gt;I am enjoying playing Fifa 19. I mostly play Journey mode. I enjoy shuffling between three characters. Also playing soccer with controller is much more fun compare to shooting game.&lt;/p&gt;
    &lt;h3 id=&quot;car-registration-renew&quot;&gt;Car Registration Renew&lt;/h3&gt;
    &lt;p&gt;I had to renew my car registration &lt;a href=&quot;https://payments.ncdot.gov/&quot;&gt;online&lt;/a&gt;. Earlier I also did a car state inspection from Firestone. I was bummed when Firestone told me that my car inspection can only pass if I replace my beam wiper blade for \$53. I don&apos;t know if they charged me legit this was really required or they duped me into buyting it. But I acquiesced as I really wanted leave that place after waiting for more than two hours. State Inspection cost me \$30 with labor.&lt;/p&gt;
    &lt;h3 id=&quot;pratice-against-ping-pong-robot&quot;&gt;Pratice against ping pong robot&lt;/h3&gt;
    &lt;p&gt;There&apos;s a ping pong robot at Table tennis club, Charlotte. It&apos;s fun to pratice against it. However I am not seeing any improvement in my game. Last Thursday&apos;s league game, I had the worst performance.  I had few nice serves but made too many &lt;strong&gt;unforced errors&lt;/strong&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;tennis&quot;&gt;Tennis&lt;/h3&gt;
    &lt;p&gt;I am trying to improve my backend return. I had a an hour coaching with Zack in Huntersville for tennis for $50. He showed me how to use a backhand properly. I am still trying to improve it.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/NSQSnyVZK5k?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/NSQSnyVZK5k?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/NSQSnyVZK5k/hqdefault.jpg alt=&apos;NSQSnyVZK5k&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;NSQSnyVZK5k&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/p2Jw1N-eWuM?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/p2Jw1N-eWuM?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/p2Jw1N-eWuM/hqdefault.jpg alt=&apos;p2Jw1N-eWuM&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;p2Jw1N-eWuM&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;espp-contribution&quot;&gt;ESPP contribution&lt;/h3&gt;
    &lt;p&gt;An employee stock purchase plan (ESPP) is a company-run program in which participating employees can purchase company stock at a discounted price.&lt;/p&gt;
    &lt;p&gt;I have contributed 7% of my paycheck. I will need to read more about it to understand more.&lt;/p&gt;
    &lt;h3 id=&quot;programming&quot;&gt;Programming&lt;/h3&gt;
    &lt;p&gt;I solved leetcode problem: &lt;a href=&quot;/blog/time-based-key-value-store-solution&quot;&gt;time based key-value store&lt;/a&gt;&lt;/p&gt;
  </description>
  <pubDate>2023-08-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/week3-august-reflection-2023</link>
<guid isPermaLink="true">https://randomwits.com/blog/week3-august-reflection-2023</guid>
</item>
<item>
  <title>Why Math.max() is Less Than Math.min() in JavaScript</title>
  <description>&lt;p&gt;JavaScript is full of surprises and unexpected behaviors that often leave developers scratching their heads. One of those strange behaviors is the fact that Math.max() &amp;lt; Math.min() is true in JavaScript. In this blog, we&apos;ll delve into the underlying reasons for this seemingly paradoxical result.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;JavaScript is full of surprises and unexpected behaviors that often leave developers scratching their heads. One of those strange behaviors is the fact that Math.max() &amp;lt; Math.min() is true in JavaScript. In this blog, we&apos;ll delve into the underlying reasons for this seemingly paradoxical result.&lt;/p&gt;
    &lt;h3 id=&quot;a-tale-of-two-functions&quot;&gt;A Tale of Two Functions&lt;/h3&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math&lt;/code&gt; object in JavaScript provides a collection of properties and methods for performing mathematical operations. Two of the most commonly used methods are Math.max() and Math.min().&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.max()&lt;/code&gt; returns the largest of zero or more numbers.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.min()&lt;/code&gt; returns the smallest of zero or more numbers.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;At first glance, it would seem impossible for the maximum of a set of numbers to be less than the minimum of the same set. But, as we will see, there&apos;s a catch when we don&apos;t provide any arguments to these functions.&lt;/p&gt;
    &lt;h3 id=&quot;dealing-with-no-arguments&quot;&gt;Dealing with No Arguments&lt;/h3&gt;
    &lt;p&gt;When you call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.max()&lt;/code&gt; with no arguments, it returns -Infinity, which represents negative infinity in JavaScript. Similarly, when you call Math.min() with no arguments, it returns Infinity, which represents positive infinity in JavaScript.&lt;/p&gt;
    &lt;p&gt;These results might seem counterintuitive, but they&apos;re based on the behavior of these functions when dealing with an empty set of numbers.&lt;/p&gt;
    &lt;h3 id=&quot;why-does-this-happen&quot;&gt;Why Does This Happen?&lt;/h3&gt;
    &lt;p&gt;The logic behind this behavior lies in the definition of the functions:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.max()&lt;/code&gt;: When given an empty set, it assumes that every real number is smaller than the largest number in the set. Since there are no numbers in the set, it defaults to -Infinity.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Math.min()&lt;/code&gt;: When given an empty set, it assumes that every real number is larger than the smallest number in the set. Since there are no numbers in the set, it defaults to Infinity.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;the-inequality-in-question&quot;&gt;The Inequality in Question&lt;/h3&gt;
    &lt;p&gt;As a result, the following inequality is indeed true in JavaScript:&lt;/p&gt;
    &lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// evaluates to true&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This is because -Infinity &amp;lt; Infinity is a valid statement in the world of mathematics.&lt;/p&gt;
  </description>
  <pubDate>2023-08-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/why-math-max-is-less-than-math-min-in-javascript</link>
<guid isPermaLink="true">https://randomwits.com/blog/why-math-max-is-less-than-math-min-in-javascript</guid>
</item>
<item>
  <title>Time Based Key-Value Store Solution</title>
  <description>&lt;p&gt;Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key&apos;s value at a certain timestamp.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key&apos;s value at a certain timestamp.&lt;/p&gt;
    &lt;h4 id=&quot;problem-statement&quot;&gt;Problem statement&lt;/h4&gt;
    &lt;p&gt;Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key&apos;s value at a certain timestamp.&lt;/p&gt;
    &lt;p&gt;Implement the TimeMap class:&lt;/p&gt;
    &lt;p&gt;TimeMap() Initializes the object of the data structure.
    void set(String key, String value, int timestamp) Stores the key key with the value value at the given time timestamp.
    String get(String key, int timestamp) Returns a value such that set was called previously, with timestamp_prev &amp;lt;= timestamp. If there are multiple such values, it returns the value associated with the largest timestamp_prev. If there are no values, it returns &quot;&quot;.&lt;/p&gt;
    &lt;h4 id=&quot;first-attempt&quot;&gt;First Attempt&lt;/h4&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/1860d33b9fc700c49c0d5dbd1cc348dc.js?file=Solution1.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;It failed with error : Time Limit Exceeded.&lt;/p&gt;
    &lt;h4 id=&quot;second-attempt&quot;&gt;Second Attempt&lt;/h4&gt;
    &lt;p&gt;Instead of using List, I can try using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TreeMap&lt;/code&gt;. A TreeMap is a Red-Black tree-based NavigableMap implementation that stores keys in sorted order.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/1860d33b9fc700c49c0d5dbd1cc348dc.js?file=Solution2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;floorEntry&lt;/code&gt; method of the TreeMap to get the closest timestamp lower than or equal to the requested timestamp.&lt;/p&gt;
    &lt;p&gt;Consider a TreeMap with the following key-value pairs: {1: &quot;a&quot;, 3: &quot;b&quot;, 5: &quot;c&quot;}. Let&apos;s assume you call the floorEntry method with the argument 4. Since 4 is greater than 3 but less than 5, the method will return the entry with the key 3 and value &quot;b&quot;.&lt;/p&gt;
  </description>
  <pubDate>2023-08-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/time-based-key-value-store-solution</link>
<guid isPermaLink="true">https://randomwits.com/blog/time-based-key-value-store-solution</guid>
</item>
<item>
  <title>Understanding Date Formatting in Angular</title>
  <description>&lt;p&gt;Angular provides the DatePipe for formatting dates. You can use it directly in your templates with the pipe syntax, or you can use it programmatically in your components.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Angular provides the DatePipe for formatting dates. You can use it directly in your templates with the pipe syntax, or you can use it programmatically in your components.&lt;/p&gt;
    &lt;h3 id=&quot;using-datepipe-in-templates&quot;&gt;Using DatePipe in Templates&lt;/h3&gt;
    &lt;p&gt;This is the simplest way to format a date in Angular. In your component&apos;s HTML template, you can use the DatePipe with the pipe syntax &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;|&lt;/code&gt; to transform a date value.&lt;/p&gt;
    &lt;p&gt;For example, if you have a date value endDate in your component, you can format it in the template like this:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/3e9d22bd1078e502e7ca858134379f4d.js?file=component.html&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Here, &apos;short&apos; is one of the predefined format options. It will display the date in a short format.&lt;/p&gt;
    &lt;h3 id=&quot;using-datepipe-in-a-component&quot;&gt;Using DatePipe in a Component&lt;/h3&gt;
    &lt;p&gt;If you want to format a date in your component&apos;s TypeScript code, you can do so by injecting the DatePipe into your component.&lt;/p&gt;
    &lt;p&gt;First, add DatePipe to your providers array in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.module.ts&lt;/code&gt;. This step is necessary because when you want to use a service (like DatePipe) in your component, Angular needs to know where it should create or find an instance of that service. By adding it to the providers array, you&apos;re telling Angular that it should be available for injection in this module.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/3e9d22bd1078e502e7ca858134379f4d.js?file=app.module.ts&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Next, import the DatePipe from @angular/common in your component file.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/3e9d22bd1078e502e7ca858134379f4d.js?file=component1.ts&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In your component&apos;s TypeScript file, inject the DatePipe into your component&apos;s constructor.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/3e9d22bd1078e502e7ca858134379f4d.js?file=component2.ts&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Lastly, use the DatePipe to format dates in your component&apos;s code&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/3e9d22bd1078e502e7ca858134379f4d.js?file=component3.ts&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Here, the transform method of DatePipe is used to format the date. The result is stored in the formattedDate variable, which you can then use in your template or anywhere else in your component.&lt;/p&gt;
  </description>
  <pubDate>2023-08-18T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/understanding-date-formatting-in-angular</link>
<guid isPermaLink="true">https://randomwits.com/blog/understanding-date-formatting-in-angular</guid>
</item>
<item>
  <title>Observable Tutorial in Angular</title>
  <description>&lt;p&gt;Observables provide support for passing messages between parts of your application. They are use frequently in Angular applications for handling async data flows.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Observables provide support for passing messages between parts of your application. They are use frequently in Angular applications for handling async data flows.&lt;/p&gt;
    &lt;h3 id=&quot;what-are-observables&quot;&gt;What are observables?&lt;/h3&gt;
    &lt;p&gt;An observable is a stream of data that we can subscribe to. It emits new values over time that we can react to.&lt;/p&gt;
    &lt;p&gt;For example, an Observable from a HTTP request would emit the response when the request completes. Or a time Observalbe could emit values at regular interval.&lt;/p&gt;
    &lt;p&gt;Observable help us handle asynchronous data flows in a declarative style.  We define the Observable data stream and then subscribe to it to get notified of new values.&lt;/p&gt;
    &lt;h3 id=&quot;getting-started&quot;&gt;Getting started&lt;/h3&gt;
    &lt;p&gt;Create a new angular app.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ng new angular-observables-demo
    &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;angular-observables-demo
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Add Boostrap&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--save&lt;/span&gt; bootstrap@latest
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;and import it in  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;src/styles.css&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;@import&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&apos;~bootstrap/dist/css/bootstrap.min.css&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Building a UserService&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ng generate service user
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;And add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user.service.ts&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/abe9eec9e3361f5901b9221b5758e726.js?file=user.service.ts&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;It returns an observable of the HTTP response.&lt;/p&gt;
    &lt;h3 id=&quot;subscribing-in-the-component&quot;&gt;Subscribing in the component&lt;/h3&gt;
    &lt;p&gt;Modify &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.component.ts&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/abe9eec9e3361f5901b9221b5758e726.js?file=app.component.ts&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;For displaying data, you can modify &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.component.html&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/abe9eec9e3361f5901b9221b5758e726.js?file=app.component.html&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-07-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/angular-observable-tutorial</link>
<guid isPermaLink="true">https://randomwits.com/blog/angular-observable-tutorial</guid>
</item>
<item>
  <title>Daily Logs for July 24, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for July 24, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for July 24, 2023.&lt;/p&gt;
    &lt;h3 id=&quot;twitter-has-been-renamed-x&quot;&gt;Twitter has been renamed X&lt;/h3&gt;
    &lt;p&gt;I logged into twitter today and saw the logo has changed. The bird logo has been replaced with letter &apos;X&apos;.&lt;/p&gt;
    &lt;p&gt;Also X.com would redirect to twitter.com, Elon Musk said. However, there seems to be some DNS issue as I am redirected to GoDaddy website.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/X.com.png&quot; alt=&quot;DNS issue&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;print-an-object-as-json-in-java&quot;&gt;Print an object as Json in java&lt;/h3&gt;
    &lt;p&gt;Lets say you wanted to print an object in java&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;Build&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;build&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;getBuild&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mapper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;writeValueAsString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Json Object is: {}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;400&quot; src=&quot;/encrypted/2023-07-24-daily-logs-2023-07-24.html&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
  </description>
  <pubDate>2023-07-24T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-07-24</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-07-24</guid>
</item>
<item>
  <title>Mastering Reactive Pagination with Spring Boot and MongoDB</title>
  <description>&lt;p&gt;As we delve into the realms of sophisticated data management, we will be harnessing the strengths of Spring Boot, the agility of MongoDB, and the responsiveness of reactive programming to implement an efficient pagination system. Pagination is a critical feature, instrumental in enhancing user experience and application performance. By the end of this guide, you&apos;ll have a deep understanding of reactive pagination, equipping you with the skills to manage large data sets with ease and proficiency. Let&apos;s get started.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;As we delve into the realms of sophisticated data management, we will be harnessing the strengths of Spring Boot, the agility of MongoDB, and the responsiveness of reactive programming to implement an efficient pagination system. Pagination is a critical feature, instrumental in enhancing user experience and application performance. By the end of this guide, you&apos;ll have a deep understanding of reactive pagination, equipping you with the skills to manage large data sets with ease and proficiency. Let&apos;s get started.&lt;/p&gt;
    &lt;h3 id=&quot;create-a-new-spring-boot-application&quot;&gt;Create a New Spring Boot Application&lt;/h3&gt;
    &lt;p&gt;Go to &lt;a href=&quot;https://start.spring.io/&quot;&gt;Start Initializr&lt;/a&gt; and create a new Spring Boot Application.&lt;/p&gt;
    &lt;p&gt;Select the following :&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;Project&lt;/td&gt;
    &lt;td&gt;Gradle - Groovy&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Spring Boot&lt;/td&gt;
    &lt;td&gt;3.1.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Packaging&lt;/td&gt;
    &lt;td&gt;Jar&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Java&lt;/td&gt;
    &lt;td&gt;17&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab build.gradle&quot;&gt;&lt;a href=&quot;#build.gradle&quot;&gt;build.gradle&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample build.gradle&quot; id=&quot;build.gradle&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/6e037d6c7261350abe5772eb6f196435.js?file=build.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;p&gt;Build the project and then open it in your favourite editor.&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;gradle build
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;setup-mongodb-locallly&quot;&gt;Setup MongoDB locallly&lt;/h3&gt;
    &lt;p&gt;We&apos;ll use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker-compose&lt;/code&gt; to spin up a local instance of MongoDB&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab docker-compose.yml&quot;&gt;&lt;a href=&quot;#docker-compose.yml&quot;&gt;docker-compose.yml&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample docker-compose.yml&quot; id=&quot;docker-compose.yml&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/6e037d6c7261350abe5772eb6f196435.js?file=docker-compose.yml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab init-mongo.js&quot;&gt;&lt;a href=&quot;#init-mongo.js&quot;&gt;init-mongo.js&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample init-mongo.js&quot; id=&quot;init-mongo.js&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/6e037d6c7261350abe5772eb6f196435.js?file=init-mongo.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;p&gt;To start the cluster:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ docker-compose up
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;configure-mongdb&quot;&gt;Configure MongDB&lt;/h3&gt;
    &lt;p&gt;Create an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application-local.properties&lt;/code&gt; file in the resources folder with the following configuration. We have to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-Dspring.profiles.active=local&lt;/code&gt; to vm options to use this config file.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;spring&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;mongodb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;uri&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;mongodb:&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//localhost:27017/testdb&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;create-an-entity&quot;&gt;Create an Entity&lt;/h3&gt;
    &lt;p&gt;Create a Product entity in the model.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab Product.java&quot;&gt;&lt;a href=&quot;#Product.java&quot;&gt;Product.java&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample Product.java&quot; id=&quot;Product.java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/6e037d6c7261350abe5772eb6f196435.js?file=Product.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h3 id=&quot;create-a-repository&quot;&gt;Create a Repository&lt;/h3&gt;
    &lt;p&gt;Create a ProductRepository in the repository package which extends ReactiveSortingRepository.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab ProductRepository.java&quot;&gt;&lt;a href=&quot;#ProductRepository.java&quot;&gt;ProductRepository.java&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample ProductRepository.java&quot; id=&quot;ProductRepository.java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/6e037d6c7261350abe5772eb6f196435.js?file=ProductRepository.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h3 id=&quot;create-a-service&quot;&gt;Create a Service&lt;/h3&gt;
    &lt;p&gt;Create a ProductService class in the service package to interact with the repository.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab ProductService.java&quot;&gt;&lt;a href=&quot;#ProductService.java&quot;&gt;ProductService.java&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample ProductService.java&quot; id=&quot;ProductService.java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/6e037d6c7261350abe5772eb6f196435.js?file=ProductService.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h3 id=&quot;create-a-controller&quot;&gt;Create a Controller&lt;/h3&gt;
    &lt;p&gt;Create a ProductController in the controller package to handle HTTP requests.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab ProductController.java&quot;&gt;&lt;a href=&quot;#ProductController.java&quot;&gt;ProductController.java&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample ProductController.java&quot; id=&quot;ProductController.java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/6e037d6c7261350abe5772eb6f196435.js?file=ProductController.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h3 id=&quot;running-the-application&quot;&gt;Running the Application&lt;/h3&gt;
    &lt;p&gt;Create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt; request for pagination entries: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost:8080/paginaged-products?page=0&amp;amp;size=2&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Product1&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Product4&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt; request for getting all entries: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost:8080/products&lt;/code&gt;&lt;/p&gt;
    &lt;h3 id=&quot;login-to-mongodb&quot;&gt;Login to MongoDB&lt;/h3&gt;
    &lt;p&gt;You can also verify the data inside mongoDB&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker ps 
    &amp;lt;CONTAINER_ID&amp;gt; mongo:latest
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker &lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; &amp;lt;CONTAINER_ID&amp;gt; bash
    &lt;span class=&quot;c&quot;&gt;# mongosh -u username -p password&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# use testdb&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# show collections&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2023-07-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/mastering-reactive-pagination-spring-boot-mongodb</link>
<guid isPermaLink="true">https://randomwits.com/blog/mastering-reactive-pagination-spring-boot-mongodb</guid>
</item>
<item>
  <title>The number of Weak Characters in the Game</title>
  <description>&lt;p&gt;You are playing a game that contains multiple characters, and each of the characters has two main properties: attack and defense. You are given a 2D integer array properties where properties[i] = [attacki, defensei] represents the properties of the ith character in the game..&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;You are playing a game that contains multiple characters, and each of the characters has two main properties: attack and defense. You are given a 2D integer array properties where properties[i] = [attacki, defensei] represents the properties of the ith character in the game.&lt;/p&gt;
    &lt;p&gt;A character is said to be weak if any other character has both attack and defense levels strictly greater than this character&apos;s attack and defense levels. More formally, a character i is said to be weak if there exists another character j where attack&lt;sub&gt;j&lt;/sub&gt; &amp;gt; attack&lt;sub&gt;i&lt;/sub&gt; and defense&lt;sub&gt;j&lt;/sub&gt; &amp;gt; defense&lt;sub&gt;i&lt;/sub&gt;.&lt;/p&gt;
    &lt;p&gt;Return the number of weak characters.&lt;/p&gt;
    &lt;h2 id=&quot;brute-force&quot;&gt;Brute force&lt;/h2&gt;
    &lt;p&gt;My first hunch was to use a brute force solution. For each character, compare it against the remaining characters.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ecf1dc2cef72c564a908353159f754dc.js?file=BruteForceSolution.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;I got &lt;strong&gt;Time Limit Exceeded&lt;/strong&gt;. The complexity of the solution is &lt;strong&gt;$$O(n^2)$$&lt;/strong&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;optimal-solution&quot;&gt;Optimal Solution&lt;/h2&gt;
    &lt;p&gt;First we sort the 2D array based on criteria&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;First, compare the first elements of each sub-array in descending order.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the first elements of two sub-arrays are equal, then compare their second elements in ascending order.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Next we checks if the second element (property[1]) of the current property is less than the current maximum value (max). If it is, it means the property is not optimal (since it has a lower second element than the previously encountered properties).&lt;/p&gt;
    &lt;p&gt;If the second element (property[1]) of the current property is greater than or equal to the current maximum value (max), it means this property is currently the best among the encountered properties. We update the max variable to hold the value of the second element of this property, as it becomes the new maximum. This step ensures that we keep track of the property with the highest second element encountered so far.&lt;/p&gt;
    &lt;p&gt;The output counter keeps track of the number of properties that are not optimal, as they have lower second elements than the previously seen properties.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ecf1dc2cef72c564a908353159f754dc.js?file=OptimalSolution.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-07-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/the-number-of-weak-characters-in-the-game</link>
<guid isPermaLink="true">https://randomwits.com/blog/the-number-of-weak-characters-in-the-game</guid>
</item>
<item>
  <title>The Irony of Faith and Science</title>
  <description>&lt;p&gt;As we gaze into the dark sky, captivated by the sparkling stars, we often find ourselves contemplating the deeper meaning of life and the existence of a higher power. The question of whether God is a mere human construct or if our existence holds merit in the vast realm of the universe remains&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2023-07-04-irony-faith-and-science.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;
    &lt;!--begin_of_post --&gt;&lt;/p&gt;
    &lt;p&gt;As we gaze into the dark sky, captivated by the sparkling stars, we often find ourselves contemplating the deeper meaning of life and the existence of a higher power. The question of whether God is a mere human construct or if our existence holds merit in the vast realm of the universe remains an enduring and thought-provoking debate. While science does not provide definitive proof for or against the existence of God, examining the beliefs of renowned scientists can shed light on the diverse perspectives that coexist within the scientific community.&lt;/p&gt;
    &lt;h3 id=&quot;a-vegetarian-and-an-atheist&quot;&gt;A vegetarian and an atheist&lt;/h3&gt;
    &lt;p&gt;Srinivasa Ramanujan was a brilliant mathematician from India. His contribution earned him fellowships at Trinity College and the Royal Society. However he was also a devout Hindu and a vegetarian. He believed Hindu goddess, Namagiri, whispered mathematical truths in his dream.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;An equation for me has no meaning, unless it expresses a thought of God&quot; ― Srinivasa Ramanujan&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;However his mentor, G. H. Hardy, was an atheist. He often refused to enter a chapel even for funerals or for elections of college officials. However he colloborated with Ramanujan in mathematics and cherished his friendship.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;Well, I have done one the thing you could never, have done, and that is to have collaborated with both Littlewood and Ramanujan on something like equal terms.&quot; - G. H. Hardy, A Mathematician’s Apology&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h3 id=&quot;co-recepient-of-standard-models-nobel-prize&quot;&gt;Co recepient of Standard Model&apos;s Nobel prize&lt;/h3&gt;
    &lt;p&gt;Abdus Salam won Nobel prize in physics for his contribution to Standard Model. When asked about his inspiration, Salam acknowledged his religious beliefs, illustrating how his faith provided the impetus for his scientific inquiries.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;The Holy Quran enjoins us to reflect on the verities of Allah’s created laws of nature; however, that our generation has been privileged to glimpse a part of His design is a bounty and a grace for which I render thanks with a humble heart.&quot; - Abdus Salam, Address to UNESCO (1979)&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;In stark contrast, his co-recipient, Stephen Weinberg, an avowed atheist, expressed a sense of hopelessness upon gazing into the vastness of the cosmos.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;The more the universe seems comprehensible, the more it also seems pointless&quot; - Stephen Weinberg&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h3 id=&quot;molecule-of-life&quot;&gt;Molecule of life&lt;/h3&gt;
    &lt;p&gt;James Watson and Francis Crick, the dynamic duo who cracked the genetic code, famously embraced atheism. Their relentless pursuit of scientific truth propelled them forward, unencumbered by spiritual considerations.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;[When asked by a student if he believes in any gods] Oh, no. Absolutely not… The biggest advantage to believing in God is you don&apos;t have to understand anything, no physics, no biology. I wanted to understand.&quot; ― James D. Watson&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;In an intriguing twist, Francis Collins, the director of the Human Genome Project, approached the enigma of DNA from an entirely different perspective. As a devout Christian, Collins found solace in the harmony between science and faith, marveling at the intricate complexity of life as a testament to a higher power.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;Science’s domain is to explore nature. God’s domain is in the spiritual world, a realm not possible to explore with the tools and language of science. It must be examined with the heart, the mind, and the soul—and the mind must find a way to embrace both realms&quot; -  Francis S. Collins, The Language of God: A Scientist Presents Evidence for Belief&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
    &lt;p&gt;The beliefs held by famous scientists span the entire spectrum, demonstrating that science itself does not prove or deny the existence of God. The question of God&apos;s existence remains a non-falsifiable hypothesis. While we may not be certain about the existence of a supernatural entity, we can embrace the wonder and endless possibilities that the universe presents. Science and spirituality can coexist, as demonstrated by the myriad perspectives held by renowned scientists. Ultimately, we can find inspiration and enlightenment by exploring the diverse beliefs that shape the scientific community, allowing the universe to dazzle us with its infinite potential.&lt;/p&gt;
  </description>
  <pubDate>2023-07-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/irony-faith-and-science</link>
<guid isPermaLink="true">https://randomwits.com/blog/irony-faith-and-science</guid>
</item>
<item>
  <title>Publish Jenkins Pipeline&apos;s Stages to Kafka topic</title>
  <description>&lt;p&gt;Jenkins is a popular automation tool used for continuous integration and continuous delivery (CI/CD) processes. Kafka, on the other hand, is a distributed event streaming platform capable of handling large volumes of real-time data. By combining the power of Jenkins and Kafka, we can effectively publish pipeline information to a Kafka topic.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Jenkins is a popular automation tool used for continuous integration and continuous delivery (CI/CD) processes. Kafka, on the other hand, is a distributed event streaming platform capable of handling large volumes of real-time data. By combining the power of Jenkins and Kafka, we can effectively publish pipeline information to a Kafka topic.&lt;/p&gt;
    &lt;p&gt;Lets say we have a jenkins pipeline. Post success or failure of the pipeline, we want to publish this information to kakfa topic. We would also want to log start and end time of each stages. We want to do this without modifiying our pipeline script.&lt;/p&gt;
    &lt;p&gt;We can create an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Event&lt;/code&gt; class with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;publish&lt;/code&gt; method that will push to kafka.&lt;/p&gt;
    &lt;h3 id=&quot;pipeline-script&quot;&gt;Pipeline Script&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7bb66bc02307332cd4f7009daa0a1594.js?file=pipeline.groovy&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;modeling-pipeline-stages&quot;&gt;Modeling Pipeline Stages&lt;/h3&gt;
    &lt;p&gt;We&apos;ll define a Stage class that contains information about each stage in the pipeline. This class will help us organize and structure the data before sending it to Kafka.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7bb66bc02307332cd4f7009daa0a1594.js?file=Stage.groovy&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Stage&lt;/code&gt; class will provide the necessary structure to capture relevant information about each stage in the pipeline.&lt;/p&gt;
    &lt;h3 id=&quot;creating-kafka-messages&quot;&gt;Creating Kafka Messages&lt;/h3&gt;
    &lt;p&gt;In order to publish data to the Kafka topic, we need to define the structure of the messages we will be sending. We&apos;ll create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KafkaMessage&lt;/code&gt; class that represents the JSON format of the data to be published.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7bb66bc02307332cd4f7009daa0a1594.js?file=KafkaMessage.groovy&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;implementing-the-events-class&quot;&gt;Implementing the Events Class&lt;/h3&gt;
    &lt;p&gt;Lastly we will define our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Events&lt;/code&gt; class. We will use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PipelineNodeGraphVisitor&lt;/code&gt; to intrinsically get each nodes information. Also we use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafkacat&lt;/code&gt; utility to publish to kafka topic.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7bb66bc02307332cd4f7009daa0a1594.js?file=Events.groovy&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;understanding-the-noncps-notation&quot;&gt;Understanding the NonCPS Notation&lt;/h3&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@NonCPS&lt;/code&gt; annotation is specific to Jenkins&apos; implementation of Groovy, and it is used to mark a method as &quot;non-continuable-permanent-space&quot; (NCPS). This means that the method cannot be continued in a later build step, and its state cannot be saved across pipeline restarts.&lt;/p&gt;
    &lt;p&gt;In Jenkins, pipeline scripts are executed in a &quot;sandbox&quot; environment that restricts certain operations for security reasons. For example, the sandbox does not allow methods that use reflection, file I/O, or network I/O.&lt;/p&gt;
    &lt;p&gt;The @NonCPS annotation is used to mark methods that perform operations that are not allowed in the sandbox. In this case, the getStage method performs operations that access the raw build data, which is not allowed in the sandbox. By marking the method with @NonCPS, Jenkins allows it to be executed outside the sandbox, which allows it to access the raw build data.&lt;/p&gt;
    &lt;p&gt;To summarize, the @NonCPS annotation is specific to Jenkins&apos; implementation of Groovy, and it is used to mark methods that perform operations that are not allowed in the sandbox.&lt;/p&gt;
  </description>
  <pubDate>2023-07-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/publish-jenkins-pipeline-stages-to-kafka</link>
<guid isPermaLink="true">https://randomwits.com/blog/publish-jenkins-pipeline-stages-to-kafka</guid>
</item>
<item>
  <title>House Robber Leetcode Solution</title>
  <description>&lt;p&gt;You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h3 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h3&gt;
    &lt;p&gt;You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night.&lt;/p&gt;
    &lt;p&gt;Given an integer array nums representing the amount of money of each house, return the maximum amount of money you can rob tonight without alerting the police.&lt;/p&gt;
    &lt;h3 id=&quot;explanation&quot;&gt;Explanation&lt;/h3&gt;
    &lt;p&gt;We can use dynamic programming to solve this problem. We will create an auxiliary array &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dp&lt;/code&gt; which will store the largest money for each iteration. Eg for input : &lt;strong&gt;[2 , 1, 1, 2, 9]&lt;/strong&gt;&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;ith value&lt;/th&gt;
    &lt;th&gt;dp array&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 0&lt;/td&gt;
    &lt;td&gt;[2, 0, 0, 0, 0]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 1&lt;/td&gt;
    &lt;td&gt;[2, 2, 0, 0, 0]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 2&lt;/td&gt;
    &lt;td&gt;[2, 2, 3, 0, 0]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 3&lt;/td&gt;
    &lt;td&gt;[2, 2, 3, 4, 0]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 4&lt;/td&gt;
    &lt;td&gt;[2, 2, 3, 4, 12]&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab python&quot;&gt;&lt;a href=&quot;#python&quot;&gt;python&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab javascript&quot;&gt;&lt;a href=&quot;#javascript&quot;&gt;javascript&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab rust&quot;&gt;&lt;a href=&quot;#rust&quot;&gt;rust&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/c7e93c597941b726616dc6a74c274dde.js?file=HouseRobber.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample python&quot; id=&quot;python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/c7e93c597941b726616dc6a74c274dde.js?file=house_rubber.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample javascript&quot; id=&quot;javascript&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/c7e93c597941b726616dc6a74c274dde.js?file=houseRobber.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample rust&quot; id=&quot;rust&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/c7e93c597941b726616dc6a74c274dde.js?file=houseRobber.rs&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h3 id=&quot;time-complexity-is&quot;&gt;Time complexity is&lt;/h3&gt;
    &lt;p&gt;$ O(n) $&lt;/p&gt;
  </description>
  <pubDate>2023-06-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/house-robber-leetcode</link>
<guid isPermaLink="true">https://randomwits.com/blog/house-robber-leetcode</guid>
</item>
<item>
  <title>Review Bang Bang Burgers in Charlotte</title>
  <description>&lt;p&gt;I went for lunch with my team at Bang Bang Burgers in Charlotte. It was a bit of a walk from the office, but luckily the weather wasn&apos;t hot, so it was a pleasant stroll to the restaurant.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;p&gt;I went for lunch with my team at Bang Bang Burgers in Charlotte. It was a bit of a walk from the office, but luckily the weather wasn&apos;t hot, so it was a pleasant stroll to the restaurant.&lt;/p&gt;
    &lt;p&gt;The address is 235 W Tremont Ave #101, Charlotte, NC 28203.&lt;/p&gt;
    &lt;p&gt;I decided to try their Burger Bowls with Salmon. Ask to remove bacon if you dont eat read meat like me. It had mixed greens, sliced tomatoes, red onion, guacamole, a hard-boiled egg, and sweet potato. The bowl was dressed with a mix of lemon juice and extra virgin olive oil. Little price for lunch, it cost me like $20 including tip.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/BurgerBowls.jpg&quot; alt=&quot;Sample Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;After we finished our lunch and left the restaurant, we started heading back to the office. However, just as we began our journey, it started raining. At first, it was just a light drizzle, and I didn&apos;t mind getting a little wet. But as we continued walking, the rain intensified. If we had been more than five minutes late, we would have been caught in a heavy downpour. I ended up getting slightly drenched, but thankfully it wasn&apos;t too bad.&lt;/p&gt;
    &lt;div&gt;
    Rating: 
    &lt;span class=&quot;fa fa-star checked&quot;&gt;&lt;/span&gt;
    &lt;span class=&quot;fa fa-star checked&quot;&gt;&lt;/span&gt;
    &lt;span class=&quot;fa fa-star checked&quot;&gt;&lt;/span&gt;
    &lt;span class=&quot;fa fa-star checked&quot;&gt;&lt;/span&gt;
    &lt;i class=&quot;icon-star-empty&quot;&gt;&lt;/i&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2023-06-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/review-bang-bang-burgers-charlotte</link>
<guid isPermaLink="true">https://randomwits.com/blog/review-bang-bang-burgers-charlotte</guid>
</item>
<item>
  <title>Kata - Correct the Time String</title>
  <description>&lt;p&gt;In this &lt;a href=&quot;https://www.codewars.com/kata/57873ab5e55533a2890000c7/&quot;&gt;kata&lt;/a&gt;, you are given a string that represents a time in the format &quot;HH:MM:SS&quot;. The string may be in the wrong format, or it may be missing some characters. Your task is to correct the string so that it represents a valid time.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In this &lt;a href=&quot;https://www.codewars.com/kata/57873ab5e55533a2890000c7/&quot;&gt;kata&lt;/a&gt;, you are given a string that represents a time in the format &quot;HH:MM:SS&quot;. The string may be in the wrong format, or it may be missing some characters. Your task is to correct the string so that it represents a valid time.&lt;/p&gt;
    &lt;p&gt;The code first checks if the string is null or empty. If it is, then the code returns null. Otherwise, the code splits the string into three parts, representing the hours, minutes, and seconds. The code then tries to parse these parts as integers. If any of the parts cannot be parsed as an integer, then the code returns null.&lt;/p&gt;
    &lt;p&gt;If all of the parts can be parsed as integers, then the code calculates the correct time. The code does this by adding the seconds to the minutes, and then adding the minutes to the hours. The code then takes the remainder of the hours when it is divided by 24.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab javascript&quot;&gt;&lt;a href=&quot;#javascript&quot;&gt;javascript&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4ba44496f5bf88cc6c0003b3b6f50758.js?file=TimeCorrect.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample javascript&quot; id=&quot;javascript&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4ba44496f5bf88cc6c0003b3b6f50758.js?file=timeCorrect.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;p&gt;Time complexity: The time complexity of the code is &lt;strong&gt;O(n)&lt;/strong&gt;, where n is the length of the time string. This is because the code iterates through the time string once, and each iteration takes constant time.&lt;/p&gt;
    &lt;p&gt;Space complexity: The space complexity of the code is &lt;strong&gt;O(1)&lt;/strong&gt;. This is because the code only creates a few small variables, and these variables are all of constant size.&lt;/p&gt;
  </description>
  <pubDate>2023-06-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/kata-correct-the-time-string</link>
<guid isPermaLink="true">https://randomwits.com/blog/kata-correct-the-time-string</guid>
</item>
<item>
  <title>People and Their Stories - Marianne Bachmeier</title>
  <description>&lt;p&gt;In the annals of crime and justice, there are stories that captivate our attention due to their sheer complexity and the ethical dilemmas they present. One such story is that of Marianne Bachmeier, a woman whose actions shocked the world. On January 6, 1981, in a courtroom in Germany, Bachmeier took the life of the man accused of sexually abusing and murdering her daughter. Was her act justified?&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In the annals of crime and justice, there are stories that captivate our attention due to their sheer complexity and the ethical dilemmas they present. One such story is that of Marianne Bachmeier, a woman whose actions shocked the world. On January 6, 1981, in a courtroom in Germany, Bachmeier took the life of the man accused of sexually abusing and murdering her daughter. Was her act justified?&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/YnaOvWeiBQw?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/YnaOvWeiBQw?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/YnaOvWeiBQw/hqdefault.jpg alt=&apos;Marianne Bachmeier&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Marianne Bachmeier&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;background&quot;&gt;Background&lt;/h3&gt;
    &lt;p&gt;To understand Marianne Bachmeier&apos;s fateful act, it is essential to delve into the circumstances that led her to take such a drastic step. In 1980, Bachmeier&apos;s seven-year-old daughter, Anna, was tragically abducted, raped, and murdered. Devastated by the loss, Bachmeier became consumed by grief and a thirst for justice.&lt;/p&gt;
    &lt;h3 id=&quot;the-trial-and-the-shooting&quot;&gt;The Trial and the Shooting:&lt;/h3&gt;
    &lt;p&gt;In a twist of fate, Bachmeier found herself face-to-face with the accused, Klaus Grabowski, during his trial. Overwhelmed by emotions, Bachmeier could not bear the sight of the man who had allegedly caused her daughter&apos;s death. On that fateful day in January 1981, as Grabowski arrogantly taunted the grieving mother, Bachmeier pulled out a gun and shot him dead in the courtroom.&lt;/p&gt;
    &lt;h3 id=&quot;the-justification-debate&quot;&gt;The Justification Debate:&lt;/h3&gt;
    &lt;p&gt;Marianne Bachmeier&apos;s actions immediately ignited a fierce debate about whether her act of vigilantism was justified. On one hand, many sympathized with her pain and the unimaginable suffering she had endured. They argued that the justice system had failed her and that she was driven to desperation by the lack of closure and the perceived impunity of the accused. In their eyes, Bachmeier&apos;s act was an act of retribution, an expression of a mother&apos;s undying love for her child.&lt;/p&gt;
    &lt;p&gt;On the other hand, critics argue that taking the law into one&apos;s own hands can never be justified. They point out that the courtroom is a place for justice to be served through due process, and Bachmeier&apos;s act was an affront to the principles of law and order. They contend that while her pain is understandable, resorting to violence undermines the very system that seeks to maintain societal order.&lt;/p&gt;
    &lt;h3 id=&quot;reflections&quot;&gt;Reflections:&lt;/h3&gt;
    &lt;p&gt;The case of Marianne Bachmeier presents a complex ethical conundrum. It forces us to question the limits of justice and the extent to which we can empathize with the actions of a grieving parent. Bachmeier&apos;s story highlights the human struggle between the desire for vengeance and the pursuit of justice through established legal channels.&lt;/p&gt;
  </description>
  <pubDate>2023-06-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/people-and-their-stories-marianne-bachmeier</link>
<guid isPermaLink="true">https://randomwits.com/blog/people-and-their-stories-marianne-bachmeier</guid>
</item>
<item>
  <title>Exploring the Power of Outlier Detection in Regression Analysis</title>
  <description>&lt;p&gt;Imagine you have a magical tool called studentized residuals that helps you explore the secrets hidden in data. These residuals are like detectives who investigate the influence and odd behaviors of individual data points. They compare the actual values of something you&apos;re trying to predict with the values your model predicts, and then they measure how different they are. By using a special formula, they make sure the measurements are fair, no matter what model or dataset you&apos;re using.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Imagine you have a magical tool called studentized residuals that helps you explore the secrets hidden in data. These residuals are like detectives who investigate the influence and odd behaviors of individual data points. They compare the actual values of something you&apos;re trying to predict with the values your model predicts, and then they measure how different they are. By using a special formula, they make sure the measurements are fair, no matter what model or dataset you&apos;re using.&lt;/p&gt;
    &lt;p&gt;The cool thing about studentized residuals is that they give you a superpower to spot outliers or extreme data points. If a studentized residual has a big number (positive or negative), it means that the data point is behaving very differently from what your model expected. It&apos;s like a rebel breaking the rules! Positive residuals show that the actual value is higher than predicted, while negative residuals mean it&apos;s lower. By understanding these residuals, you can find those special data points that have a strong impact on your model and might change your conclusions.&lt;/p&gt;
    &lt;p&gt;To make sense of these residuals, you need to look at their size and direction. Big numbers could mean something important, like a discovery waiting to be made. You compare the residuals to certain critical values, kind of like comparing your detective&apos;s findings to clues. And by doing this, you can understand how these residuals affect the overall analysis of your model.&lt;/p&gt;
    &lt;p&gt;So, studentized residuals are like your trusted companions in the world of data analysis. They help you understand the influence of data points, find the rebels that break the rules, and ensure you&apos;re making the most accurate predictions possible. With their help, you can unlock the secrets hidden within your data and make amazing discoveries!&lt;/p&gt;
    &lt;h3 id=&quot;why-are-they-used-in-the-final-models&quot;&gt;Why are they used in the final models?&lt;/h3&gt;
    &lt;p&gt;Studentized residuals are like special superpowers that help us create the most awesome and accurate models. They have some fantastic uses that make our models even better! Let&apos;s explore why they are so important:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Super Sleuths:&lt;/strong&gt; Studentized residuals are like detectives who can spot unusual and important things in our data. They help us find those sneaky outliers and data points that behave strangely and might mess up our model. They make sure our model assumptions are in check!&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Model Upgrade:&lt;/strong&gt; Imagine we have some superheroes in our data, like outliers or influential observations. These superheroes can have a big impact on our model&apos;s predictions. Studentized residuals help us identify them and make our model stronger. We can give them special attention and make sure they don&apos;t spoil our model&apos;s performance.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Secret Messages:&lt;/strong&gt; Studentized residuals hold secret messages about our data. They tell us about the patterns, trends, and relationships hidden within the numbers. By studying these residuals, we can discover amazing things about how our data is connected and find areas where we can improve our model even more!&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Comparing Heroes:&lt;/strong&gt; Sometimes we have different models or different sets of data, and we want to see which one is the best. Studentized residuals can help us compare these models fairly. They give us a special measurement that tells us how far off our predictions are from reality. It&apos;s like a superpower that helps us see which model performs the best in different situations.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;By using studentized residuals in our final models, we become data superheroes! We can spot problems, improve our models, uncover hidden secrets, and make smart decisions based on what the numbers are telling us. So, let&apos;s embrace the power of studentized residuals and make our regression models supercharged!&lt;/p&gt;
    &lt;p&gt;Hey there, fellow data adventurers! Let&apos;s embark on an exciting journey into the world of studentized residuals using SAS. Imagine we have some super cool data stored in a dataset called &apos;YourData&apos; (don&apos;t worry, you can change the name to something more awesome!). Here&apos;s how we can calculate those fascinating studentized residuals:&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Casting the Regression Spell 🧙‍♀️ We&apos;ll use the magical PROC REG procedure in SAS to fit our regression model. We&apos;ll predict the values of our dependent variable using some independent variables like IndependentVariable1 and IndependentVariable2. Brace yourselves, the code is coming!&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/61c45d98524ca2471059dbdb216b631b.js?file=ex1.sas&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Unveiling the Residuals&apos; Power 💪 Now, let&apos;s see what these studentized residuals have to say! We&apos;ll use another enchantment called PROC PRINT to display the studentized residuals. It&apos;s like opening a treasure chest filled with intriguing numbers. Get ready for the grand reveal!&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/61c45d98524ca2471059dbdb216b631b.js?file=ex2.sas&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;And voila! The SAS sorcery will conjure up the studentized residuals, revealing their fascinating values. It might look something like this:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/&lt;span class=&quot;k&quot;&gt;**&lt;/span&gt;OUTPUT&lt;span class=&quot;k&quot;&gt;**&lt;/span&gt;/
    StudentizedResiduals
    0.1245
    &lt;span class=&quot;nt&quot;&gt;-0&lt;/span&gt;.3421
    0.7589
    &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;.2567
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You&apos;ll see a list of those extraordinary residuals, each one representing a special deviation from the predicted values. It&apos;s like discovering hidden secrets about our data!&lt;/p&gt;
    &lt;p&gt;Remember to customize the code with your own dataset name and variable names to make it truly magical. Now, armed with SAS and the power of studentized residuals, you can unlock the mysteries of your regression models and conquer the realm of data analysis! Happy exploring! 🌟🔮&lt;/p&gt;
    &lt;h3 id=&quot;embarking-on-an-epic-quest-with-r-to-unravel-the-magic-of-studentized-residuals&quot;&gt;Embarking on an Epic Quest with R to Unravel the Magic of Studentized Residuals!&lt;/h3&gt;
    &lt;p&gt;In our previous adventure, we witnessed the SAS sorcery to calculate studentized residuals. Now, let&apos;s unveil the captivating R incantation that accomplishes the same feat. Brace yourselves for a mesmerizing experience!&lt;/p&gt;
    &lt;p&gt;Assuming you have donned the R wizard&apos;s robe and your dataset has been summoned into the R universe, let&apos;s weave the code together:&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Conjuring the Regression Spell 🧙‍♂️ We shall begin by fitting a magical regression model using the extraordinary capabilities of R. Imagine you have already crafted a wondrous fitted regression model object called &apos;model&apos; (you can choose a name that resonates with your inner sorcerer).&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/61c45d98524ca2471059dbdb216b631b.js?file=ex3.r&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt;  Unveiling the Residuals&apos; Enigma 💫 Prepare to witness the astounding power of studentized residuals as we unveil their hidden secrets! With a simple wave of the R wand, we can showcase these mysterious values. It&apos;s like unraveling the pages of an ancient scroll containing the numerical wonders of our data. Are you prepared for this revelation?&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/61c45d98524ca2471059dbdb216b631b.js?file=ex4.r&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Behold! The R sorcery will manifest the studentized residuals before your eyes, illuminating the path to enlightenment. You will be greeted with a mesmerizing display, similar to this:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;0.1245
    &lt;span class=&quot;nt&quot;&gt;-0&lt;/span&gt;.3421
    0.7589
    &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;.2567
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Each of these bewitching residuals represents a unique departure from the predicted values. They hold the key to uncovering hidden insights within our data!&lt;/p&gt;
    &lt;p&gt;Remember to replace &apos;model&apos; with the actual name of your fitted regression model object. With the powerful combination of R and the guidance of studentized residuals, you can delve deeper into the mysteries of your regression models and embark on thrilling data adventures! May your journey be filled with wonder and discovery! 🌟🔮&lt;/p&gt;
    &lt;h3 id=&quot;unveiling-the-mystical-limitations-of-studentized-residuals---when-the-magic-fades-away&quot;&gt;Unveiling the Mystical Limitations of Studentized Residuals - When the Magic Fades Away&lt;/h3&gt;
    &lt;p&gt;Listen closely, young apprentices, as we delve into the secrets of studentized residuals and uncover the circumstances where their enchanting powers may wane. Remember, even the mightiest spells have their limits!&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The Tiny Sample Enigma:&lt;/strong&gt; Picture a scenario where your dataset is but a meager collection of observations. In such cases, the reliability of studentized residuals may dwindle. With too few data points, the calculations required for studentization may lack the accuracy needed to estimate the elusive standard deviations. Before relying on these mystical residuals, ensure that your sample size is sufficiently magical!&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The Assumption Abyss:&lt;/strong&gt; Linear regression, a powerful magical framework, comes with its own set of assumptions. If these assumptions, such as normality, constant variance, and independence of errors, are severely violated, the insight provided by studentized residuals may diminish. Fear not, for there are alternative paths to tread! Addressing the violations and embracing alternative regression methods or robust techniques may hold the key to unlocking meaningful insights.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Non-linear Sorcery and the Outlier Riddle:&lt;/strong&gt; Ah, non-linear regression models and their intricate spells! When exploring these captivating realms or venturing into models with complex functional forms, the interpretive prowess of studentized residuals may falter. Outlier detection, a task often entrusted to studentized residuals in linear regression, becomes a more enigmatic quest in these domains. Fear not, for unique methods tailored to each model&apos;s arcane nature shall guide your way!&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The Interpretability Mirage:&lt;/strong&gt; Let us not forget that studentized residuals are but one piece of the grand puzzle. In some cases, their role as outcome variables may offer little additional insight beyond what other diagnostic measures can reveal. Should your quest be to assess model fit, evaluate residuals, or unearth outliers, alternative diagnostic techniques or captivating visualizations may offer a more intuitive glimpse into the mysteries that lie within your data.
    Remember, young apprentices, while studentized residuals possess great power, they are not the sole enchantment in the realm of regression analysis. Embrace their might when the circumstances align, but do not be afraid to wield alternative tools and embark on new adventures to unravel the secrets that dwell within your data!&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;With this newfound knowledge of studentized residuals, young minds are equipped to embark on their own journeys into the realm of regression analysis. But remember, dear readers, that the true magic lies not just in the techniques and formulas we employ, but in the curiosity and creativity we bring to our investigations. As you venture forth, may you wield the power of studentized residuals wisely, recognizing their strengths and limitations. Embrace the challenges, seek alternative paths when needed, and never cease in your pursuit of understanding the hidden patterns and relationships that shape our world.&lt;/p&gt;
    &lt;p&gt;May your data-driven adventures be filled with wonder and discovery. Farewell, young statisticians, as you set forth on your quest to unlock the secrets of model fit with the aid of studentized residuals. May your journey be filled with excitement, enlightenment, and the thrill of unraveling the mysteries that lie within your data. Happy analyzing!&lt;/p&gt;
  </description>
  <pubDate>2023-06-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/outlier-detection-in-regression-analysis</link>
<guid isPermaLink="true">https://randomwits.com/blog/outlier-detection-in-regression-analysis</guid>
</item>
<item>
  <title>Publish to MSK Kafka using AWS Lambda Python</title>
  <description>&lt;p&gt;Apache Kafka is a distributed streaming platform designed to handle real-time data streams efficiently. It uses a publish-subscribe model, where producers publish messages to topics, and consumers subscribe to those topics to receive the messages. Amazon MSK simplifies the deployment and management of Kafka clusters on AWS, providing a fully managed and scalable solution. You can use AWS lambda in python to publish to MSK topic.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Apache Kafka is a distributed streaming platform designed to handle real-time data streams efficiently. It uses a publish-subscribe model, where producers publish messages to topics, and consumers subscribe to those topics to receive the messages. Amazon MSK simplifies the deployment and management of Kafka clusters on AWS, providing a fully managed and scalable solution. You can use AWS lambda in python to publish to MSK topic.&lt;/p&gt;
    &lt;h3 id=&quot;dependencies&quot;&gt;Dependencies&lt;/h3&gt;
    &lt;p&gt;First we need to build a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lambda layer&lt;/code&gt; which will install dependencies for the lambda function:&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab Bash&quot;&gt;&lt;a href=&quot;#Bash&quot;&gt;Bash&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample Bash&quot; id=&quot;Bash&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/056166b6da844fcbe20271310e890ec0.js?file=layer.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;p&gt;Open the AWS Management Console and navigate to the AWS Lambda service.&lt;/p&gt;
    &lt;p&gt;Create a new layer: Click on &quot;Layers&quot; in the left navigation menu and then click the &quot;Create layer&quot; button.&lt;/p&gt;
    &lt;p&gt;Configure the layer: Provide a name for your layer, and optionally, a description and compatible runtimes. Select the appropriate runtime based on the code files included in your layer.&lt;/p&gt;
    &lt;p&gt;Upload the zip file: In the &quot;Code entry type&quot; section, select &quot;Upload a file from Amazon S3&quot; or &quot;Upload a file from your computer&quot;, depending on where your zip file is located. If it&apos;s on your local machine, choose the latter option. Then, click the &quot;Upload&quot; button and select your zip file.&lt;/p&gt;
    &lt;p&gt;Create the layer: Once the zip file is uploaded, click the &quot;Create&quot; button to create the Lambda layer.&lt;/p&gt;
    &lt;p&gt;Add the layer to your Lambda function: After the layer is created, you can add it to your Lambda function. Open the function&apos;s configuration, scroll down to the &quot;Layers&quot; section, and click on &quot;Add a layer&quot;. Select the layer you created from the list and click &quot;Add&quot;.&lt;/p&gt;
    &lt;h3 id=&quot;kafka-producer&quot;&gt;Kafka Producer&lt;/h3&gt;
    &lt;p&gt;We will write a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;producer&lt;/code&gt; to publish to MSK topic. Environment variables passed are:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;kafka_topic&lt;/strong&gt;. Producers write data to a specific topic, and consumers read from one or more topics.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Kafka broker&lt;/strong&gt;. Brokers receive messages from producers and serve them to consumers. Multiple brokers form a Kafka cluster, and they collaborate to provide fault tolerance, scalability, and high throughput.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;sasl username&lt;/strong&gt;. SASL (Simple Authentication and Security Layer) is a framework used for authentication and data security in distributed systems.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;sasl password&lt;/strong&gt;. Secret credential associated with a SASL username.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab Python&quot;&gt;&lt;a href=&quot;#Python&quot;&gt;Python&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample Python&quot; id=&quot;Python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/056166b6da844fcbe20271310e890ec0.js?file=kafka_producer.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
    &lt;h3 id=&quot;kafka-consumer&quot;&gt;Kafka Consumer&lt;/h3&gt;
    &lt;p&gt;Similarly, we can write a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;consumer&lt;/code&gt; to subscribe to the topic:&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab Python&quot;&gt;&lt;a href=&quot;#Python&quot;&gt;Python&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample Python&quot; id=&quot;Python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/056166b6da844fcbe20271310e890ec0.js?file=kafka_consumer.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-06-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/publish-to-msk-kafka-using-aws-lambda-python</link>
<guid isPermaLink="true">https://randomwits.com/blog/publish-to-msk-kafka-using-aws-lambda-python</guid>
</item>
<item>
  <title>Fix SonarQube Error of Public Writable Directories in AWS lambda python</title>
  <description>&lt;p&gt;In AWS Lambda functions, it&apos;s common to use temporary directories for tasks like generating temporary files, storing intermediate data, or processing data securely. However, improperly managing publicly writable directories can lead to security vulnerabilities. In this article, we&apos;ll explore how to address this issue and ensure safe usage of temporary directories in AWS Lambda functions using Python&apos;s tempfile module.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In AWS Lambda functions, it&apos;s common to use temporary directories for tasks like generating temporary files, storing intermediate data, or processing data securely. However, improperly managing publicly writable directories can lead to security vulnerabilities. In this article, we&apos;ll explore how to address this issue and ensure safe usage of temporary directories in AWS Lambda functions using Python&apos;s tempfile module.&lt;/p&gt;
    &lt;h3 id=&quot;the-problem-publicly-writable-directories&quot;&gt;The Problem: Publicly Writable Directories&lt;/h3&gt;
    &lt;p&gt;One common SonarQube warning is related to the usage of publicly writable directories. SonarQube raises this warning to highlight potential security risks when working with directories that have open write permissions. In the case of AWS Lambda functions, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tmp&lt;/code&gt; directory is often used for temporary file operations.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9832f3acbfaa468021d3c5cb44679242.js?file=wrong_example.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In this code snippet, the /tmp directory is publicly writable, which can pose security risks if not managed properly.&lt;/p&gt;
    &lt;h3 id=&quot;solution-use-tempfile&quot;&gt;Solution: Use tempfile&lt;/h3&gt;
    &lt;p&gt;To address the SonarQube warning and safely manage temporary directories in AWS Lambda functions, we can leverage Python&apos;s built-in tempfile module. The tempfile module provides a secure and convenient way to create temporary files and directories with proper permissions and unique names.&lt;/p&gt;
    &lt;p&gt;Here&apos;s an updated version of the code that uses the tempfile module:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/9832f3acbfaa468021d3c5cb44679242.js?file=correct_example.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In the updated code, we make use of the tempfile.gettempdir() function to retrieve the system&apos;s default temporary directory, which is typically /tmp on Linux-based systems. By using the system&apos;s default temporary directory, we ensure consistent and secure behavior across different environments.&lt;/p&gt;
    &lt;p&gt;The tempfile module automatically handles the creation of secure and unique temporary file names. It ensures that the file names are unique to avoid naming collisions and potential security risks.&lt;/p&gt;
    &lt;p&gt;By utilizing Python&apos;s tempfile module, we gain several benefits:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Secure and unique file names: The tempfile module generates unique file names automatically, reducing the risk of naming collisions. This ensures the integrity and security of temporary files.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Platform independence: The module abstracts the underlying platform&apos;s temporary directory and provides a consistent API across different environments. This improves the portability of your code.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Proper permissions: The tempfile module creates temporary files and directories with secure permissions by default. This helps restrict access to the temporary directory and ensures that other users or processes don&apos;t have unintended write access.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
  </description>
  <pubDate>2023-06-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/fix-sonarqube-error-public-writable-directories-aws-lambda-python</link>
<guid isPermaLink="true">https://randomwits.com/blog/fix-sonarqube-error-public-writable-directories-aws-lambda-python</guid>
</item>
<item>
  <title>TestContainers with Spring Boot</title>
  <description>&lt;p&gt;Testcontainers is a Java library that provides lightweight, disposable containers for running integration tests. It&apos;s a useful tool for testing applications that rely on external dependencies like databases or message queues.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Testcontainers is a Java library that provides lightweight, disposable containers for running integration tests. It&apos;s a useful tool for testing applications that rely on external dependencies like databases or message queues.&lt;/p&gt;
    &lt;p&gt;Setup a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;demo&lt;/code&gt; Spring boot project&lt;/p&gt;
    &lt;h3 id=&quot;gradle-dependencies&quot;&gt;Gradle Dependencies&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b74d54089885e9d1301ada9696e7d470.js?file=build.gradle&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;gradle-terminologies&quot;&gt;gradle terminologies&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;testImplementation&lt;/strong&gt;: This configuration is used for dependencies that are required only for the tests in your project. These dependencies will be available during the test compilation and execution phases, but they won&apos;t be included in the runtime classpath of your main application. This is useful when you have testing-specific libraries or frameworks that are not needed in the production code.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;compileOnly&lt;/strong&gt;: This configuration is used for dependencies that are required only during the compilation phase but not at runtime. These dependencies will be available during the compilation of your main application code but won&apos;t be included in the final runtime classpath. This is often used for dependencies that are used for compile-time only, such as annotation processors or libraries used for generating code.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;implementation&lt;/strong&gt;: This configuration is used for dependencies that are required during both the compilation and runtime phases of your application. These dependencies will be included in both the compilation classpath and the runtime classpath of your application. This is typically used for the main dependencies of your project that are required for the functionality of your application.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;define-repository-layer&quot;&gt;Define repository layer&lt;/h3&gt;
    &lt;p&gt;Create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;repository/Customer.java&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b74d54089885e9d1301ada9696e7d470.js?file=Customer.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;repository/CustomerRepository.java&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b74d54089885e9d1301ada9696e7d470.js?file=CustomerRepository.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;test-using-actual-database&quot;&gt;Test using actual database&lt;/h3&gt;
    &lt;p&gt;We can spin up database using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b74d54089885e9d1301ada9696e7d470.js?file=docker-compose.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Also define &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application.yaml&lt;/code&gt; as&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b74d54089885e9d1301ada9696e7d470.js?file=application.yaml&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We also need to define a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;resources/schema.sql&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b74d54089885e9d1301ada9696e7d470.js?file=schema.sql&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We can write our test as&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b74d54089885e9d1301ada9696e7d470.js?file=Test1.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;You can verify this by loging to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgres&lt;/code&gt; database as&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker &lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; &amp;lt;CONTAINER_ID&amp;gt; &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; user &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; database &lt;span class=&quot;nt&quot;&gt;-W&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;test-using-testcontainers&quot;&gt;Test using TestContainers&lt;/h3&gt;
    &lt;p&gt;Intead of running actual database everytime, it&apos;s much more convenient to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TestContainers&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b74d54089885e9d1301ada9696e7d470.js?file=Test2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Testcontainers&lt;/code&gt;: Integrates Testcontainers library with JUnit 5 to manage Docker containers for testing&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Container&lt;/code&gt;: Indicates the usage of a Docker container for testing.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@DynamicPropertySource&lt;/code&gt;: Allows the dynamic configuration of properties used in the Spring application context.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public static PostgreSQLContainer&amp;lt;?&amp;gt; pgsql = new PostgreSQLContainer(DockerImageName.parse(&quot;postgres:latest&quot;))&lt;/code&gt;: Declares a static field pgsql of type PostgreSQLContainer that represents a PostgreSQL Docker container. The container uses the postgres:latest image&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
  </description>
  <pubDate>2023-05-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/test-containers-spring-boot</link>
<guid isPermaLink="true">https://randomwits.com/blog/test-containers-spring-boot</guid>
</item>
<item>
  <title>Cribsheet for String in Java</title>
  <description>&lt;p&gt;Strings are immutable in java. It&apos;s best to convert string to StringBuilder/StringBuffer so that it&apos;s memory efficient for string manipulation.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Strings are immutable in Java, meaning their values cannot be changed once they are created. To efficiently manipulate strings, it is recommended to convert them to StringBuilder or StringBuffer objects. StringBuilder is preferable for its speed, while StringBuffer is thread-safe.&lt;/p&gt;
    &lt;p&gt;Here&apos;s an example of converting a string to a StringBuilder:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;abcd&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;StringBuilder&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StringBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Appending a value to the StringBuilder can be done using the append() method:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;zz&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To check the resulting string, you can convert the StringBuilder back to a string using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;toString()&lt;/code&gt; and compare it:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;abcdezz&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You can also retrieve the index location of a specific substring within the StringBuilder using the indexOf() method:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;zz&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you need to replace a portion of the string with another value, you can use the replace() method:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;foo&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;afooezz&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To reverse the string in the StringBuilder, you can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reverse()&lt;/code&gt; method:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;zzeoofa&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Removing a substring from the StringBuilder can be achieved using the delete() method:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;zzea&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Alternatively, you can delete a specific character at a given index using deleteCharAt():&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;deleteCharAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;zea&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To access a character at a specific index within the StringBuilder, you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;charAt()&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you wish to modify a character at a specific index, you can use setCharAt():&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCharAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;z&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You can obtain the ASCII value of a character by using the charAt() method and casting it to an int:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;asciiA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;asciiA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;97&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;asciiA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;A&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;asciiA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;65&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Conversely, you can convert an ASCII value back to a character using a cast:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;asciiA&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;a&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;asciiZ&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;Z&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;asciiZ&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2023-05-27T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/cribsheet-string-java</link>
<guid isPermaLink="true">https://randomwits.com/blog/cribsheet-string-java</guid>
</item>
<item>
  <title>Guide to Travel to Thailand</title>
  <description>&lt;p&gt;Thailand has got a bad reputation for its seedy masssage parlors and go go bars. However it&apos;s a beautiful country with plenty of toursit attractions. Below is my snapshot of my travel to Thailand.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Thailand has got a bad reputation for its seedy masssage parlors and go go bars. However it&apos;s a beautiful country with plenty of toursit attractions. Below is my snapshot of my travel to Thailand.&lt;/p&gt;
    &lt;p&gt;I wanted to get thai currency at &lt;strong&gt;IGI&lt;/strong&gt; airport. There&apos;s Thomas Cook at Terminal 3. They require&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;PAN card&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Passport&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Boarding pass&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;I couldn&apos;t use my US debit/credit cardss so had to use my local SBI debit card for the purchase. Sometimes &lt;strong&gt;ATM&lt;/strong&gt;s at the IGI airport doesn&apos;t have cash, so plan accordingly.&lt;/p&gt;
    &lt;p&gt;On-visa arrival has a fee of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;฿2200&lt;/code&gt;. You also need to give passport and fill an immigration form which needs&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;One color passport sized photo&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Address staying in Thailand&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;I flew from IGI airport to Suvarnabhumi International Airport (BKK). Suvarnabhumi is a Sanskrit word which means &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;land of gold&lt;/code&gt;. Below is the sculpture of &lt;a href=&quot;https://en.wikipedia.org/wiki/Samudra_Manthana&quot;&gt;Samudra Manthana&lt;/a&gt; at the airport.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/wxjtJsPM9bc&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/wxjtJsPM9bc?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/wxjtJsPM9bc/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sample&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;Sanskrit seems to be liturgical language in Thailand just like for Hindus in India. Almost 90 % of its population are Bhuddist. I found many temples in Thailand with Sanskrit hymns written in &lt;a href=&quot;https://en.wikipedia.org/wiki/Thai_script&quot;&gt;Thai script&lt;/a&gt;&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://twitter.com/tshrocks/status/1660241636394246145&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/thai_temples_sanskrit.png&quot; alt=&quot;Tweet&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;td&gt;&lt;br /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;If you are phone allows &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;eSIM&lt;/code&gt;, download the app &lt;a href=&quot;https://www.airalo.com/&quot;&gt;airolo&lt;/a&gt;. Purchase a plan and activate it when you reach to Thailand. However there are physical &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SIM&lt;/code&gt;s available at the airport for purchase.&lt;/p&gt;
    &lt;p&gt;I really liked &lt;a href=&quot;https://www.grab.com/sg/&quot;&gt;Grab&lt;/a&gt; which is a great app to book cabs, food, etc. There are other options like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bolt&lt;/code&gt; however it seems to work with cash only for me. Tuktuk in Thailand are supposed to be expensive so avoid it unless you really crave for the experiences.&lt;/p&gt;
    &lt;p&gt;If you are in Bangkok , I would really recommend this &lt;a href=&quot;https://www.airbnb.com/experiences/66091&quot;&gt;airbnb experience&lt;/a&gt;. You get to bike around the Bang Kachao, kayak and ride in a long-tail boat.&lt;/p&gt;
    &lt;p&gt;I booked parasailing through &lt;a href=&quot;https://www.mamybooking.com/&quot;&gt;mamybooking&lt;/a&gt;. Despite initial apprehensions about its potential fright factor, I was pleasantly surprised to discover that the experience was far less intimidating than expected. The thrill of soaring high above the seas, followed by those invigorating plunges, added an extra layer of excitement to the adventure. However, my biggest pet peeve was that the ride was of very short duration.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/WN09Oy8IgIo?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/WN09Oy8IgIo?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/WN09Oy8IgIo/hqdefault.jpg alt=&apos;Parasailing in Pattaya, Thailand Part 1&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Parasailing in Pattaya, Thailand Part 1&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/YGXienBN9lo?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/YGXienBN9lo?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/YGXienBN9lo/hqdefault.jpg alt=&apos;Parasailing in Pattaya, Thailand Part 2&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Parasailing in Pattaya, Thailand Part 2&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/69VSxchXdYs?autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/69VSxchXdYs?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/69VSxchXdYs/hqdefault.jpg alt=&apos;Parasailing in Pattaya, Thailand Part 3&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Parasailing in Pattaya, Thailand Part 3&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2023-05-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/guide-to-travel-to-thailand</link>
<guid isPermaLink="true">https://randomwits.com/blog/guide-to-travel-to-thailand</guid>
</item>
<item>
  <title>Dear Vishi, daily logs for May 7, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for May 7, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;!--begin_of_post --&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for May 7, 2023.&lt;/p&gt;
    &lt;h3 id=&quot;sleep&quot;&gt;Sleep&lt;/h3&gt;
    &lt;p&gt;I am still having jetlag I guess. I sleep at 3 am and wake at 8 am. It&apos;s been almost a week. There is hilarious quote about sleep&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;Dear sleep, I’m sorry we broke up this morning. I want you back!&quot; — Anonymous&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;I like to collect quotes and keep a personal &lt;a href=&quot;https://randomwits.com/quotes/&quot;&gt;collection&lt;/a&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;passport-from-us-embassy&quot;&gt;Passport from US Embassy&lt;/h3&gt;
    &lt;p&gt;I had applied for dropbox stamping on May 1, 2023. I am still waiting for my passport. More than a week has passed. I made a foolhardy plan to only give 2 week buffer before boarding my flight. Hope the passport comes on time.&lt;/p&gt;
    &lt;h3 id=&quot;30-days-of-lc-javascript-challenge&quot;&gt;30 Days of LC Javascript challenge&lt;/h3&gt;
    &lt;p&gt;There is a 30 day challenge hosted at &lt;a href=&quot;https://leetcode.com/discuss/study-guide/3458761/day-4-30-days-of-lc-javascript-challenge&quot;&gt;leetcode&lt;/a&gt;.&lt;/p&gt;
    &lt;h4 id=&quot;apply-transform-over-each-element-in-array&quot;&gt;Apply Transform Over Each Element in Array&lt;/h4&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Given an integer array arr and a mapping function fn, return a new array with a transformation applied to each element.
    Input: arr = [1,2,3], fn = function plusone(n) { return n + 1; }
    Output: [2,3,4]
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The solution is straightforward to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;create-hello-world-function&quot;&gt;Create Hello World Function&lt;/h4&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Write a function createHelloWorld. It should return a new function that always returns &quot;Hello World&quot;.
    Input: args = []
    Output: &quot;Hello World&quot;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Solution:&lt;/p&gt;
    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createHelloWorld&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(..&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Hello World&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;counter&quot;&gt;Counter&lt;/h4&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Given an integer n, return a counter function. This counter function initially returns n and then returns 1 more than the previous value every subsequent time it is called (n, n + 1, n + 2, etc).
    const counter = createCounter(10)
    counter() // 10
    counter() // 11
    counter() // 12
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Solution:&lt;/p&gt;
    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createCounter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This is a simple example of using closures in javascript.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Closure are nested function which has access to the outer scope&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;After the outer function is returned, by keeping a reference to the inner function (the closures) we prevent the outer scope to be destroyed.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;sonarqube-exclude-directories&quot;&gt;SonarQube exclude directories&lt;/h3&gt;
    &lt;p&gt;Sometimes you want to skip certain folders for scanning. Add following option to the config&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;-Dsonar.exclusions=**/site-packages/**
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;top-gun-movie&quot;&gt;Top Gun movie&lt;/h3&gt;
    &lt;p&gt;I watched it today. It was in my bucket list. I liked the soundtrack and visual effects.  I guess story could have been more captivating.&lt;/p&gt;
    &lt;h3 id=&quot;ng-book&quot;&gt;ng-book&lt;/h3&gt;
    &lt;p&gt;I am currenlty reading &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng-book&lt;/code&gt;&lt;/p&gt;
    &lt;p&gt;Create a new project&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ng new angular-hello-world
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;In the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;angular-hello-world/src/index.html&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;app-root&amp;gt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;lt;/app-root&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app-root&lt;/code&gt; is where application is rendered. It&apos;s a component.&lt;/p&gt;
    &lt;p&gt;To run the application, go to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:4200&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ng serve &lt;span class=&quot;nt&quot;&gt;--port&lt;/span&gt; 4200
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;create-a-component&quot;&gt;Create a component&lt;/h4&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ng generate component hello-world
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Component consist of two parts&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;a component decorator&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;a component definition class&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Open the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;angular-hello-world/src/app/hello-world/hello-world.component.ts&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;OnInit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@angualar/core&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;app-hello-world&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;templateUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./hello-world.component.html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;styleUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./hello-world.component.css&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HelloWorldComponent&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;OnInit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;ngOnInit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Component&lt;/code&gt; is the decorators. In the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;angular-hello-world/src/app/app.component.html&lt;/code&gt;, we can use&lt;/p&gt;
    &lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;app-hello-world&amp;gt;&amp;lt;/app-hello-world&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;I am tracking my books &lt;a href=&quot;https://randomwits.com/books&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
  </description>
  <pubDate>2023-05-07T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-05-07</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-05-07</guid>
</item>
<item>
  <title>Unit Test AWS Lambda Function in Python</title>
  <description>&lt;p&gt;AWS lambda function are event driven serverless code. To follow TDD, we should write unit test our lambda functions.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Project Structure&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;MyLambda/
    ├── __init__.py
    ├── lambda_function.py
    └── &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;
    ├── __init__.py
    └── test_my_lambda_test_lambda_function.py
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;__init__.py&lt;/code&gt; are empty files that mark the directories as python package so that they can be imported.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;We will create a simple &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lambda_function.py&lt;/code&gt; that simply returns id as response.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/1dd4fbf8a8eead83a9535e2ae10c6ecd.js?file=ex1.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We have a test corresponding to the test file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MyLambda/test/test_lambda_function.py&lt;/code&gt;:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/1dd4fbf8a8eead83a9535e2ae10c6ecd.js?file=ex2.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We will use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pytest&lt;/code&gt; to run our test:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;pytest &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--cov&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;MyLambda/test/test_my_lambda_test_lambda_function.py::test_lambda_handler PASSED
    &lt;span class=&quot;nt&quot;&gt;---------&lt;/span&gt; coverage: platform darwin, python 3.10.10-final-0 &lt;span class=&quot;nt&quot;&gt;----------&lt;/span&gt;
    Name                                                   Stmts   Miss  Cover
    &lt;span class=&quot;nt&quot;&gt;--------------------------------------------------------------------------&lt;/span&gt;
    MyLambda/__init__.py                                       0      0   100%
    MyLambda/lambda_function.py                                4      0   100%
    MyLambda/test/__init__.py                                  0      0   100%
    MyLambda/test/test_my_lambda_test_lambda_function.py       7      0   100%
    &lt;span class=&quot;nt&quot;&gt;--------------------------------------------------------------------------&lt;/span&gt;
    TOTAL                                                     11      0   100%
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;using-patch&quot;&gt;Using patch&lt;/h3&gt;
    &lt;p&gt;As our lambda function gets complex, we must explore additional functionality to test our lambda function. We can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;patch&lt;/code&gt; to mock resources like environment variables, etc&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/1dd4fbf8a8eead83a9535e2ae10c6ecd.js?file=ex3.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Our updated &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test&lt;/code&gt; becomes&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/1dd4fbf8a8eead83a9535e2ae10c6ecd.js?file=ex4.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;pytest-fixtures&quot;&gt;Pytest fixtures&lt;/h3&gt;
    &lt;p&gt;A fixture is a function that returns a test resource to supply a mock &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;context&lt;/code&gt; object to our lambda function. Let&apos;s rewrite our test function&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/1dd4fbf8a8eead83a9535e2ae10c6ecd.js?file=ex5.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;In our example, we define a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;event&lt;/code&gt; fixture that return dictionary. We then pass this fixture as an argument to our test function.&lt;/p&gt;
  </description>
  <pubDate>2023-05-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/unit-test-aws-lamda-python</link>
<guid isPermaLink="true">https://randomwits.com/blog/unit-test-aws-lamda-python</guid>
</item>
<item>
  <title>US H1b visa dropbox experience in India</title>
  <description>&lt;p&gt;As a non-immigrant worker in the United States, navigating the visa stamping process can be a cumbersome task. However, with proper planning and understanding of the process, the journey can be much smoother.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;As a non-immigrant worker in the United States, navigating the visa stamping process can be a cumbersome task. However, with proper planning and understanding of the process, the journey can be much smoother.&lt;/p&gt;
    &lt;p&gt;If you are on a visa in the US and need to travel outside of the country, it is likely that you will need to visit your home country to get a visa stamp. This stamp is essential for re-entry into the United States. However, if you are applying for the same visa class, you may be eligible for a convenient option called &quot;dropbox.&quot; This means that you do not need to go through the traditional visa interview process in order to obtain a US visa stamp.&lt;/p&gt;
    &lt;p&gt;Recently, I had to travel to India for personal reasons and decided to take advantage of the dropbox option. I booked an appointment at Delhi&apos;s VAC (Visa Application Center) located at the Shivaji Stadium Metro Station.&lt;/p&gt;
    &lt;p&gt;There were restrictions on carrying a bag or luggage, except for the necessary documents. After going through security, I was able to head to the VAC center, which was three levels below ground level.&lt;/p&gt;
    &lt;h3 id=&quot;documents-required&quot;&gt;Documents required&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Valid passport&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Appointment confirmation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;DS-160 confirmation&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;One passport photo (I got it from Walgreens in US, &lt;a href=&quot;https://travel.state.gov/content/travel/en/passports/how-apply/photos.html&quot;&gt;size requirement&lt;/a&gt;)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Employement verification letter&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;I-797 Approval Notice&lt;/code&gt; copy (Original I-797 is not deposited but carry it for authentication.).&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;passport-delivery&quot;&gt;Passport delivery&lt;/h3&gt;
    &lt;p&gt;If you selected &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;premium delivery&lt;/code&gt; while filling the appointment, you can go to &lt;a href=&quot;https://www.bluedart.com/web/guest&quot;&gt;Blue Dart website&lt;/a&gt;. You need to enter your &lt;strong&gt;UID&lt;/strong&gt;. This information is printed on your appointment confirmation page.&lt;/p&gt;
    &lt;p&gt;Track your passport by using &lt;strong&gt;UID&lt;/strong&gt; as &lt;strong&gt;Ref No&lt;/strong&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;customer-care&quot;&gt;Customer Care&lt;/h3&gt;
    &lt;p&gt;&lt;a href=&quot;https://ustraveldocs.com/in/en/contact-us&quot;&gt;ustraveldocs&lt;/a&gt; has phone numbers and office hours to contact the customer care.&lt;/p&gt;
  </description>
  <pubDate>2023-05-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/us-h1b-visa-dropbox-experience</link>
<guid isPermaLink="true">https://randomwits.com/blog/us-h1b-visa-dropbox-experience</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Apr 25, 2023.</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Apr 25, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Apr 25, 2023.&lt;/p&gt;
    &lt;h3 id=&quot;vs-code&quot;&gt;VS Code&lt;/h3&gt;
    &lt;p&gt;&lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;VS Code&lt;/a&gt; is one of my favorite editor. It&apos;s convenient to open any project via commandline&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$PROJECT&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;code &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Few of my shortcuts I use:&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**Cmd+Shift+F**&lt;/td&gt;
    &lt;td&gt;Find all the files for a given string&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Cmd+P**&lt;/td&gt;
    &lt;td&gt;Find the files&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**Cmd+Shift+P**&lt;/td&gt;
    &lt;td&gt;Open command pallete&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;google-search&quot;&gt;Google search&lt;/h3&gt;
    &lt;p&gt;Googling has now become synonym with searching. While usual google searches are great, however sometimes you can improve your search by using google keywords&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**python site:github.com**&lt;/td&gt;
    &lt;td&gt;Search python only at github.com&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**inurl:requirements.txt python site:github.com**&lt;/td&gt;
    &lt;td&gt;Search python only in requirements.txt at github.com&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**inurl:requirements.txt &quot;python&quot; site:github.com**&lt;/td&gt;
    &lt;td&gt;Search exactly &quot;python&quot; only in requirements.txt at github.com&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**python -java site:github.com**&lt;/td&gt;
    &lt;td&gt;Search python excluding java at github.com&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**filetype:pdf book**&lt;/td&gt;
    &lt;td&gt;Get result for only pdfs&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;snyk&quot;&gt;Snyk&lt;/h3&gt;
    &lt;p&gt;I am trying to implement &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;snyk&lt;/code&gt; in jenkins job for serverless project. It has clouformations and pythoh code. To scan for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cloudformations&lt;/code&gt;&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/4d1389608465c1aab6baf29b09369ddf.js?file=ex1.groovy&quot;&gt;&lt;/script&gt;
    &lt;p&gt;To scan &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;requirements.txt&lt;/code&gt; for python project&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/4d1389608465c1aab6baf29b09369ddf.js?file=ex2.groovy&quot;&gt;&lt;/script&gt;
    &lt;h3 id=&quot;startbucks&quot;&gt;Startbucks&lt;/h3&gt;
    &lt;p&gt;I ordered &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Iced London Fog Tea Latte&lt;/code&gt; at Starbucks. I modified it with only 1 pump of vanilla and light ice on recommendation of Richu. It was good and I am probably gonna stuck to this choice for some time.&lt;/p&gt;
  </description>
  <pubDate>2023-04-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-04-25</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-04-25</guid>
</item>
<item>
  <title>The Caste Politics in USA</title>
  <description>&lt;p&gt;I grew up in India and am still unable to grasp the complexity of the caste system. While there is still caste discrimination plaguing India, the country with a population of over a billion people, diverse languages, cultures, and levels of prosperity does not have a consensus on caste. However, it is unfortunate that a white professor in the US, who has lived all her life outside India, seems to claim expert knowledge on caste.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I grew up in India and am still unable to grasp the complexity of the caste system. While there is still caste discrimination plaguing India, the country with a population of over a billion people, diverse languages, cultures, and levels of prosperity does not have a consensus on caste. However, it is unfortunate that a white professor in the US, who has lived all her life outside India, seems to claim expert knowledge on caste.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://twitter.com/AudreyTruschke/status/1532762424943726592?lang=en&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/tweet_Audrey_Truschke.png&quot; alt=&quot;Tweet&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;How does one identify caste? Any Indian would tell you that it is by your last name. Since antiquity, last names have been associated with trades, and thus become a de facto marker of caste.&lt;/p&gt;
    &lt;p&gt;However, to claim that caste can be identified by visible markers is scientifically nonsensical. Opinions are not scientific facts, and there is no study that claims that caste is unique like race. Some caste activists claim that lower-caste individuals have a darker complexion than upper-caste individuals. However, not only is this claim racist, but it is also devoid of any rational basis. Of course, some individuals want to conflate caste with race so that caste politics become more potent in the US.&lt;/p&gt;
    &lt;p&gt;Thenmozhi Soundararajan, the founder of Equality Labs&lt;sup id=&quot;fnref:ref1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:ref1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, has made some troubling statements, such as claiming that the Nazis in Europe are actually upper-caste Indians. Such statements are not only factually incorrect but also insensitive and inflammatory. Furthermore, claiming that every act of Hindu scripture has brought nothing but violence and pain is a gross oversimplification and ignores the diverse interpretations and practices within Hinduism.&lt;/p&gt;
    &lt;p&gt;Caste is a complex issue in India, and there are varying opinions on how to address it. Many centrist and right-wing Hindus believe that Hinduism can be reformed, similar to how Christianity has undergone changes over time. They argue that caste discrimination is a result of people misinterpreting and misusing Hindu teachings, and that reforming the religion can help address this issue. On the other hand, the left in India believes that caste is inherent to Hinduism and that dismantling the caste system requires dismantling the religion itself. This view asserts that caste is a tool of oppression and social control, and cannot be separated from the religion that gave rise to it. There are also some extreme views, such as the suggestion by Prof Dwivedi that a French-style revolution is necessary to eradicate caste in India&lt;sup id=&quot;fnref:ref2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:ref2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;It&apos;s important to note that when Professor Dwivedi suggested a French-style revolution as a solution to India&apos;s caste stasis, she was essentially advocating for the violent overthrow of the upper caste Hindus. The French Revolution was known for its violent and bloody nature, with the guillotine being used to execute thousands of people, including the aristocrats. Similarly, in India, a revolution of this nature would involve the mass killing of upper caste Hindus, who are seen as the oppressors in the caste system. While dismantling the caste system is necessary, advocating for violence against a particular group of people is not the solution.&lt;/p&gt;
    &lt;p&gt;It&apos;s crucial to find peaceful and non-violent ways to dismantle the caste system and create a more equitable society for all. These differing political views on caste in India are not only affecting domestic politics but also spilling over into the US political landscape.&lt;/p&gt;
    &lt;p&gt;The California Civil Rights Department dismissed its case against two Cisco engineers who allegedly engaged in caste bias. However, even before the verdict, international and left/liberal media in India drew prima facie conclusions that it was a caste discrimination case.&lt;/p&gt;
    &lt;p&gt;Historical prejudice against India and Hindus is still prevalent, as evidenced by British historian James Mill&apos;s statement that &quot;under the glowing exterior of the Hindu, lies a general disposition to deceit and perfidy.&quot; Katherine Mayo in her book Mother India criticized India&apos;s treatment of women, the untouchables, animals, the countryside, and the character of its nationalistic politicians while opposing India&apos;s independence movement. Gandhi criticized it as &quot;report of a drain inspector sent out with the one purpose of opening and examining the drains of the country to be reported upon.&quot; A cartoon published by the New York Times on India&apos;s Mars mission also exhibited prejudice.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://www.dailymail.co.uk/indiahome/indianews/article-2778703/New-York-Times-slammed-racist-cartoon-India-s-Mars-mission.html&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://i.dailymail.co.uk/i/pix/2014/10/02/1412289503639_wps_2_CREATOR_gd_jpeg_v1_0_usin.jpg&quot; alt=&quot;Tweet&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:ref1&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://twitter.com/SatyamJayati/status/1645314489443663874&quot;&gt;https://twitter.com/SatyamJayati/status/1645314489443663874&lt;/a&gt; &lt;a href=&quot;#fnref:ref1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:ref2&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://asianlite.com/2022/top-news/a-french-style-revolution-can-only-help-india-recover-from-its-current-caste-stasis-says-prof-dwivedi/&quot;&gt;asianlite&lt;/a&gt; &lt;a href=&quot;#fnref:ref2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2023-04-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/caste-politics-in-usa</link>
<guid isPermaLink="true">https://randomwits.com/blog/caste-politics-in-usa</guid>
</item>
<item>
  <title>Transforming a blocking method to a reactive one using Spring Reactor</title>
  <description>&lt;p&gt;Reactive programming is becoming increasingly popular in modern software development, and the use of reactive frameworks like Spring Reactor and RxJava is becoming more common. Reactive programming is an event-driven approach to programming that emphasizes asynchronous data streams, non-blocking I/O, and functional programming.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Reactive programming is becoming increasingly popular in modern software development, and the use of reactive frameworks like Spring Reactor and RxJava is becoming more common. Reactive programming is an event-driven approach to programming that emphasizes asynchronous data streams, non-blocking I/O, and functional programming.&lt;/p&gt;
    &lt;p&gt;The code we&apos;re working with is a method that reads a value from Redis and returns an App object. The method is blocking, and the Redis call can take some time to complete. Here&apos;s the original code:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/31f81906fcf43e8395f455ee4ae2cbfc.js?file=Service1.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The method returns a Mono&lt;App&gt; object, which is a reactive stream that can emit one or more values. The Redis read operation is performed synchronously, which means that the thread calling this method will be blocked until the operation completes. This is not ideal in a reactive application, as we want to avoid blocking threads and keep the application responsive.&lt;/App&gt;&lt;/p&gt;
    &lt;p&gt;To make this method more reactive, we can use the Mono.fromCallable operator. This operator allows us to wrap a synchronous method call in a reactive stream. Here&apos;s the new code:&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/31f81906fcf43e8395f455ee4ae2cbfc.js?file=Service2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The fromCallable operator takes a Callable object, which is a functional interface that takes no arguments and returns a value. In our case, the Callable object wraps the Redis read operation. This operation is still synchronous, but it&apos;s now executed inside a reactive stream.&lt;/p&gt;
    &lt;p&gt;The onErrorResume operator allows us to handle exceptions that may be thrown during the Redis read operation. If an exception is thrown, we log a warning message and return an empty Mono.&lt;/p&gt;
    &lt;p&gt;In conclusion, by using the fromCallable operator, we&apos;ve transformed a blocking method into a reactive one. The Redis read operation is now executed asynchronously inside a reactive stream, which allows us to avoid blocking threads and keep our application responsive.&lt;/p&gt;
  </description>
  <pubDate>2023-04-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/transforming-a-blocking-method-to-reactive-one-using-spring-reactor</link>
<guid isPermaLink="true">https://randomwits.com/blog/transforming-a-blocking-method-to-reactive-one-using-spring-reactor</guid>
</item>
<item>
  <title>Navigating Buffers in LunarVim</title>
  <description>&lt;p&gt;Lunarvim is a powerful tool that can enhance productivity for advanced software engineers. One feature that is particularly useful for working with multiple files is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vsplit&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;telescope&lt;/code&gt;. However, it can become cumbersome to navigate between files using a mouse. &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Lunarvim is a powerful tool that can enhance productivity for advanced software engineers. One feature that is particularly useful for working with multiple files is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vsplit&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;telescope&lt;/code&gt;. However, it can become cumbersome to navigate between files using a mouse.&lt;/p&gt;
    &lt;p&gt;Easiest way is to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:bp&lt;/code&gt; command. However it jumps files sequentially.&lt;/p&gt;
    &lt;p&gt;First get the buffer number by typing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:ls&lt;/code&gt; which will display buffer number corresponding to the filename.&lt;/p&gt;
    &lt;p&gt;Now to make a jump to a specific file&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:buffer 2
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This allows you to quickly switch to a specific buffer, without having to cycle through all open buffers using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:bn&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:bp&lt;/code&gt; commands.&lt;/p&gt;
    &lt;p&gt;I mostly avoid using mouse and love to do most of my work using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyboard&lt;/code&gt;.&lt;/p&gt;
  </description>
  <pubDate>2023-03-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/navigating-buffers-in-lunarvim-tips-for-efficient-file-management</link>
<guid isPermaLink="true">https://randomwits.com/blog/navigating-buffers-in-lunarvim-tips-for-efficient-file-management</guid>
</item>
<item>
  <title>Dear Vishi, daily log on March 10, 2023.</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for March 10, 2023.
    &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for March 10, 2023.&lt;/p&gt;
    &lt;p&gt;My Twitter feed is being inundated with news regarding the collapse of Silicon Valley Bank. The stock price of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$SIVB&lt;/code&gt; has plummeted from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$300&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$80&lt;/code&gt; in just a few days. This piqued my curiosity, so I dug a little deeper to understand what the fuss is about.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/svb.png&quot; alt=&quot;Silicon Valley Bank&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Silicon Valley Bank is known for specializing in providing financial services and resources to early-stage and high-growth technology companies and venture capitalists. However, recent reports suggest that the bank may be facing financial challenges due to its investment strategies.&lt;/p&gt;
    &lt;p&gt;It was reported that the bank invested its customers&apos; money in mortgage-backed securities (MBS), which yield between 1.56-1.66%. However, the Federal Reserve interest rate is currently at 4.57%, which has caused concerns among depositors.&lt;/p&gt;
    &lt;p&gt;A bank run is a situation where a large number of depositors withdraw their funds from a bank at the same time, usually due to concerns about the bank&apos;s solvency or ability to meet its obligations. Silicon Valley Bank experienced a bank run because it had mostly uninsured deposits from startups who borrowed money from the same bank, leaving it vulnerable to a run.&lt;/p&gt;
    &lt;p&gt;The collapse of Silicon Valley Bank was reportedly due to depositors, mostly technology workers and venture capital-backed companies, pulling their money out, resulting in the bank&apos;s insolvency.&lt;/p&gt;
  </description>
  <pubDate>2023-03-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-03-10</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-03-10</guid>
</item>
<item>
  <title>Set up markdown editor locally using docker</title>
  <description>&lt;p&gt;If you&apos;re a writer or a developer who frequently deals with text formatting, you&apos;re probably familiar with Markdown. Markdown is a lightweight markup language that allows you to easily format text using simple syntax. While you can write Markdown in any text editor, using a dedicated Markdown editor can make the process much easier and more efficient.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;If you&apos;re a writer or a developer who frequently deals with text formatting, you&apos;re probably familiar with Markdown. Markdown is a lightweight markup language that allows you to easily format text using simple syntax. While you can write Markdown in any text editor, using a dedicated Markdown editor can make the process much easier and more efficient.&lt;/p&gt;
    &lt;h3 id=&quot;install-docker&quot;&gt;Install Docker&lt;/h3&gt;
    &lt;h3 id=&quot;pull-the-markdown-image-docker-image&quot;&gt;Pull the Markdown image Docker Image&lt;/h3&gt;
    &lt;p&gt;We can use markdown editor like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dillinger&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stackedit&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;Once you have Docker installed, open up a terminal window and run the following command to pull the Dillinger Docker image from Docker Hub:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# use dillinger&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;imageDocker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;linuxserver/dillinger&quot;&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# or use stackedit&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;imageDocker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;benweet/stackedit&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker pull &lt;span class=&quot;nv&quot;&gt;$imageDocker&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;run-the-docker-container&quot;&gt;Run the Docker Container&lt;/h3&gt;
    &lt;p&gt;After pulling the Docker image, run the following command to start a new Docker container:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker run &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 8087:8080 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$imageDocker&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;access-the-editor-in-your-browser&quot;&gt;Access the editor in Your Browser&lt;/h4&gt;
    &lt;p&gt;Open up your web browser and navigate to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost:8087&lt;/code&gt; to access the Markdown editor interface.&lt;/p&gt;
  </description>
  <pubDate>2023-02-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/set-up-markdown-editor-locally-using-docker</link>
<guid isPermaLink="true">https://randomwits.com/blog/set-up-markdown-editor-locally-using-docker</guid>
</item>
<item>
  <title>Cribsheet for Set in Java</title>
  <description>&lt;p&gt;A set in Java is a collection that stores a unique set of elements. This means that there are no duplicates in a set. You can define set using HashSet, TreeSet, or LinkedHashSet.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;A set in Java is a collection that stores a unique set of elements. This means that there are no duplicates in a set. You can define set using HashSet, TreeSet, or LinkedHashSet.&lt;/p&gt;
    &lt;div&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/6550255e0cf551112a494f4920727a9c.js?file=Set1.java&quot;&gt;&lt;/script&gt;&lt;/div&gt;
    &lt;p&gt;If you don&apos;t care about the order of your elements and want the best performance, use HashSet. If you need your elements to be in sorted order, use TreeSet. If you want to maintain the order in which elements were added, use LinkedHashSet.&lt;/p&gt;
    &lt;h3 id=&quot;time-complexity&quot;&gt;Time Complexity&lt;/h3&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Method&lt;/th&gt;
    &lt;th&gt;HashSet&lt;/th&gt;
    &lt;th&gt;TreeSet&lt;/th&gt;
    &lt;th&gt;LinkedHashSet&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;add(E e)&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;td&gt;O(log n)&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;remove(Object o)&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;td&gt;O(log n)&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contains(Object o)&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;td&gt;O(log n)&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;size()&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;iterator()&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;td&gt;O(1)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clear()&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;O(n)&lt;/td&gt;
    &lt;td&gt;O(n)&lt;/td&gt;
    &lt;td&gt;O(n)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;using-apis&quot;&gt;Using APIs&lt;/h3&gt;
    &lt;div&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/6550255e0cf551112a494f4920727a9c.js?file=Set2.java&quot;&gt;&lt;/script&gt;&lt;/div&gt;
    &lt;p&gt;Interestingly we can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt; primitive data type instead of Integer like&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;element&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mySet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;element is: &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We are iterating over the set and extracting each Integer object, which we can then use in our code. If we were to use for (int element : mySet) instead, we would be attempting to extract int primitives from the set, which is not possible since sets can only contain objects. However this will not throw error because the int values in the Set are automatically boxed into Integer objects by the compiler. This process is called autoboxing and has performance cost.&lt;/p&gt;
  </description>
  <pubDate>2023-02-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/cribsheet-for-set-in-java</link>
<guid isPermaLink="true">https://randomwits.com/blog/cribsheet-for-set-in-java</guid>
</item>
<item>
  <title>Create a Dummy JSON API with JSON-Server</title>
  <description>&lt;p&gt;JSON-Server is a popular tool for creating fake REST APIs quickly and easily. It&apos;s a great option for testing purposes when you need to mock up an API to see how your application interacts with it.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;JSON-Server is a popular tool for creating fake REST APIs quickly and easily. It&apos;s a great option for testing purposes when you need to mock up an API to see how your application interacts with it.&lt;/p&gt;
    &lt;p&gt;Here&apos;s how you can use JSON-Server to create a dummy JSON API that you can access via curl on your local machine:&lt;/p&gt;
    &lt;p&gt;Install JSON-Server globally on your machine using npm.&lt;/p&gt;
    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;npm&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;g&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Create a JSON file that will act as your API endpoint. For example, you could create a file named db.json and add the following JSON data to it:&lt;/p&gt;
    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;posts&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Hello World!&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;author&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Tushar Sharma&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Foo Bar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;author&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Neo Matrix&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Start the JSON-Server using the following command, specifying the db.json file you created in step 2 as the source of your data:&lt;/p&gt;
    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;watch&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3003&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Make a curl request to your localhost to access the data from your dummy JSON API.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl http://localhost:3003/posts
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You should see the JSON data that you added to your db.json file returned in the curl response. JSON-Server is not intended for use in production, it is only meant for use in development and testing environments.&lt;/p&gt;
  </description>
  <pubDate>2023-02-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/create-a-dummy-json-api-with-json-server</link>
<guid isPermaLink="true">https://randomwits.com/blog/create-a-dummy-json-api-with-json-server</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Feb 07, 2023.</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Feb 07, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Feb 07, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;english&quot;&gt;English&lt;/h2&gt;
    &lt;p&gt;Do you know what a horseplay is? As expected in English, it has nothing to do with horses. Horseplay is a rough play or pranks in which people push or hit each other or behave in a silly way.&lt;/p&gt;
    &lt;h2 id=&quot;mustache&quot;&gt;Mustache&lt;/h2&gt;
    &lt;p&gt;Mustache is a template engine for Java. To add it&apos;s dependency&lt;/p&gt;
    &lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;com.github.spullara.mustache.java&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;compiler&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;0.9.6&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Define a mustache template..&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Hello {{name}}!&amp;lt;/h1&amp;gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Create a Java class to hold the data:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HelloMessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HelloMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Render the template&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;MustacheFactory&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;DefaultMustacheFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Mustache&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mustache&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;compile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;template.mustache&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;HelloMessage&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HelloMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;John Doe&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;StringWriter&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StringWriter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;mustache&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;flush&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will print&lt;/p&gt;
    &lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello John Doe!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2023-02-07T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-02-07</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-02-07</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Feb 06, 2023.</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Feb 06, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Feb 06, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;learning-spanish&quot;&gt;Learning spanish&lt;/h2&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;English&lt;/th&gt;
    &lt;th&gt;Spanish&lt;/th&gt;
    &lt;th&gt;Comments&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;I like chicken&lt;/td&gt;
    &lt;td&gt;me gusta el pollo&lt;/td&gt;
    &lt;td&gt;pollo is poyo, gusta is to like&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;I like the apple&lt;/td&gt;
    &lt;td&gt;me gusta la manzana&lt;/td&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;¿Cómo te llamas?&lt;/td&gt;
    &lt;td&gt;What is your name?&lt;/td&gt;
    &lt;td&gt;llamas is yamas&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;¿Te gusta el helado?&lt;/td&gt;
    &lt;td&gt;Do you like ice cream ?&lt;/td&gt;
    &lt;td&gt;te means you&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;In Spanish, it&apos;s common to start questions with &quot;¿&quot;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;el is used for masculine singluar nouns, la is used for feminine singular nouns.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;I came across a website called &lt;a href=&quot;https://www.newsinslowspanish.com/latino&quot;&gt;News in Slow Spanish&lt;/a&gt; which reads spanish slowly and with captions.&lt;/p&gt;
  </description>
  <pubDate>2023-02-06T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-02-06</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-02-06</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Feb 05, 2023.</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Feb 05, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Feb 05, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;leetcode-problem&quot;&gt;Leetcode problem&lt;/h2&gt;
    &lt;p&gt;Today I tried solving &lt;a href=&quot;https://leetcode.com/problems/powx-n/&quot;&gt;problem&lt;/a&gt; to Implement pow(x, n), which calculates x raised to the power n (i.e., xn).&lt;/p&gt;
    &lt;p&gt;My first solution was a brute force method.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Solution&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;myPow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;power&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;flip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;power&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;flip&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;power&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;power&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;power&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This didn&apos;t work and gave time limit exceeded. We can modify this and use a divide-and-conquer approach to calculate x raised to the power n in logarithmic time:&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Solution&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;myPow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;half&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myPow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;half&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;half&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;half&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;half&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;half&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;half&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here the trick is that nstead of trying to solve the problem all at once, the code splits the problem into smaller parts by dividing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; by 2 each time and calling itself with the new value of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;When &quot;n&quot; is equal to 0, the result is always 1, as any number raised to 0 is 1.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Otherwise, the method calculates the result of the function for &quot;n/2&quot; (stored in &quot;half&quot;), which is x^(n/2).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If &quot;n&quot; is even, then &quot;n/2&quot; is also even and x^n can be written as (x^(n/2))^2. The result is then (x^(n/2))^2 = half * half.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If &quot;n&quot; is positive and odd, then x^n can be written as x^(n-1) * x. Since (n-1) is even, the result can be calculated as (x^((n-1)/2))^2 * x = half * half * x.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If &quot;n&quot; is negative, then x^n can be written as 1/(x^-n). Since (-n) is positive, the result can be calculated as 1/(x^(-n)) = 1/(x^n) = half * half / x.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;tennis&quot;&gt;Tennis&lt;/h2&gt;
    &lt;p&gt;I went to play tennis today. I guess consistence is the key. Everytime I miss a week or so, I see dip in my performance. Tennis meetup was at 3 pm but I went at 4.30 pm. I just had lunch at noon. Few folks play till night.&lt;/p&gt;
    &lt;h2 id=&quot;b-r-ambedkar-views-on-gandhi&quot;&gt;B. R. Ambedkar views on Gandhi&lt;/h2&gt;
    &lt;p&gt;In a 1955 BBC interview, B. R. Ambedkar said, &quot;Gandhi was never a Mahatma; I refuse to call him a Mahatma.&quot; There were strong disaggrements between Gandhi and Ambedkar.&lt;/p&gt;
    &lt;p&gt;Interestingly, Albert Einstein had a different opinion about Gandhi, &quot;Generations to come will scarce believe that such a one as this ever in flesh and blood walked upon this earth&quot;&lt;/p&gt;
    &lt;h2 id=&quot;pakistans-former-president-pervez-musharraf-dies&quot;&gt;Pakistan&apos;s former President, Pervez Musharraf Dies&lt;/h2&gt;
    &lt;p&gt;Just read news today that  Pervez Musharraf has died. There was a tweet by Mehbooba Mufti that I find problematic.&lt;/p&gt;
    &lt;p&gt;He was architect of Kargil war which was a fruitless war. Sending condolescences is formally accepted, but she wrote that he genuiely tried to address Kahsmir issues.&lt;/p&gt;
    &lt;p&gt;I guess there lot a disaggrements I have with BJP politics of Hindutava, but this tweet is in bad taste.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://twitter.com/MehboobaMufti/status/1622150018064068610&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://i.imgur.com/yrJHrmO.png&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Below is the link of his interview.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/sB-tkTgbt78&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/sB-tkTgbt78?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/sB-tkTgbt78/hqdefault.jpg alt=&apos;Sample&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Interview Pervez Musharraf&quot;&gt;&lt;/iframe&gt;
  </description>
  <pubDate>2023-02-05T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-02-05</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-02-05</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Jan 31, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Jan 31, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Jan 31, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;mustard-goes-missing&quot;&gt;Mustard Goes Missing&lt;/h2&gt;
    &lt;p&gt;I am absolutely dismayed on how Mustard managed to escape from his cage. He has been missing for 24 hours now. As the apartment was secured, it is unlikely that he has escaped into the outside world.&lt;/p&gt;
    &lt;p&gt;Update: After an extensive search, I finally found Mustard hiding in the closet of my roommate&apos;s room. I initially intended to slap him or scold him to say the least, but he looked tired and hungry so I decided to quietly let him back crawl back into his cage. Gave him carrots and coriander for food.&lt;/p&gt;
    &lt;h2 id=&quot;working-with-vim&quot;&gt;Working with Vim&lt;/h2&gt;
    &lt;p&gt;How to open files in vim which are staged in git&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git diff &lt;span class=&quot;nt&quot;&gt;--cached&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--name-only&lt;/span&gt; | xargs &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; vim
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;sabor-latin-street-grill&quot;&gt;Sabor Latin Street Grill&lt;/h2&gt;
    &lt;p&gt;I went to Sabor Latin Street Grill for lunch today. They offer a deal on Tuesdays, known as &quot;Taco Tuesday&quot;, where tacos are sold at a reduced price. Authentic tacos are priced at $1.49 and I had four of them. They were filling.&lt;/p&gt;
    &lt;h2 id=&quot;react-js&quot;&gt;React JS&lt;/h2&gt;
    &lt;p&gt;Let&apos;s say you wish to retrieve a list of projects from a GET endpoint. The following code sample demonstrates how you can achieve this using the React JS library and Axios:&lt;/p&gt;
    &lt;div class=&quot;language-jsx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
    &lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;axios&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;axios&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;projectOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;setProjectOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;axios&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://localhost:8080/projects&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;setProjectOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[])&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;projectOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;git-pull-request&quot;&gt;Git Pull Request&lt;/h2&gt;
    &lt;p&gt;In certain instances, Git pull requests may display commits that are already present in the target branch. A possible solution to this issue is as follows:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git fetch origin
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout feature-01
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git rebase origin/master
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git push &lt;span class=&quot;nt&quot;&gt;--force-with-lease&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2023-01-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-01-31</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-01-31</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Jan 30, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Jan 30, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Jan 30, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;cooking&quot;&gt;Cooking&lt;/h2&gt;
    &lt;p&gt;I made vermicelli today. Here&apos;s the recipe&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Saute onion, garlic, tomatoes with salt and other spices.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Pour water and vermicelli and cover the lid and let it rest for some time (I forgot to count how much time).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Cut coriander and garnish it.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;panera&quot;&gt;Panera&lt;/h2&gt;
    &lt;p&gt;I ate dinner at Panera. I liked that they have pick up two option.I had tomato soup and half chipotle chicken sandwitch.&lt;/p&gt;
    &lt;h2 id=&quot;git&quot;&gt;Git&lt;/h2&gt;
    &lt;p&gt;Git status command also shows untracked files. Sometime it&apos;s too much clutter. Hide untracked files&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git config &lt;span class=&quot;nt&quot;&gt;--local&lt;/span&gt; status.showUntrackedFiles no
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;node-vs-npm&quot;&gt;Node vs NPM&lt;/h2&gt;
    &lt;p&gt;Node.js is JavaScript runtime environment that executes JavaScript code outside of a browser. Check node version as&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;node &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;NPM(Node Package Manager) is a package manager for Node.js that helps manage packages and dependencies for a Node.js project. Check npm version as&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;npm &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;unable-to-find-valid-certification-path-to-requested-target&quot;&gt;Unable to find valid certification path to requested target&lt;/h2&gt;
    &lt;p&gt;I got this error in Spring boot while making a GET request to bitbucket. First got to bitbucket website.&lt;/p&gt;
    &lt;p&gt;Click on lock icon left of url bar. Connection is secure -&amp;gt; Certificate is valid -&amp;gt; Details -&amp;gt; Export to download SSL certificate file.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;keytool &lt;span class=&quot;nt&quot;&gt;--import&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-alias&lt;/span&gt; spring.cer &lt;span class=&quot;nt&quot;&gt;-file&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$filename&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-keystore&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$JAVA_HOME&lt;/span&gt;/lib/security/cacerts
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Then it will ask for keystore password which is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;changeit&lt;/code&gt;.&lt;/p&gt;
  </description>
  <pubDate>2023-01-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-01-30</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-01-30</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Jan 29, 2023</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for Jan 29, 2023.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for Jan 29, 2023.&lt;/p&gt;
    &lt;h2 id=&quot;git&quot;&gt;Git&lt;/h2&gt;
    &lt;p&gt;When you do &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git status&lt;/code&gt; , sometimes you want to filter some result. For example if you dont want to see deleted files.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git status | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; deleted
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Or filter multiple words&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git status | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-E&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;deleted|modified&apos;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here -v is for invert-search &amp;amp; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-E&lt;/code&gt; is for egrep. You can type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;man grep&lt;/code&gt; for more detail.&lt;/p&gt;
    &lt;h2 id=&quot;react&quot;&gt;React&lt;/h2&gt;
    &lt;p&gt;You can install dependencies and start the app&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;rm &lt;/span&gt;package-lock.json
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;npm start
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To create dropdown you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;select&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-jsx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt; 
    &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectedValue&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt; 
    &lt;span class=&quot;na&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setSelectedValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here , &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;value&lt;/code&gt; is used to set the default selected value in the dropdown list when the component first renders. It is taken from the values object using the get function.&lt;/p&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;options&lt;/code&gt; is an array of objects that represents the dropdown list options. Each option object contains the text to be displayed in the list and its corresponding value. When the component is rendered, these options will be displayed as the available choices for the user to select from.&lt;/p&gt;
    &lt;p&gt;You can pass &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;options&lt;/code&gt; as&lt;/p&gt;
    &lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Option 1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Option 1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Option 2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Option 2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Option 3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Option 3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;guinea-pig-food&quot;&gt;Guinea Pig food&lt;/h2&gt;
    &lt;p&gt;I stopped at Petsmart today to buy pellets for piggies. Those little cute bastards are pooping volcanoes. They even poop in their sleep. It&apos;s one of the worst thing owning a guinea pig.&lt;/p&gt;
    &lt;h2 id=&quot;brussel-sprouts&quot;&gt;Brussel Sprouts&lt;/h2&gt;
    &lt;p&gt;Brussels sprouts are not my favoruite food. Here&apos;s the recipe&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Cut the Sprouts in half and discard the stem.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Pour olive oil over the sprouts in the tray with black pepper and salt.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Heat oven with 425 temperature.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Bake them for 20 minutes.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;tennis&quot;&gt;Tennis&lt;/h2&gt;
    &lt;p&gt;I played tennis in the morning. My serves keep hitting the net. I guess I need to work on my serves. I usually do continental serve but had to switch to pancake serves when I hit too many of them.&lt;/p&gt;
  </description>
  <pubDate>2023-01-29T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-logs-2023-01-29</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-logs-2023-01-29</guid>
</item>
<item>
  <title>Young Earth Creationism</title>
  <description>&lt;p&gt;I stumbled upon a youtube &lt;a href=&quot;https://www.youtube.com/watch?v=82j1IqwA6P0&quot;&gt;video&lt;/a&gt; of Georgia Purdom, an American biologist and young Earth creationist. As a biologist, how can one reject the theory of evolution, the very foundation of the field?&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I stumbled upon a youtube &lt;a href=&quot;https://www.youtube.com/watch?v=82j1IqwA6P0&quot;&gt;video&lt;/a&gt; of Georgia Purdom, an American biologist and young Earth creationist. As a biologist, how can one reject the theory of evolution, the very foundation of the field?&lt;/p&gt;
    &lt;p&gt;In a YouTube video, Purdom attempts to use scientific language to argue for the feasibility of Noah&apos;s Ark, while simultaneously claiming that the Earth is no older than 10,000 years old.&lt;/p&gt;
    &lt;p&gt;Purdom is an employee of Answers in Genesis, a far-right Christian organization that promotes the belief that the Earth is only 6,000 years old. They argue that relying on man-made dating methods, which they deem fallible and often inaccurate, leads to a range of conflicting ages for the Earth.&lt;/p&gt;
    &lt;p&gt;Here&apos;s an excerpt from their &lt;a href=&quot;https://answersingenesis.org/age-of-the-earth/how-old-is-the-earth/&quot;&gt;website&lt;/a&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    When we start our thinking with God&apos;s Word, we see that the world is about 6,000 years old. When we rely on man&apos;s fallible (and often demonstrably false) dating methods, we can get a confusing range of ages from a few thousand to billions of years, though the vast majority of methods do not give dates even close to billions.
    The age of the earth ultimately comes down to a matter of trust—it&apos;s a worldview issue. Will you trust what an all-knowing God says on the subject, or will you trust imperfect man’s assumptions and imaginations about the past that regularly are changing?
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;It is a testament to the words of the philosopher, George Santayana, that they selectively use science to support their narrative, while disregarding it when it contradicts their beliefs. It reminds me of Kurt Wise who had a PhD in Geology from Harvard University. He could not reconcile with modern science and his faith in Christianity. He is also an young earth creationist.&lt;/p&gt;
    &lt;p&gt;In the words of Galileo Galilei remind us: &quot;I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use.&quot; This serves as a reminder that academic degrees do not necessarily indicate a scientific mindset, as the philosopher, Immanuel Kant, once said: &quot;The greatest problem of our time is that the majority of educated people are still not educated.&quot;&lt;/p&gt;
  </description>
  <pubDate>2023-01-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/young-earth-creationism</link>
<guid isPermaLink="true">https://randomwits.com/blog/young-earth-creationism</guid>
</item>
<item>
  <title>Scan Code locally using SonarQube</title>
  <description>&lt;p&gt;SonarQube is an open-source platform used to manage code quality. It provides static code analysis, which means it can automatically analyze code to detect bugs, vulnerabilities, and code smells (design issues that could lead to problems in the future).&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;SonarQube is an open-source platform used to manage code quality. It provides static code analysis, which means it can automatically analyze code to detect bugs, vulnerabilities, and code smells (design issues that could lead to problems in the future).&lt;/p&gt;
    &lt;p&gt;You can use Docker to run SonarQube in a container. This can be useful if you don&apos;t want to install SonarQube directly on your machine, or if you want to easily set up a test environment.&lt;/p&gt;
    &lt;p&gt;Go to the &lt;a href=&quot;https://www.docker.com/&quot;&gt;Docker website&lt;/a&gt; and download and install Docker for your operating system.
    Follow the installation instructions to set up Docker on your machine.&lt;/p&gt;
    &lt;p&gt;Next we will pull up the docker image.&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;export imageName=sonarqube
    docker pull $imageName&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d32f5c55302cadd0e7fa8255fb1f5f3b.js?file=ex2.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;If you are using ARM based Mac, you might get following error&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;no matching manifest &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;linux/arm64/v8 &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;the manifest list entries
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Instead use a different docker image on Mac&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;export imageName=davealdon/sonarqube-with-docker-and-m1-macs&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d32f5c55302cadd0e7fa8255fb1f5f3b.js?file=ex4.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Run the SonarQube container:&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;docker run -d –name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 $imageName&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d32f5c55302cadd0e7fa8255fb1f5f3b.js?file=ex5.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Login to sonarqube server locally at http://localhost:9000 using following credentials&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Username : admin
    Password : admin
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;For token go to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;My Profile -&amp;gt; Security -&amp;gt; Generate token&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;Install the sonar-scanner. For Mac you can use&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;brew install sonar-scanner&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d32f5c55302cadd0e7fa8255fb1f5f3b.js?file=ex3.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Lastly go to the folder where you want to scan&lt;/p&gt;
    &lt;div style=&quot;display:none;&quot;&gt;
    &lt;p&gt;$ sonar-scanner -X  \
    -Dsonar.projectKey=Test \
    -Dsonar.sources=. \
    -Dsonar.java.binaries=build/classes \
    -Dsonar.host.url=http://localhost:9000 \
    -Dsonar.login=&lt;token&gt;&lt;/token&gt;&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/d32f5c55302cadd0e7fa8255fb1f5f3b.js?file=ex1.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2023-01-03T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/scan-code-locally-sonarqube</link>
<guid isPermaLink="true">https://randomwits.com/blog/scan-code-locally-sonarqube</guid>
</item>
<item>
  <title>Find if Path Exists in Graph leetcode solution</title>
  <description>&lt;p&gt;It&apos;s a easy problem on Graph in leetcode to find if a path exist in graph.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;It&apos;s a easy problem on Graph in leetcode to find if a path exist in graph.&lt;/p&gt;
    &lt;h3 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h3&gt;
    &lt;p&gt;There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1 (inclusive). The edges in the graph are represented as a 2D integer array edges, where each edges[i] = [ui, vi] denotes a bi-directional edge between vertex ui and vertex vi. Every vertex pair is connected by at most one edge, and no vertex has an edge to itself.&lt;/p&gt;
    &lt;p&gt;You want to determine if there is a valid path that exists from vertex source to vertex destination.&lt;/p&gt;
    &lt;p&gt;Given edges and the integers n, source, and destination, return true if there is a valid path from source to destination, or false otherwise.&lt;/p&gt;
    &lt;h3 id=&quot;explanation&quot;&gt;Explanation&lt;/h3&gt;
    &lt;p&gt;To solve this problem, you can use a graph traversal algorithm, such as breadth-first search (BFS).&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Create a queue to store nodes that need to be visited.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Add the start node to the queue.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;While the queue is not empty:&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Remove the first node from the queue.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the node is the end node, return True (a path has been found).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Otherwise, add all of the node&apos;s neighbors to the queue.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the queue is empty and the end node has not been found, return False (no path exists).&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/7b99a20c4164f2ef510729218f0cef1b.js?file=ValidPath.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2022-12-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/find-if-path-exists-in-graph</link>
<guid isPermaLink="true">https://randomwits.com/blog/find-if-path-exists-in-graph</guid>
</item>
<item>
  <title>Dear Vishi, is Nemo a Male or a Female?</title>
  <description>&lt;p&gt;Unless you were living under a rock, it&apos;s very likely that you saw the movie - Finding Nemo. I liked Marlin who was nemo&apos;s dad who faught against the odds to recover his son. Can you tell me if nemo was male or a female?.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Unless you were living under a rock, it&apos;s very likely that you saw the movie - Finding Nemo. I liked Marlin who was nemo&apos;s dad who faught against the odds to recover his son. Can you tell me if nemo&apos;s dad was a male or a female?&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://unsplash.com/photos/rEM3cK8F1pk/download?w=437&quot; alt=&quot;Finding Nemo&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;That&apos;s a silly question. Of course Marlin was a male in the movie. But he was also a clownfish. Clownfish are hermaphrodite. Hermaphrodites are organisms which have both male and female reproductive organs. All clownfish are born as males. A male fish changes to female if there is no female available.&lt;/p&gt;
    &lt;p&gt;Do you know any other species that&apos;s a hermaphrodite? Most flowering plants are hermaphrodite. They disperse pollen as well as receive pollen. However they can also self-fertilize but plants avoid it because inbreeding causes harmful mutation. Inbreeding even in humans have deleterious effects on offspring.&lt;/p&gt;
  </description>
  <pubDate>2022-12-05T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/is-nemo-male-or-female</link>
<guid isPermaLink="true">https://randomwits.com/blog/is-nemo-male-or-female</guid>
</item>
<item>
  <title>Dear Vishi, what&apos;s the Philosophy of Kintsugi?</title>
  <description>&lt;p&gt;How often do you bump into a painter? &quot;So what do you do?&quot;, I asked. &quot;Well I am a painter&quot;, she said. &quot;Like a real painter?&quot;. &quot;Yes&quot;.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;How often do you bump into a painter? &quot;So what do you do?&quot;, I asked. &quot;Well I am a painter&quot;, she said. &quot;Like a real painter?&quot;. &quot;Yes&quot;&lt;/p&gt;
    &lt;p&gt;It&apos;s the time of the year in November when it gets cold in Carolinas. It&apos;s not as freezing as as up north. However enough for me to reach for my jumper.&lt;/p&gt;
    &lt;p&gt;Every weekend I try to plan to visit events to meet new people. Mostly Saturdays are reserved for this activity. It was one of the event in Greenville, South Carolina where I happened to meet this lady who was a painter.&lt;/p&gt;
    &lt;p&gt;She showed me her portfolio of paintings. Most of it had pictures of toddler. However few of them were that of women with cracks. May be cracks were there only to add an aesthetic purpose.&lt;/p&gt;
    &lt;p&gt;She explained to me that the crack was inspired &lt;strong&gt;kintsugi&lt;/strong&gt; which is a Japanese art of pottery which glue back broken pottery by using lacquer, a natural resin made from tree sap. The lacquer is sprinkled with gold powder.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;https://mymodernmet.com/wp/wp-content/uploads/2017/04/kintsugi-update-2.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;But why fix a broken pottery? The pottery resembles some aspect of ourself. With time, the pottery will be broken or damaged with scars which is inevitable. The key is to not to abandon the pottery but rebuild it which is going to be more resilient and beautiful than the original pottery. The cracks symbolizes the experiences which we encounter in life.&lt;/p&gt;
  </description>
  <pubDate>2022-11-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/philosophy-kintsugi</link>
<guid isPermaLink="true">https://randomwits.com/blog/philosophy-kintsugi</guid>
</item>
<item>
  <title>AWS CLI to stop running instances of statemachine</title>
  <description>&lt;p&gt;I could not delete a statemachine that had running instances stuck in Progress. Since the number of instances were humongous, it was impossible to manually delete them using UI.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I could not delete a statemachine that had running instances stuck in Progress. Since the number of instances were humongous, it was impossible to manually delete them using UI.&lt;/p&gt;
    &lt;p&gt;We can bulk delete these instances using aws-cli in bash.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/sfn1.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;First we can get list of all executions of a statemachine that are in running state.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;aws stepfunctions list-executions &lt;span class=&quot;nt&quot;&gt;--state-machine-arn&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$arn&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--status-filter&lt;/span&gt; RUNNING &lt;span class=&quot;nt&quot;&gt;--query&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;executions[*].{executionArn:executionArn}&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--output&lt;/span&gt; text&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can combine this with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stop-execution&lt;/code&gt; command like&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;i &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;aws stepfunctions list-executions &lt;span class=&quot;nt&quot;&gt;--state-machine-arn&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$arn&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--status-filter&lt;/span&gt; RUNNING &lt;span class=&quot;nt&quot;&gt;--query&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;executions[*].{executionArn:executionArn}&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--output&lt;/span&gt; text&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do
    &lt;/span&gt;aws stepfunctions stop-execution &lt;span class=&quot;nt&quot;&gt;--execution-arn&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /dev/null 2&amp;gt;&amp;amp;1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;However this might be slow for large number of executions. Much faster solution would be to execute them in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parallel&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;14000
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;aws  stepfunctions list-executions &lt;span class=&quot;nt&quot;&gt;--state-machine-arn&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$arn&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--status-filter&lt;/span&gt; RUNNING  &lt;span class=&quot;nt&quot;&gt;--max-items&lt;/span&gt; 10000 | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;executionArn | &lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{print $2}&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s/\&quot;//g&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s/,//g&apos;&lt;/span&gt; | xargs &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; 1 &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 1 &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; 10 aws stepfunctions stop-execution &lt;span class=&quot;nt&quot;&gt;--execution-arn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;/dev/null 2&amp;gt;&amp;amp;1
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can combine both solution if you still have a large number of executions. You can set count to the number of times you want to repeat this process.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;20
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;i &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;seq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$count&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do 
    &lt;/span&gt;aws  stepfunctions list-executions &lt;span class=&quot;nt&quot;&gt;--state-machine-arn&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$arn&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--status-filter&lt;/span&gt; RUNNING  &lt;span class=&quot;nt&quot;&gt;--max-items&lt;/span&gt; 10000 | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;executionArn | &lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{print $2}&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s/\&quot;//g&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s/,//g&apos;&lt;/span&gt; | xargs &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; 1 &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 1 &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; 10 aws stepfunctions stop-execution &lt;span class=&quot;nt&quot;&gt;--execution-arn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;/dev/null 2&amp;gt;&amp;amp;1
    &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here,&lt;/p&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;14000&lt;/code&gt; is the value I got from trial and error. Any larger value than 14000 throws following error from the API&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;An error occurred &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ThrottlingException&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; when calling the ListExecutions operation
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2022-11-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/aws-cli-to-stop-running-instances-of-statemachine</link>
<guid isPermaLink="true">https://randomwits.com/blog/aws-cli-to-stop-running-instances-of-statemachine</guid>
</item>
<item>
  <title>Hamster Mustard Learns to climb</title>
  <description>&lt;p&gt;I have a Syrian hamster called Mustard. In less than a week he has learned to climb stairs.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I have a Syrian hamster called Mustard. In less than a week he has learned to climb stairs.&lt;/p&gt;
    &lt;h3 id=&quot;attempt-1&quot;&gt;Attempt 1&lt;/h3&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/2WhUFy7v8KU&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/2WhUFy7v8KU?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/2WhUFy7v8KU/hqdefault.jpg alt=&apos;Hamster Hammy learns to climb&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Russian President Putin announces military operation in Ukraine&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;attempt-2&quot;&gt;Attempt 2&lt;/h3&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/E1-IY-2BYV4&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/E1-IY-2BYV4?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/E1-IY-2BYV4/hqdefault.jpg alt=&apos;Hamster Hammy learns to climb&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Russian President Putin announces military operation in Ukraine&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Though hamster have poor eyesight, they are not afraid to venture out into new territories. I hope with time he grows and learn new tricks.&lt;/p&gt;
  </description>
  <pubDate>2022-11-17T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/hamster-mustard-learns-to-climb</link>
<guid isPermaLink="true">https://randomwits.com/blog/hamster-mustard-learns-to-climb</guid>
</item>
<item>
  <title>Setup a development environment on Windows using wsl2</title>
  <description>&lt;p&gt;Most of the terminal I have used in Windows were at best lackluster. However wsl2 is a game changer which makes your Windows OS Unixy.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Most of the terminal I have used in Windows were at best lackluster. However wsl2 is a game changer which makes your Windows OS Unixy.&lt;/p&gt;
    &lt;p&gt;First download the Windows terminal form here. By default, it will open Windows Powershell.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/wsl1.png&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Next we need to install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ubuntu&lt;/code&gt; virtual machine. Open Windows &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Powershell&lt;/code&gt; and type&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; wsl &lt;span class=&quot;nt&quot;&gt;--install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; Ubuntu
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You might need to reboot for the changes to be updated.&lt;/p&gt;
    &lt;p&gt;You can select Ubuntu from the setting as default&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/wsl2.png&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Next, we&apos;ll make the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;terminal&lt;/code&gt; more usable.&lt;/p&gt;
    &lt;p&gt;First install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oh-my-zsh&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get update &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;git zsh &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;sh &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nerd&lt;/code&gt; font&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Download &lt;a href=&quot;http://nerdfonts.com/&quot;&gt;Nerd Font&lt;/a&gt;. I downloaded &lt;a href=&quot;https://madmalik.github.io/mononoki/&quot;&gt;Mononoki&lt;/a&gt; font.&lt;/li&gt;
    &lt;li&gt;Unzip and install it on Windows.&lt;/li&gt;
    &lt;li&gt;In Settings -&amp;gt; Ubuntu -&amp;gt; Additional Settings -&amp;gt; Appearance -&amp;gt; Font face -&amp;gt; mononoki NF&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Generate a &lt;strong&gt;guid&lt;/strong&gt; using powershell&lt;/p&gt;
    &lt;div class=&quot;language-powershell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;guid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NewGuid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Open Command Palette -&amp;gt; settings.json&lt;/p&gt;
    &lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;profiles:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;list:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;colorScheme&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;One Half Dark&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;font&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; 
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;face&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;mononoki NF&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;size&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;guid&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;{GUID}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hidden&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Ubuntu&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;source&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Windows.Terminal.Wsl&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Powerlevel10k&lt;/code&gt; theme&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone &lt;span class=&quot;nt&quot;&gt;--depth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
    &lt;span class=&quot;c&quot;&gt;# Add following in ~/.zshrc&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;ZSH_THEME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;powerlevel10k/powerlevel10k&quot;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; ~/powerlevel10k/powerlevel10k.zsh-theme
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;zsh 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;It will prompt powerlevel font setup. If not type&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;p10k configure
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.p10k.zsh&lt;/code&gt; to only show current directory&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# change &lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;typeset&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;POWERLEVEL9K_SHORTEN_STRATEGY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;truncate_to_unique
    &lt;span class=&quot;c&quot;&gt;# change it to &lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;typeset&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;POWERLEVEL9K_SHORTEN_STRATEGY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;truncate_to_last
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Install lunarvim from &lt;a href=&quot;https://randomwits.com/blog/neovim-setup-with-lunarvim&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
  </description>
  <pubDate>2022-11-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/setup-a-development-environment-on-windows-using-wsl2</link>
<guid isPermaLink="true">https://randomwits.com/blog/setup-a-development-environment-on-windows-using-wsl2</guid>
</item>
<item>
  <title>Pandas inner join on dataframes</title>
  <description>&lt;p&gt;Performing inner join on pandas dataframe is straightforward. However I wanted to override values from the right dataframe.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Performing inner join on pandas dataframe is straightforward. However I wanted to override values from the right dataframe.&lt;/p&gt;
    &lt;p&gt;Let us assume we have two dataframes as&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;df1_data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;orange&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;lemon&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt;   
    &lt;span class=&quot;n&quot;&gt;df1_df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;DataFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df1_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;columns&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;fruit&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; 
    &lt;span class=&quot;n&quot;&gt;df2_data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;guava&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;orange&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;jackfruit&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;df2_df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;DataFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df2_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;columns&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;fruit&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can visualize these dataframes as&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/pandas_inner_join1.png&quot; alt=&quot;Pandas Inner Join&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Cast column &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt; as integer&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;df1_df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df1_df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;astype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;df2_df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df2_df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;astype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can perform a simple inner join on key &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;df1_df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;merge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df2_df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;how&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;inner&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/pandas_inner_join2.png&quot; alt=&quot;Pandas Inner Join&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Since we need to retain right column , so we can rename columns from the left with suffix as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dup&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df1_df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;merge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df2_df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;how&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;inner&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;suffixes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;_dup&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/pandas_inner_join3.png&quot; alt=&quot;Pandas Inner Join&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;We can drop rows where fruit_dup is not equal to fruit column since we are only interested in differences.&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;fruit_dup&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;fruit&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/pandas_inner_join4.png&quot; alt=&quot;Pandas Inner Join&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Lastly we can drop the _dup column&lt;/p&gt;
    &lt;pre&gt;&lt;code class=&quot;language-pyton&quot;&gt;del df[&apos;fruit_dup&apos;]
    &lt;/code&gt;&lt;/pre&gt;
  </description>
  <pubDate>2022-11-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/pandas-compare-two-dataframes</link>
<guid isPermaLink="true">https://randomwits.com/blog/pandas-compare-two-dataframes</guid>
</item>
<item>
  <title>Resolve the Error CROSSSLOT Keys in request don&apos;t hash to the same slot</title>
  <description>&lt;p&gt;AWS offers managed service Amazon MemoryDB which is redis compatible. The entire keyspace in Redis cluster is divided into hash slots and these slots are assigned to multiple nodes. In redis, getting a single value is straightforward.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;AWS offers managed service Amazon MemoryDB which is redis compatible.. The entire keyspace in Redis cluster is divided into hash slots and these slots are assigned to multiple nodes. In redis-cli, getting a single value is straightforward&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; mget &lt;span class=&quot;s2&quot;&gt;&quot;user1.key1&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; mget &lt;span class=&quot;s2&quot;&gt;&quot;user1.key2&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;However if you want to run multi-operations in redis,&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; MULTI 
    Queued
    &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; EVAL &lt;span class=&quot;s2&quot;&gt;&quot;return redis.call(&apos;TIME&apos;)[1]&quot;&lt;/span&gt; 0 0
    &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; mget &lt;span class=&quot;s2&quot;&gt;&quot;user1.key1&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; mget &lt;span class=&quot;s2&quot;&gt;&quot;user1.key2&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; EVAL &lt;span class=&quot;s2&quot;&gt;&quot;return redis.call(&apos;TIME&apos;)[1]&quot;&lt;/span&gt; 0 0
    &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; EXEC
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This would most likely will result in following error&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;error&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; CROSSSLOT Keys &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;request don&lt;span class=&quot;s1&quot;&gt;&apos;t hash to the same slot
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;solution-1&quot;&gt;Solution 1&lt;/h2&gt;
    &lt;p&gt;One solution is to force redis to insert the keys into same slot. We can achieve that using pattern &quot;{…}&quot;&lt;/p&gt;
    &lt;p&gt;So we have to modify are keys as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{user1}.key1&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{user1}.key2&lt;/code&gt;. Here hash slots are only computed for keys within the braces&lt;/p&gt;
    &lt;h2 id=&quot;solution-2&quot;&gt;Solution 2&lt;/h2&gt;
    &lt;p&gt;We could simply use a python library &lt;a href=&quot;https://github.com/redis/redis-py&quot;&gt;redis&lt;/a&gt;, if you dont want to modify your keys&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/8873da1fe181ff7624be0d544310c560.js?file=conn.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;To execute commands that are currently &lt;a href=&quot;https://github.com/redis/redis-py/blob/master/redis/commands/cluster.py&quot;&gt;supported&lt;/a&gt;&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;conn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;conn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To execute an arbitrary &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;redis command&lt;/code&gt;,&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;conn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;execute_command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;zscan key1 0 MATCH *EMAIL:random@email.com*#* COUNT 100000&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2022-10-07T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/crossslot-keys-error-redis</link>
<guid isPermaLink="true">https://randomwits.com/blog/crossslot-keys-error-redis</guid>
</item>
<item>
  <title>Is Wikipedia bias?</title>
  <description>&lt;p&gt;What&apos;s the first link that google throws at you when you search anything? Wikipedia is always foremost search result that you encounter. When it comes to science and technology, Wikipedia often provides good foundation for the beginners. However when it comes to politics, Wikipedia often begins to falter.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;What&apos;s the first link that google throws at you when you search anything? Wikipedia is always foremost search result that you encounter. When it comes to science and technology, Wikipedia often provides good foundation for the beginners. However when it comes to politics, Wikipedia often begins to falter.&lt;/p&gt;
    &lt;p&gt;Most of my assessment of Wikipedia comes from Indian context. But I do see similar accusation against Wikipedia in other countries.&lt;/p&gt;
    &lt;p&gt;Here&apos;s a Wikipedia article of &lt;a href=&quot;https://en.wikipedia.org/wiki/Kangana_Ranaut&quot;&gt;Kangana Ranaut&lt;/a&gt;, an Indian actress who leans toward right wing in ideologies.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/kangana.png&quot; alt=&quot;Kangana Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;However, there&apos;s another Wikipedia article of &lt;a href=&quot;https://en.wikipedia.org/wiki/Swara_Bhasker&quot;&gt;Swara Bhasker&lt;/a&gt;, also an Indian actress who leans toward left-wing ideologies. There&apos;s no mention of her idealogies. Here&apos;s a video of her raising commnist slogan, &lt;a href=&quot;https://en.wikipedia.org/wiki/Lal_Salam&quot;&gt;lal salam&lt;/a&gt;.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/MG5mYkKnC5E&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/MG5mYkKnC5E?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/MG5mYkKnC5E/hqdefault.jpg alt=&apos;MG5mYkKnC5E&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;MG5mYkKnC5E&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Lary Sanger, co-founder of Wikipedia, Wikipedia has become a &quot;propaganda for the left-leaning establishment&quot;&lt;sup id=&quot;fnref:sanger&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:sanger&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. So is Wikipedia unfair to right-wing idealogies?&lt;/p&gt;
    &lt;p&gt;When you visit any Wikipedia page, notice the protected badge on the top right page of wikipedia page. Some of the badge means that there&apos;s conflicting opinion and page is locked against edits for a particular viewpoint. It&apos;s therefore best to research those topics outside the realm of Wikipedia.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/wiki.png&quot; alt=&quot;Kangana Image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:sanger&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;https://nypost.com/2021/07/16/wikipedia-co-founder-says-site-is-now-propaganda-for-left-leaning-establishment/ &lt;a href=&quot;#fnref:sanger&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-09-28T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/is-wikipedia-bias</link>
<guid isPermaLink="true">https://randomwits.com/blog/is-wikipedia-bias</guid>
</item>
<item>
  <title>How to have fun negotiating with a ransomware gang</title>
  <description>&lt;p&gt;I stumbled upon a &lt;a href=&quot;https://ig.ft.com/ransomware-game/&quot;&gt;ransomware negotiation simulator&lt;/a&gt; by Financial Times. It&apos;s a mock simulation where you&apos;re in a hot seat at a hacked company, trying to stop cybercriminals from releasing sensitive data they have stolen from your systems.
    &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I stumbled upon a &lt;a href=&quot;https://ig.ft.com/ransomware-game/&quot;&gt;ransomware negotiation simulator&lt;/a&gt; by Financial Times. It&apos;s a mock simulation where you&apos;re in a hot seat at a hacked company, trying to stop cybercriminals from releasing sensitive data they have stolen from your systems.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/ransomware.png&quot; alt=&quot;Ransomwhere blog&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;So far I am not able to win negotiatons with the attackers. The FT says that the simulation is based upon interviews with real-life ransomware negotiators, and conversations with security researchers and company executives who have been on the sharp end of an attack. I guess it&apos;s a nightmare for any company to deal with breach of security.&lt;/p&gt;
  </description>
  <pubDate>2022-09-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/how-to-have-fun-negotiating-with-a-ransomware-gang</link>
<guid isPermaLink="true">https://randomwits.com/blog/how-to-have-fun-negotiating-with-a-ransomware-gang</guid>
</item>
<item>
  <title>WaterFire Event at Providence, Rhode Island</title>
  <description>&lt;p&gt;Waterfire is a popular festival at Providence, Rhode Island. The Waterplace park is lit up with bonfires along with boat processions and music. There are also food trucks if you are feeling hungry.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Waterfire is a popular festival at Providence, Rhode Island. The Waterplace park is lit up with bonfires along with boat processions and music. There are also food trucks if you are feeling hungry.&lt;/p&gt;
    &lt;p&gt;Some of the snapshots from the event.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/Ir4gtwvvdlQ&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/Ir4gtwvvdlQ?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/Ir4gtwvvdlQ/hqdefault.jpg alt=&apos;Ir4gtwvvdlQ&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Waterfire Providence&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/s_NoLbuVioY&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/s_NoLbuVioY?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/s_NoLbuVioY/hqdefault.jpg alt=&apos;s_NoLbuVioY&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;s_NoLbuVioY&quot;&gt;&lt;/iframe&gt;
  </description>
  <pubDate>2022-09-24T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/waterfire-providence</link>
<guid isPermaLink="true">https://randomwits.com/blog/waterfire-providence</guid>
</item>
<item>
  <title>Extract tweets from Twitter using Python</title>
  <description>&lt;p&gt;In this tutorial, we will extract tweets from Twitter using python.&lt;!-- truncate_here --&gt;
    In this tutorial, we will extract tweets from Twitter using python.&lt;/p&gt;
    &lt;p&gt;First lets create a project-&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ac2739f5e0282add422a1430988a4a3d.js?file=start.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We will use &lt;a href=&quot;https://python-poetry.org/&quot;&gt;poetry&lt;/a&gt; for managing our dependencies.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ac2739f5e0282add422a1430988a4a3d.js?file=poetry.sh&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We haven&apos;t implemented anything, so it will just ouput &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Get tweets for the tshrocks&lt;/code&gt; to the console. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tshrocks&lt;/code&gt; is my twitter profile username&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ac2739f5e0282add422a1430988a4a3d.js?file=get-tweets1.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Next we need to authenticate with twitter, where we need access and consumer keys from twitter. You can go to &lt;a href=&quot;https://developer.twitter.com/en/apps&quot;&gt;developer page&lt;/a&gt; and create an app to get your keys.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ac2739f5e0282add422a1430988a4a3d.js?file=get-tweets2.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Lastly, here&apos;s the full code.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/ac2739f5e0282add422a1430988a4a3d.js?file=get-tweets.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We can get tweets by running&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry run python get-tweets tshrocks
    Get tweets &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;the tshrocks
    getting tweets before 1284662084169596930
    ...389 tweets downloaded so far
    getting tweets before 1030303523794288639
    ...571 tweets downloaded so far
    getting tweets before 909242746770247681
    ...771 tweets downloaded so far
    getting tweets before 312978397368291328
    ...963 tweets downloaded so far
    getting tweets before 153814759517585407
    ...1157 tweets downloaded so far
    getting tweets before 99546946154409983
    ...1177 tweets downloaded so far
    getting tweets before 83587008219447295
    ...1177 tweets downloaded so far
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can open our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;csv&lt;/code&gt; file with any editor or excel.&lt;/p&gt;
  </description>
  <pubDate>2022-09-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/get-tweets-python</link>
<guid isPermaLink="true">https://randomwits.com/blog/get-tweets-python</guid>
</item>
<item>
  <title>Ping Pong at Pig Pounder Brewery</title>
  <description>&lt;p&gt;I was looking for a company to play ping pong. I found a table tennis meetup at Pig Pound Brewery at Greensboro, North Carolina. I drove hundred miles from Charlotte to reach the place which is a testimony to the fact that I really like the sport.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I was looking for a company to play ping pong. I found a table tennis meetup at Pig Pound Brewery at Greensboro, North Carolina. I drove hundred miles from Charlotte to reach the place which is a testimony to the fact that I really like the sport.&lt;/p&gt;
    &lt;p&gt;The brewery has a nice pig graffiti on their walls. It has two table tennis table kind of close to each other which left less room for maneuvering. One table was occupied by kids. We were left with only one table to play.&lt;/p&gt;
    &lt;p&gt;There was also a live music event at the venue by Banjo Earth. Interestingly, one the singer of the band visited Kashmir, India and composed the song, Nights in Kashmir.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/opMiJZ0fkcs&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/opMiJZ0fkcs?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/opMiJZ0fkcs/hqdefault.jpg alt=&apos;Nights in Kashmir&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Nights in Kashmir&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2022-09-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/ping-pong-at-pig-pounder</link>
<guid isPermaLink="true">https://randomwits.com/blog/ping-pong-at-pig-pounder</guid>
</item>
<item>
  <title>Download and Play Super Mario Odyssey on PC (Yuzu Emulator)</title>
  <description>&lt;p&gt;Super Mario Odyssey is a 2017 video game has been voted as the one of the best Mario game ever made. The game is only available for Nitendo Switch. Luckily I end up playing the game on Windows nonetheless.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;style&gt;
    .download-container {
    text-align: center; 
    margin-top: 40px; 
    padding: 20px;
    }
    .download-btn {
    background-color: #f44336;
    color: white;
    padding: 15px 30px;
    text-align: center; 
    text-decoration: none; 
    display: inline-block; 
    font-size: 18px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2)
    transition: background-color 0.3s ease, transform 0.2s ease;
    }
    .download-btn:hover {
    background-color: #d32f2f; 
    cursor: pointer;
    transform: translateY(-3px); 
    }
    .download-btn:active {
    background-color: #b71c1c; 
    transform: translateY(0); 
    }
    &lt;/style&gt;
    &lt;p&gt;Super Mario Odyssey is a 2017 video game has been voted as the one of the best Mario game ever made. The game is only available for Nitendo Switch. Luckily I end up playing the game on Windows nonetheless.&lt;/p&gt;
    &lt;p&gt;We need to download &lt;a href=&quot;https://yuzu-emu.org/downloads/&quot;&gt;yuzu&lt;/a&gt; emulator. Follow the instructions to install it on Windows. First download and install Microsoft Visual C++ redistributable. Next download &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yuzu_install.exe&lt;/code&gt;.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;If you get error, yuzu encryption keys are missing. &lt;br /&gt;&lt;br /&gt;
    Fix: Download the &lt;a href=&quot;https://raw.githubusercontent.com/icosaswitch/Yuzu-NAND/master/prod.keys&quot;&gt;prod&lt;/a&gt; file.&lt;br /&gt;&lt;br /&gt; 
    On Yuzu Windows -&amp;gt; Go to File -&amp;gt; Open Yuzu folder &lt;br /&gt;&lt;br /&gt;
    Save the file under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keys&lt;/code&gt; folder.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Download the game below. Open &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yuzu&lt;/code&gt; emulator  and click on plus sign (Add new Game directory). Navigate to the game directory.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/yuzu1.png&quot;  /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;If you don&apos;t have joystick, you might want to configure keyboard with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yuzu&lt;/code&gt; emulator. Download &lt;a href=&quot;https://drive.google.com/file/d/1IwMqMr8E0L_crNhhaWnYqSShTCqliRN8/view?usp=sharing&quot;&gt;input.zip&lt;/a&gt;. Extract the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zip&lt;/code&gt; file under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Yuzu -&amp;gt; config -&amp;gt; input&lt;/code&gt; folder.&lt;/p&gt;
    &lt;p&gt;You can got &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Emulation -&amp;gt; configure -&amp;gt; Control&lt;/code&gt; and see the connect controller indicated in green color.&lt;/p&gt;
    &lt;p&gt;You can launch the game by clicking the game icon.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/yuzu2.png&quot;  /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;div class=&quot;download-container&quot;&gt;
    &lt;a class=&quot;download-btn&quot; href=&quot;https://multiup.io/project/020dcfb5564df1e45a615514752d9ac7&quot; target=&quot;_blank&quot;&gt;Download the Game&lt;/a&gt;
    &lt;/div&gt;
    &lt;p&gt;For the password, in the comments type &quot;randomwits.com&quot; and &quot;your email&quot;, and I will send the password.&lt;/p&gt;
    &lt;p&gt;
    If you want to request any specific game, drop me a 
    &lt;a href=&quot;/contact&quot; aria-label=&quot;Explore complete game catalog&quot;&gt;
    message
    &lt;i class=&quot;fas fa-chevron-right&quot;&gt;&lt;/i&gt;
    &lt;/a&gt;
    &lt;/p&gt;
  </description>
  <pubDate>2022-09-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/How-to-play-Super-Mario-Odyssey-on-PC-Yuzu-Emulator</link>
<guid isPermaLink="true">https://randomwits.com/blog/How-to-play-Super-Mario-Odyssey-on-PC-Yuzu-Emulator</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Aug 30, 2022</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log on Aug 30, 2022.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log on Aug 30, 2022.&lt;/p&gt;
    &lt;h2 id=&quot;running&quot;&gt;Running&lt;/h2&gt;
    &lt;p&gt;Today I woke up around 6.30 AM. I decided to go to the tail for jogging. I feel running helps in lifting up the mood. According to this study &lt;sup id=&quot;fnref:study&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:study&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, endocannabinoids molecules are released by body while running which help regulate your sleep, mood, appetite, memory and even reproduction and fertility.&lt;/p&gt;
    &lt;center&gt;
    &lt;a href=&quot;https://connect.garmin.com/modern/activity/9506839415&quot; target=&quot;_blank&quot;&gt;
    &lt;img src=&quot;https://i.imgur.com/JkH2mtv.png&quot; /&gt;
    &lt;/a&gt;
    &lt;/center&gt;
    &lt;h2 id=&quot;people&quot;&gt;People&lt;/h2&gt;
    &lt;p&gt;Today I want to talk about Ted Williams who was begging and living on the streets of the US state of Ohio. However, he had a unique voice of a radio jockey. It&apos;s amazing how a viral video can sometime change fortune.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/TWmPhDyjY8Y&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/TWmPhDyjY8Y?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/TWmPhDyjY8Y/hqdefault.jpg alt=&apos;US beggar&apos;s priceless gift
    &apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;US beggar&apos;s priceless gift
    &quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;ping-pong&quot;&gt;Ping Pong&lt;/h2&gt;
    &lt;p&gt;I played &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ping pong&lt;/code&gt; today. I still have to learn to master &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spin&lt;/code&gt; while serving. Most corporate office have table tennis table. It&apos;s a great stress buster. I&apos;ll share a video of how difficult it is to return a pro table tennis serve.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/K9hnwZmTLGA&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/K9hnwZmTLGA?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/K9hnwZmTLGA/hqdefault.jpg alt=&apos;Return My Serve, Win $100&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Return My Serve, Win $100&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:study&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S0306453021000470&quot;&gt;Sciencedirect&lt;/a&gt; &lt;a href=&quot;#fnref:study&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-08-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-log-2022-08-30</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-log-2022-08-30</guid>
</item>
<item>
  <title>Dear Vishi, daily log on Aug 29, 2022</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log on Aug 29, 2022.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log on Aug 29, 2022.&lt;/p&gt;
    &lt;h2 id=&quot;reading-origin-of-species&quot;&gt;Reading &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Origin of Species&lt;/code&gt;&lt;/h2&gt;
    &lt;p&gt;Charles Darwin coined the term called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Natural Selection&lt;/code&gt;. In his own words, &quot;Owing to this struggle for life, any variation, however slight and from whatever cause proceeding, if it be in any degree profitable to an individual of any species, in its infinitely complex relations to other organic beings and to external nature, will tend to the preservation of that individual, and will generally be inherited by its offspring.The offspring, also, will thus have a better chance of surviving, for, of the many individuals of any species which are periodically born, but a small number can survive. I have called this principle, by which each slight variation, if useful, is preserved, by the term of Natural Selection, in order to mark its relation to man&apos;s power of selection.&quot;&lt;/p&gt;
    &lt;p&gt;So variations in the organisms that are suited for their environment are “naturally selected” to survive and become more common. It’s the foundation of the modern theory of evolution.&lt;/p&gt;
    &lt;h2 id=&quot;words-of-the-day&quot;&gt;Words of the day&lt;/h2&gt;
    &lt;p&gt;I want to introduce you to two new words in the English language-&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Sagacious: Somebody who has sound judgment. Like he was sagacious enough to pay his taxes on time.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Concur: Agree. Like he concurred with my views.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h3 id=&quot;vitamins&quot;&gt;Vitamins&lt;/h3&gt;
    &lt;p&gt;I am taking Vitamin D3 (every alternative day) with a dose of 125 mcg. I think it&apos;s better to take Vitamin D from supplements than the sun. According to this study in Yale &lt;sup id=&quot;fnref:yale&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:yale&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, consuming Vitamin D from either food, supplements, or Sun is the same. Another problem with taking vitamin D from the sun is that there are ultraviolet (UV) rays that can damage the skin, eyes, and immune system.&lt;/p&gt;
    &lt;p&gt;However, there&apos;s another study that says that Vitamin D supplements &lt;sup id=&quot;fnref:supp&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:supp&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; are not adequately absorbed by the human body. In another research, Richard Weller of the University of Edinborough Medical School, found that exposing volunteers in 2010 to 30 minutes of sunlight, without sunscreen, raised their levels of nitric oxide, which in turn brought their blood pressure down.&lt;/p&gt;
    &lt;p&gt;So is sunlight good or bad for us? I guess like I always said moderation is the mantra. If you stay for an extended time in the sunlight, use a good sunscreen with SPF number of at least 30.&lt;/p&gt;
    &lt;h3 id=&quot;java&quot;&gt;Java&lt;/h3&gt;
    &lt;p&gt;Today I want to talk about sorting arrays in java. Lets say if you have an array of integer and we want to sort it, we can do this way&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;234&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;45&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Arrays&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt; 
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will print the following output in ascending order&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;45&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;234&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now what happens if you have an array of strings, like this&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;bye&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;si&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//Sort an array&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Arrays&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt; 
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will print strings sorted in lexicographic order.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bye
    hello
    si
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;However if we want to change the order of sorting, we can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Comparator&lt;/code&gt;. Like we want to sort the array based on length of strings. Comparators in java are objects that can be used to compare two objects.&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;bye&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;si&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Comparator&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;comparator&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Comparator&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;(){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;compare&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;compare&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Arrays&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;comparator&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt; 
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;testArray&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will print&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;si 
    bye
    hello
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;songs&quot;&gt;Songs&lt;/h2&gt;
    &lt;p&gt;Lastly I leave you with some of the news songs that I listened today&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/V7LwfY5aRoMeNr1mMQU5WI&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/aRoMeNr1mMQ?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/aRoMeNr1mMQ/hqdefault.jpg alt=&apos;Har Har Shambhu Shiv Mahadeva&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Har Har Shambhu Shiv Mahadeva&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/bhbwzHA9vN4&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/bhbwzHA9vN4?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/bhbwzHA9vN4/hqdefault.jpg alt=&apos; Dancing in the moonlight&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Dancing in the moonlight&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/lFsIwK_gU5o&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/lFsIwK_gU5o?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/lFsIwK_gU5o/hqdefault.jpg alt=&apos;Ohdi Shreaam&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Ohdi Shreaam &quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:yale&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.yalemedicine.org/news/vitamin-d-myths-debunked&quot;&gt;Yalemedicine- Vitamin D myths debunked&lt;/a&gt; &lt;a href=&quot;#fnref:yale&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:supp&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://archive.nytimes.com/well.blogs.nytimes.com/2013/12/11/limits-of-vitamin-d-supplements/&quot;&gt;Nytimes - Limits of Vitamin D supplements&lt;/a&gt; &lt;a href=&quot;#fnref:supp&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-08-29T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-log-2022-08-29</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-log-2022-08-29</guid>
</item>
<item>
  <title>Cross Region AWS Glue Data Catalog access with Glue ETL</title>
  <description>&lt;p&gt;AWS Glue job are fully managed ETL service. Glue job uses hive-compatible metastore called Glue Data catalog.
    &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;AWS Glue job are fully managed ETL service. Glue job uses hive-compatible metastore called Glue Data catalog.&lt;/p&gt;
    &lt;p&gt;So one way to create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dynamic frame&lt;/code&gt; in AWS Glue (Pyspark) is&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/5ef39040eafc230490131e037c4fb1a1.js?file=spark_job1.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;This Glue job reads Glue &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;database&lt;/code&gt; defined in same region. As if now, there&apos;s no way to access cross-region database in Glue catalog.&lt;/p&gt;
    &lt;p&gt;However, if the s3 bucket is global, you can directly create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dataframe&lt;/code&gt; from s3 bucket.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/5ef39040eafc230490131e037c4fb1a1.js?file=spark_job2.py&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2022-08-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/cross-region-aws-glue-data-catalog-access-with-glue-etl</link>
<guid isPermaLink="true">https://randomwits.com/blog/cross-region-aws-glue-data-catalog-access-with-glue-etl</guid>
</item>
<item>
  <title>Fizz up with carbonated water</title>
  <description>&lt;p&gt;As I was walking down the aisle of a food mart, I was consumed with guilt about whether or not to buy a large can of coke. My waist is competing with inflation as both refused to halt their progress. I have thrown my weighing machine in the thrash as she refuses to lie at least once about my weight.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/chat.css&quot; /&gt;
    &lt;p&gt;As I was walking down the aisle of a food mart, I was consumed with guilt about whether or not to buy a large can of coke. My waist is competing with inflation as both refused to halt their progress. I have thrown my weighing machine in the thrash as she refuses to lie at least once about my weight.&lt;/p&gt;
    &lt;p&gt;According to American Herat Associate (AHA), the human body does not need any additional sugar to function healthily. So taking consuming any additional sugar is futile. Also, sugar drinks increase the risk of many diseases like diabetes, colorectal cancer, etc.&lt;/p&gt;
    &lt;p&gt;However, humans are not programmed to ignore their tastes. Luckily my eyes stumbled upon sparkling water. What the hell is that? I took it home for the experience.&lt;/p&gt;
    &lt;p&gt;A little bit of googling made me feel like a genius. So I decided to call my mother and told her about the carbonated water.&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Mom, guess what I am drinking these days. 
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    What are you drinking?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I am drinking Sparkling water. It&apos;s just water infused with carbon dioxide (CO&lt;sub&gt;2&lt;/sub&gt;) under pressure. It has no calories but a fizzy texture that feels like you are drinking coke.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Beta, but why are you drinking CO2? Isn&apos;t it bad? Don&apos;t we exhale CO&lt;sub&gt;2&lt;/sub&gt; from our bodies? 
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;I had no answer. So I told my mom that I will call back. I tried reading more and called my mom again.&lt;/p&gt;
    &lt;ul class=&quot;chatlist&quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Mom, let me tell you why carbonated water is different than CO&lt;sub&gt;2&lt;/sub&gt; we exhale.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Tell me.
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I am not consuming CO&lt;sub&gt;2&lt;/sub&gt;. It has no effect on the quantity of the CO&lt;sub&gt;2&lt;/sub&gt; in the blood. The carbonic acid decomposes into CO&lt;sub&gt;2&lt;/sub&gt; gas and it burped out. 
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Why not drink O2 drink then?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    O&lt;sub&gt;2&lt;/sub&gt; has low solubility in water. Why should I drink oxygenated water if the tap already  has oxygen in it? 
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Did you read about any harmful effects of carbonic acid?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    CO&lt;sub&gt;2&lt;/sub&gt; dissolved with rainfall due to pollution can cause breaking of walls called weathering. So carbonic acid might have some effect on enamel. However, I haven&apos;t found any website that say conclusively that it&apos;s bad for teeth.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Don&apos;t drink it too much then?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Moderation is the mantra. I think other sugar drinks have far more adverse effect on teeth and bones. The phosphoric acid in the drinks can interfere in the bone metabolism. Plain sparkling water doesn&apos;t have phosphate.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    What else did you read? 
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    One study on mice shows that carbonated water increase hunger hormone grehlin&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. However, the study was done on a very small set of people. 
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Don&apos;t become too fat. And find some time to do Yoga.
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    okay i&apos;ll go and do some &lt;a href=&quot;https://en.wikipedia.org/wiki/Shavasana&quot;&gt;Shavasana&lt;/a&gt;.
    &lt;img width=&quot;300&quot; height=&quot;150&quot; src=&quot;https://upload.wikimedia.org/wikipedia/commons/9/9f/Shavasana.jpg&quot; alt=&quot;Shavasana&quot; /&gt;
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    😠😠
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Okay, I&apos;ll do Yoga in the morning.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    👍👍 Goodnight
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;https://pubmed.ncbi.nlm.nih.gov/28228348/&quot; target=&quot;_blank&quot;&gt;Carbon dioxide in carbonated beverages induces ghrelin release and increased food consumption in male rats: Implications on the onset of obesity&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-08-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/carbonated-water</link>
<guid isPermaLink="true">https://randomwits.com/blog/carbonated-water</guid>
</item>
<item>
  <title>Serialize and Deserialize Binary Tree Leetcode solution</title>
  <description>&lt;p&gt;Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.&lt;/p&gt;
    &lt;p&gt;Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Clarification:&lt;/strong&gt; The input/output format is the same as how LeetCode serializes a binary tree. You do not necessarily need to follow this format, so please be creative and come up with different approaches yourself.&lt;/p&gt;
    &lt;h2 id=&quot;explanation&quot;&gt;Explanation&lt;/h2&gt;
    &lt;p&gt;Lets first implement &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;serialize&lt;/code&gt; method. We will use a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pre order&lt;/code&gt; traversal. Just to revise preorder traversal, the sequence is&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;Visit the root&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Traverse the left subtree&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Traverse the right subtree&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;For &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deserialize&lt;/code&gt; we will first split the string by a serpator (we are using comma as a separtor). Next we will consruct the tree from the string.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/ed76a998ebd3b50c32e782be15ddcafb.js?file=Serialize.java&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/ed76a998ebd3b50c32e782be15ddcafb.js?file=serialize.py&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;complexity&quot;&gt;Complexity&lt;/h2&gt;
    &lt;p&gt;Time Complexity of Preorder traversal is &lt;strong&gt;$$O(n)$$&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Space complexity is &lt;strong&gt;$$O(n)$$&lt;/strong&gt;&lt;/p&gt;
  </description>
  <pubDate>2022-07-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/serialize-and-deserialize-binary-tree</link>
<guid isPermaLink="true">https://randomwits.com/blog/serialize-and-deserialize-binary-tree</guid>
</item>
<item>
  <title>Hinduism without caste</title>
  <description>&lt;p&gt;It&apos;s a just another day in twitter when you come across tweets disparaging Hinduism. &quot;Hinduism is a veritable chambers of horrors&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;It&apos;s a just another day in twitter when you come across tweets disparaging Hinduism.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://twitter.com/kirubamunusamy/status/1307621960403300352?lang=en&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/tweet_kiruba.jpg&quot; alt=&quot;Tweet&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;The Left ecosystem in India usually quote &lt;a href=&quot;https://en.wikipedia.org/wiki/B._R._Ambedkar&quot;&gt;B. R. Ambedkar&lt;/a&gt; on Hinduism but is silent on his views on other religion.&lt;/p&gt;
    &lt;p&gt;For Instance in the &lt;strong&gt;Introduction to Buddha and His Dhamma&lt;/strong&gt;&lt;sup id=&quot;fnref:ref1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:ref1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, Ambedkar said&lt;/p&gt;
    &lt;blockquote class=&quot;dq&quot;&gt;
    The four Aryan Truths are a great stumbling block in the
    way of non-Buddhists accepting the gospel of Buddhism. For the four
    Aryan Truths deny hope to man. The four Aryan Truths make the
    gospel of the Buddha a &lt;strong&gt;gospel of pessimism&lt;/strong&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;On Islam, B. R Ambedkar said in his book, &lt;strong&gt;Pakistan or Partition of India&lt;/strong&gt;&lt;sup id=&quot;fnref:ref2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:ref2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;blockquote class=&quot;dq&quot;&gt;
    Islam is said to bind people together, but this is only a half-truth. For Islam divides as inexorably as it binds. Islam is a close corporation and the distinction that it makes between Muslims and non-Muslims is a very real, very positive and very alienating distinction. The brotherhood of Islam is not the universal brotherhood of man. It is the brotherhood of Muslims for Muslims only. There is a fraternity, but its benefit is confined to those within that corporation. For those who are outside the corporation, there is nothing but contempt and enmity. The second defeat of Islam is that it is a system of social self-government and is incompatible with local self-government because the allegiance of a Muslim does not rest on his domicile in the country which is his but on the faith to which he belongs. To the Muslim ibi bene ibi patria is unthinkable. Wherever there is the rule of Islam, there is his own country. In other words, Islam can never allow a true Muslim to adopt India as his motherland and regard a Hindu as his kith and kin. That is probably the reason why Maulana Mahomed Ali, a great Indian but a true Muslim, preferred to be buried in Jerusalem rather than in India.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;is-caste-intrinsic-to-hinduism&quot;&gt;Is caste intrinsic to hinduism?&lt;/h3&gt;
    &lt;p&gt;What about caste? Can you be a Hindu without caste? The left ecosystem deliberately equates hinduism with caste.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://twitter.com/Profdilipmandal/status/1358264946921005056&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/tweet_mandal.jpg&quot; alt=&quot;Tweet&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://twitter.com/surajyengde/status/1496214159146500107&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/tweet_yengde.jpg&quot; alt=&quot;Tweet&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;religion-is-all-about-interpretation&quot;&gt;Religion is all about interpretation&lt;/h3&gt;
    &lt;p&gt;Why are computers not programmed in the English language even though it was invented in the English dominant part of the world? It&apos;s because human languages are ambiguous. That&apos;s why most programming languages have unambiguous syntax.&lt;/p&gt;
    &lt;p&gt;Religous books can be interpreted in myriad ways. Bible was quoted to justify slavery, like Ephesians 6:5: “Slaves, obey your earthly masters with respect and fear, and with sincerity of heart, just as you would obey Christ.&quot;.&lt;/p&gt;
    &lt;p&gt;Martin Luther King JR&apos;s favourite Bible quote against slavery was &quot;In Christ, there is neither Jew, nor Greek, there is neither slave nor free, there is neither male nor female; for you are all one in Christ Jesus” (3:28)&quot;.&lt;/p&gt;
    &lt;p&gt;In Hinduism, &lt;a href=&quot;https://en.wikipedia.org/wiki/Jawaharlal_Nehru&quot;&gt;Nehru&lt;/a&gt; found inspiration in &lt;a href=&quot;https://en.wikipedia.org/wiki/Nitisara&quot;&gt;Nitisara&lt;/a&gt; against caste that says that &lt;strong&gt;caste division should not be by birth, but by capacity&lt;/strong&gt;.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://twitter.com/tshrocks/status/1341640848962854912&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/tweet_nehru.jpg&quot; alt=&quot;Tweet&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Nehru also believed Hinduism became more rigid and caste had developed after Muslim invasions in India.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;a href=&quot;https://twitter.com/tshrocks/status/1405890572292820994&quot;&amp;gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/tweet_nehru_caste.jpg&quot; alt=&quot;Tweet&quot; /&amp;gt; &amp;lt;/a&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;To buttress Nehru&apos;s views, Hindus living in Fiji are casteless. Muslims and Christian also have caste in India. So isn&apos;t caste a geographical social pratice?&lt;/p&gt;
    &lt;p&gt;In his book, the &lt;strong&gt;Hindu View of Life&lt;/strong&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Sarvepalli_Radhakrishnan&quot;&gt;Sarvepalli Radhakrishnan&lt;/a&gt; has its own interpretation of hinduism&lt;/p&gt;
    &lt;blockquote class=&quot;dq&quot;&gt;
    At the onset, one is confronted by the difficulty of defining what Hinduism is. To many it seems to be a name without any content. Is it a museum of beliefs, a medley of rites, or a mere map, a geographical expression? 
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;the-facade-of-secularism-in-india&quot;&gt;The facade of Secularism in India&lt;/h3&gt;
    &lt;p&gt;It&apos;s not my expertise to dwell into theology of religion. I believe religion should be a personal matter between believers and God. Secularism should entail the separtion of religion and State like French&apos;s &lt;a href=&quot;https://en.wikipedia.org/wiki/Secularism_in_France&quot;&gt;&lt;strong&gt;laicite&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
    &lt;p&gt;In India, every party claim they are secular fighting against &lt;strong&gt;fascism&lt;/strong&gt;, &lt;strong&gt;nazism&lt;/strong&gt;, etc yet eschew secular liberal ideas. Self proclaimed secular parties have banned movies, books, curbed free speech, used blasphemy laws, used archaic sedition law, etc indiscriminately. Secularism in India has no definitive definition except feel-good notion of Sarva Dharma Sama Bhava.&lt;/p&gt;
    &lt;h3 id=&quot;reform-not-annihilate&quot;&gt;Reform not Annihilate&lt;/h3&gt;
    &lt;p&gt;Every religion needs reforms. Christian Humanism was a product of the Northern Renaissance. Women are no longer burned for witchcraft in Europe.&lt;/p&gt;
    &lt;p&gt;Sati, an ancient Hindu tradition of wife being burned along with husband&apos;s pyres, is legally banned in India. Polygamy became illegal for Hindus in India in 1956.&lt;/p&gt;
    &lt;p&gt;Supreme Court of India in the case titled Sunita Singh Versus State of Uttar Pradesh and Others said that &lt;strong&gt;Caste is determined by birth and cannot be changed by marriage with a person of scheduled caste&lt;/strong&gt;. I believe that Supreme Court is indeed supreme but not infallible. This judgement is obstacle in creating fluid caste system. How can you annihilate caste system if you cant change it? There&apos;s an internal debate amoung Hindus about validity of &lt;strong&gt;varna&lt;/strong&gt;, &lt;strong&gt;caste&lt;/strong&gt;, &lt;strong&gt;jaati&lt;/strong&gt;, etc in Hinduism. Some Hindus believe &lt;a href=&quot;https://en.wikipedia.org/wiki/Varna_(Hinduism)&quot;&gt;varna&lt;/a&gt; is just a divison of labor without caste rigidity. However there&apos;s a sad reality that people are still discriminated based on caste in India.&lt;/p&gt;
    &lt;p&gt;I am not an expert to dwell upon a complex subject on a polytheistic religion like Hinduism. However as a cultural Hindu, I believe Hindus must not fall into trap by pseudo left in denigrating Hinduism. Hinduism most not shy itself from reforms and embracing scientific temperament while preserving its cultural heritage.&lt;/p&gt;
    &lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:ref1&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.columbia.edu/itc/mealac/pritchett/00ambedkar/ambedkar_buddha/00_intro.html&quot;&gt;The Buddha and His Dhamma by B. R. Ambedkar&lt;/a&gt; &lt;a href=&quot;#fnref:ref1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:ref2&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.columbia.edu/itc/mealac/pritchett/00ambedkar/ambedkar_partition/412d.html&quot;&gt;Pakistan or Partition of India by B. R. Ambedkar&lt;/a&gt; &lt;a href=&quot;#fnref:ref2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-07-12T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/hinduism-without-caste</link>
<guid isPermaLink="true">https://randomwits.com/blog/hinduism-without-caste</guid>
</item>
<item>
  <title>Dear Vishi, daily log on July 11, 2022</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for July 11, 2022.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for July 11, 2022.&lt;/p&gt;
    &lt;h2 id=&quot;why-sleep-is-like-food&quot;&gt;Why sleep is like food&lt;/h2&gt;
    &lt;p&gt;Since we live in a fast-paced world, we sometimes underestimate the importance of sleep. Often we sleep less on weekdays thinking we might compensate it by sleeping more on weekends. This is a common misconception. Adults need 7 or more hours of sleep per night for the best health and well-being.&lt;/p&gt;
    &lt;p&gt;According to a &lt;a href=&quot;https://www.cdc.gov/sleep/data_statistics.html&quot;&gt;report&lt;/a&gt; by the CDC, people who get less than 7 hours of sleep per night have an increased risk of the following conditions:&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;obesity&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;heart disease&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;diabetes&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;stroke&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;depression&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;arthritis&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;kidney disease&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;I know life has its complexities. Sometimes we might have to delay sleeping due to work, unwarranted chores, or might need to watch a newly released sitcom on Netflix. But remember sleep is like food, the body needs it for nourishment. Don&apos;t sleep or eat like a hog on weekends too. The beauty lies in moderation for both food and sleep.&lt;/p&gt;
    &lt;h2 id=&quot;magic-methods-in-python&quot;&gt;Magic methods in Python&lt;/h2&gt;
    &lt;p&gt;Magic methods are methods that start with double underscores (eg &lt;strong&gt;init&lt;/strong&gt;, &lt;strong&gt;lt&lt;/strong&gt;). Today we are going to talk about &lt;strong&gt;__eq__&lt;/strong&gt; method. Lets say we have the following code&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;person1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Tushar&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;person2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Tushar&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;person1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;person2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# prints False
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Both objects have same the name but different memory address. However if we want to override this behavior we can do&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__eq__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;isinstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;person1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Tushar&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;person2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Tushar&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;person1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;person2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# prints True
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;top-five-songs-i-liked-today&quot;&gt;Top five songs I liked today&lt;/h2&gt;
    &lt;p&gt;Here&apos;s the list of top five songs that I listened to today incessantly.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/mehLx_Fjv_c&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/mehLx_Fjv_c?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/mehLx_Fjv_c/hqdefault.jpg alt=&apos;&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/-05qe1MF5Pg&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/-05qe1MF5Pg?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/-05qe1MF5Pg/hqdefault.jpg alt=&apos;&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/CvBfHwUxHIk&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/CvBfHwUxHIk?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/CvBfHwUxHIk/hqdefault.jpg alt=&apos;&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/5Eqb_-j3FDA&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/5Eqb_-j3FDA?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/5Eqb_-j3FDA/hqdefault.jpg alt=&apos;&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/-rtJtGdWeak&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/-rtJtGdWeak?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/-rtJtGdWeak/hqdefault.jpg alt=&apos;&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2022-07-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-log-2022-07-11</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-log-2022-07-11</guid>
</item>
<item>
  <title>Dear Vishi, daily log on July 11, 2022</title>
  <description>&lt;p&gt;Dear Vishi, this is my daily log for July 10, 2022.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dear Vishi, this is my daily log for July 10, 2022.&lt;/p&gt;
    &lt;h2 id=&quot;kickboxing-class&quot;&gt;Kickboxing class&lt;/h2&gt;
    &lt;p&gt;I was supposed to go to a kickboxing class today. I have previously enjoyed these classes which are a mix of cardio and kickboxing. It helps me vent out any stress I have. If you remember in my childhood I had developed an uncanny habit of punching the brickwall barehand. I guess it much better punching the bag wearing the gloves to avoid unwanted injury.&lt;/p&gt;
    &lt;p&gt;It so happen that &lt;a href=&quot;https://en.wikipedia.org/wiki/Chitragupta&quot;&gt;Chitragupta&lt;/a&gt; had different plans for me. However before departing, I found to my horror that my house keys were missing. I frantically searched whole apartment but all in vain. I hoped that reading of Sherlock Holmes 🕵️ would aid me with in my pursuit. I reorganized my clothes, threw unwanted thrash, painstakingly searched every needle in the apartment, vacuumed the carpet yet it was a utter disappointment. The current of time never stops and I missed my class. Crestfallen I crept back to my bed to sleep again. However luck has its last revenge. The only place I didn&apos;t search was my bedsheet. For all its worth, at least I spent some time cleaning my room.&lt;/p&gt;
    &lt;h2 id=&quot;2d-nested-list-in-python&quot;&gt;2d nested list in Python&lt;/h2&gt;
    &lt;p&gt;In python programming language, there&apos;s an interesting concept about nested list&lt;/p&gt;
    &lt;p&gt;Lets say if you define a 2d list like&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you want to only update value at location at [0, 2]&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This is incorrect as it updates value in all the remaining list. So the correct way to define 2d nested list in python is&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now if you update value at location at [0, 2]&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;reading-the-origin-of-species-by-charles-darwin&quot;&gt;Reading The Origin of Species by Charles Darwin&lt;/h2&gt;
    &lt;p&gt;There&apos;s an interesting tidbit about pigeons in India during Mughal period. &quot;Pigeons were much valued by Akber Khan in India, about the year 1600; never less than 20,000 pigeons were taken with the court (sic)&quot;, Charles Darwin on &lt;a href=&quot;https://en.wikipedia.org/wiki/Akbar&quot;&gt;Akbar&lt;/a&gt;.&lt;/p&gt;
    &lt;p&gt;Interestingly Odisha Police still has a &lt;strong&gt;pigeon service&lt;/strong&gt; to communicate in remote areas with no wireless or telephone links. The messages, written on a piece of paper, are rolled and inserted into tiny plastic capsules and tied to the feet of the pigeons&lt;sup id=&quot;fnref:pigeon&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:pigeon&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/h3Z7jnCI7SE&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/h3Z7jnCI7SE?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/h3Z7jnCI7SE/hqdefault.jpg alt=&apos;Ranjha song&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Ranjha&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;eating-at-taco-bell&quot;&gt;Eating at Taco bell&lt;/h2&gt;
    &lt;p&gt;I usually dont like Taco bell. However lately I become fan of &lt;a href=&quot;https://www.tacobell.com/food/burritos/fiesta-veggie-burrito&quot;&gt;Fiesta Veggie Burrito&lt;/a&gt;. You can add &lt;strong&gt;Jalapeño Peppers&lt;/strong&gt; to the order which make it more crunchy. I guess I would be eating it often until my taste buds revolt.&lt;/p&gt;
    &lt;h2 id=&quot;top-five-songs-i-liked-today&quot;&gt;Top five songs I liked today&lt;/h2&gt;
    &lt;p&gt;You know I am a musicophile. Top five songs that I liked today&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/V7LwfY5U5WI&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/V7LwfY5U5WI?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/V7LwfY5U5WI/hqdefault.jpg alt=&apos;Ranjha song&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Ranjha&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/YVkUvmDQ3HY&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/YVkUvmDQ3HY?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/YVkUvmDQ3HY/hqdefault.jpg alt=&apos;Eminem Without me&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Eminem Without me&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/08NlhjpVFsU&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/08NlhjpVFsU?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/08NlhjpVFsU/hqdefault.jpg &amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/99j0zLuNhi8&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/99j0zLuNhi8?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/99j0zLuNhi8/hqdefault.jpg &amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/psuRGfAaju4&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/psuRGfAaju4?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/psuRGfAaju4/hqdefault.jpg &amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:pigeon&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.thebetterindia.com/138025/odisha-police-pigeon-service-india/&quot;&gt;Odissa Pigeon Police Service&lt;/a&gt; &lt;a href=&quot;#fnref:pigeon&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-07-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/daily-log-2022-07-10</link>
<guid isPermaLink="true">https://randomwits.com/blog/daily-log-2022-07-10</guid>
</item>
<item>
  <title>Apply Discount To Prices leetcode solution</title>
  <description>&lt;p&gt;A sentence is a string of single-space separated words where each word can contain digits, lowercase letters, and the dollar sign &apos;$&apos;. A word represents a price if it is a sequence of digits preceded by a dollar sign.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;A sentence is a string of single-space separated words where each word can contain digits, lowercase letters, and the dollar sign &apos;$&apos;. A word represents a price if it is a sequence of digits preceded by a dollar sign.&lt;/p&gt;
    &lt;p&gt;For example, &quot;&lt;span&gt;$&lt;/span&gt;100&quot;, &quot;&lt;span&gt;$&lt;/span&gt;23&quot;, and &quot;&lt;span&gt;$&lt;/span&gt;6&quot; represent prices while &quot;100&quot;, &quot;&lt;span&gt;$&lt;/span&gt;&quot;, and &quot;&lt;span&gt;$&lt;/span&gt;1e5&quot; do not.&lt;/p&gt;
    &lt;p&gt;You are given a string sentence representing a sentence and an integer discount. For each word representing a price, apply a discount of discount% on the price and update the word in the sentence. All updated prices should be represented with exactly two decimal places.&lt;/p&gt;
    &lt;p&gt;Return a string representing the modified sentence.&lt;/p&gt;
    &lt;p&gt;Note that all prices will contain at most 10 digits.&lt;/p&gt;
    &lt;h2 id=&quot;explanation&quot;&gt;Explanation&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;Split the &lt;strong&gt;string&lt;/strong&gt; by whitespaces&lt;/li&gt;
    &lt;li&gt;For each string, apply discount only if it starts with &apos;&lt;span&gt;$&lt;/span&gt;&apos; and is &lt;strong&gt;numeric&lt;/strong&gt;.&lt;/li&gt;
    &lt;li&gt;Merge the &lt;strong&gt;string array&lt;/strong&gt; into a string and return it.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot;  loading=&quot;lazy&quot; src=&quot;/img/apply_discount.png&quot; alt=&quot;Explanation of apply discount&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;solution&quot;&gt;Solution&lt;/h2&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java2&quot;&gt;&lt;a href=&quot;#Java2&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python2&quot;&gt;&lt;a href=&quot;#Python2&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java2&quot; id=&quot;Java2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/f34119b8638d8071aff8526f9c77b549.js?file=DiscountPrices.java&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python2&quot; id=&quot;Python2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/f34119b8638d8071aff8526f9c77b549.js?file=discount_prices.py&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-07-03T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/apply-discount-to-prices-solution</link>
<guid isPermaLink="true">https://randomwits.com/blog/apply-discount-to-prices-solution</guid>
</item>
<item>
  <title>Playing Rise of Tomb Raider</title>
  <description>&lt;p&gt;I am an ardent fan of &lt;strong&gt;Tomb Raider&lt;/strong&gt; game series. I grew up falling in love with &lt;strong&gt;Tomb Raider III&lt;/strong&gt;. Much time swept away since I have tried any other game of this series. So finally I decided to try my hands on &lt;strong&gt;Rise of Tomb Raider&lt;/strong&gt;.
    &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;script src=&quot;https://raw.githubusercontent.com/aFarkas/lazysizes/gh-pages/lazysizes.min.js&quot; async=&quot;&quot;&gt;&lt;/script&gt;
    &lt;p&gt;I am an ardent fan of &lt;strong&gt;Tomb Raider&lt;/strong&gt; game series. I grew up falling in love with &lt;strong&gt;Tomb Raider III&lt;/strong&gt;. Much time swept away since I have tried any other game of this series. So finally I decided to try my hands on &lt;strong&gt;Rise of Tomb Raider&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt;Currently &lt;strong&gt;Rise of Tomb Raider&lt;/strong&gt; has a rating of 9 / 10 on &lt;strong&gt;Stream&lt;/strong&gt;. Below is the short video of the gameplay.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/WGHGG0660EY&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/WGHGG0660EY?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/WGHGG0660EY/hqdefault.jpg alt=&apos;&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Russian President Putin announces military operation in Ukraine&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;So far I am enjoying the game. Not only I am enomored of the game mechanics, but the background music is spot on to infuse thrill. Music stimulates both psychological mood and physiological changes including heart rate and breathing. Below is the soundtrack of &lt;strong&gt;&quot;Whispers in the Dark&quot;&lt;/strong&gt; used in the game.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;300&quot; src=&quot;https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/231728401&amp;amp;color=%23ff5500&amp;amp;auto_play=false&amp;amp;hide_related=false&amp;amp;show_comments=true&amp;amp;show_user=true&amp;amp;show_reposts=false&amp;amp;show_teaser=true&amp;amp;visual=true&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/231728401&amp;amp;color=%23ff5500&amp;amp;auto_play=false&amp;amp;hide_related=false&amp;amp;show_comments=false&amp;amp;show_user=false&amp;amp;show_reposts=false&amp;amp;show_teaser=false&amp;amp;visual=false&amp;gt;&amp;lt;img src=https://i1.sndcdn.com/artworks-000135188521-dw8xae-t500x500.jpg alt=&apos; Rise of Tomb Raider&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Rise of Tomb Raider Soundtrack&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Since I do not have the luxury of time, I prefer to play it on weekends. Honestly I had a crush on Lara Croft when I was in my adolescence. I think the infatuation is still there.&lt;/p&gt;
  </description>
  <pubDate>2022-07-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/playing-rise-of-tomb-raider</link>
<guid isPermaLink="true">https://randomwits.com/blog/playing-rise-of-tomb-raider</guid>
</item>
<item>
  <title>Sort Characters By Frequency solution leetcode</title>
  <description>&lt;p&gt;Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.&lt;/p&gt;
    &lt;p&gt;Return the sorted string. If there are multiple answers, return any of them&lt;/p&gt;
    &lt;h2 id=&quot;explanation&quot;&gt;Explanation&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hashmap&lt;/code&gt; to count the frequency of all characters in string&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Insert character &amp;amp; frequency pair into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Max Heap&lt;/code&gt; where frequency is used for ranking.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Extract Maximum from the heap and append it to the output string.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;solution&quot;&gt;Solution&lt;/h2&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java2&quot;&gt;&lt;a href=&quot;#Java2&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python2&quot;&gt;&lt;a href=&quot;#Python2&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java2&quot; id=&quot;Java2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/5b65da231be6d7d4de3ee4cc2a5e0d10.js?file=FrequencySort.java&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python2&quot; id=&quot;Python2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/5b65da231be6d7d4de3ee4cc2a5e0d10.js?file=frequency_sort.py&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-06-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/sort-characters-by-frequency</link>
<guid isPermaLink="true">https://randomwits.com/blog/sort-characters-by-frequency</guid>
</item>
<item>
  <title>Create a Lambda Function to run SQL queries in Redshift Cluster</title>
  <description>&lt;p&gt;Amazon Redshift is fully managed warehouse service provided by AWS. The Amazon Redshift engine is a SQL-compliant, massively-parallel, query processing and database management system designed to support analytics workload.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Amazon Redshift is fully managed warehouse service provided by AWS. The Amazon Redshift engine is a SQL-compliant, massively-parallel, query processing and database management system designed to support analytics workload.&lt;/p&gt;
    &lt;p&gt;An Amazon Redshift cluster is comprised of a leader node and one or more compute nodes. We also support a single-node design where leader and compute work is shared on a single node. The leader node accepts connections from client programs, parses requests, generates &amp;amp; compiles query plans for execution on the compute nodes, performs final aggregation of results when required, and coordinates serialization and state of transactions. The compute node(s) perform the heavy lifting inherent in both
    query processing and data manipulation against local data.[^redshift]&lt;/p&gt;
    &lt;p&gt;AWS GUI provides Query Editor to execute sql command. However it’s better to leverage APIs by using AWS Lambda function.&lt;/p&gt;
    &lt;h3 id=&quot;read-sql-queries&quot;&gt;Read SQL Queries&lt;/h3&gt;
    &lt;p&gt;Lets start with creating a flat file which would contain all our SQL commands that we want to execute in the Redshift Cluster. We will upload the flat file to the s3 bucket. The content for the file is&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/0ea44788e9afe78b3dcc94a026dc53c1.js?file=sql_file.sql&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Materialized views are useful in warehouses to increase the speed of queries on very large databases. They are a database object that stores the results of a query.&lt;/p&gt;
    &lt;h3 id=&quot;write-lambda-function&quot;&gt;Write Lambda Function&lt;/h3&gt;
    &lt;p&gt;Lets start by creating a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lambda function handler&lt;/code&gt; which would be invoked when the lambda function run.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/0ea44788e9afe78b3dcc94a026dc53c1.js?file=lambda_function1.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Its not a good practice to hard code cluster information or password in the code. We will this information from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Secret Manger&lt;/code&gt;. I’ll assume that secret is already created. We will write a method to retrieve those values using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secret_name&lt;/code&gt; passed as an Environment variable. Other environment variables are&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;region e.g us-east-1&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;sql_bucket is the name of s3 bucket&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;sql_prefix is the prefix for the object stored on s3&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/0ea44788e9afe78b3dcc94a026dc53c1.js?file=lambda_function2.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Also we need to read the sql commands stored in s3 location.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/0ea44788e9afe78b3dcc94a026dc53c1.js?file=lambda_function3.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Lastly we will write our method exec_redshift that will do the following&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Retrieve cluster information from AWS Secret Manager&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Read content of the sql file stored on s3&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Execute sql commands sequentially in redshift cluster&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/0ea44788e9afe78b3dcc94a026dc53c1.js?file=lambda_function4.py&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2022-06-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/create-a-lambda-function-to-run-sql-queries-in-redshift-cluster</link>
<guid isPermaLink="true">https://randomwits.com/blog/create-a-lambda-function-to-run-sql-queries-in-redshift-cluster</guid>
</item>
<item>
  <title>Getting Started with decorators in Python</title>
  <description>&lt;p&gt;In python, everything is an object. So functons are also objects which can be passed around. A decorator is a function that receives a function and returns a function.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;In python, everything is an object. So functons are also objects which can be passed around. A decorator is a function that receives a function and returns a function.&lt;/p&gt;
    &lt;h2 id=&quot;use-case-1&quot;&gt;Use case 1&lt;/h2&gt;
    &lt;h3 id=&quot;without-using-decorator&quot;&gt;Without using decorator&lt;/h3&gt;
    &lt;p&gt;Let&apos;s say we have two simple functions to add and multiply numbers.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/91b5ee39ccca52fad0776b5571f4fa1c.js?file=ex1.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;This will print&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;6
    5
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now lets say we want to print &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;execution&lt;/code&gt; time in both these functions. We could do something like this&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/91b5ee39ccca52fad0776b5571f4fa1c.js?file=ex2.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;This will print&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;multiply_me&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;took&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;2.00507378578&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;add_me&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;took&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;2.00509095192&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here we are repeating our logic for logging execution time. This can be solved by using decorators.&lt;/p&gt;
    &lt;h3 id=&quot;with-using-decorator&quot;&gt;With using decorator&lt;/h3&gt;
    &lt;p&gt;Let&apos;s create a wrapper function called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;timeme&lt;/code&gt; that will do the following-&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Receive the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function&lt;/code&gt; as an argument&lt;/li&gt;
    &lt;li&gt;Execute the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;function&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Log the execution time&lt;/li&gt;
    &lt;/ol&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/91b5ee39ccca52fad0776b5571f4fa1c.js?file=ex3.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Next we can &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;decorate&lt;/code&gt; our functions using syntatic sugar like this&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/91b5ee39ccca52fad0776b5571f4fa1c.js?file=ex4.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;This is similar to the following&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;multiply_me&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;timeme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;multiply_me&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;add_me&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;timeme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_me&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Lastly runnig the functions will be like&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;multiply_me&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add_me&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will print&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;multiply_me took 2.00506806374
    6
    add_me took 2.00509810448
    5
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;use-case-2&quot;&gt;Use case 2&lt;/h2&gt;
    &lt;h3 id=&quot;without-using-decorator-1&quot;&gt;Without using decorator&lt;/h3&gt;
    &lt;p&gt;Lets define a function which depends on type of argument.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/91b5ee39ccca52fad0776b5571f4fa1c.js?file=ex5.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;We can invoke the function with different arguments.&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;process_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;process_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;process_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;process_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Dog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;bowbow&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will print&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Default executed &lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    str executed string
    int executed 123
    Dog executed bowbow
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;with-using-decorator-1&quot;&gt;With using decorator&lt;/h3&gt;
    &lt;p&gt;This coding style becomes hard to read as the number of cases increases. We can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;singledispatch&lt;/code&gt; decorator.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/91b5ee39ccca52fad0776b5571f4fa1c.js?file=ex6.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;This will print the same result&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Default executed &lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    str executed string
    int executed 123
    Dog executed bowbow
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2022-05-29T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/getting-started-decorators-python</link>
<guid isPermaLink="true">https://randomwits.com/blog/getting-started-decorators-python</guid>
</item>
<item>
  <title>Minimum Consecutive Cards to Pick up solution leetcode</title>
  <description>&lt;p&gt;An interesting problem on leetcode to find minimum number of ways to pick up consecutive cards. We will start with a brute force algorithm that would exceed in time limit. Later we will improve upon this algorithm using hashmap.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/multipleTab.css&quot; /&gt;
    &lt;script src=&quot;/js/jquery.easytabs.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;/js/multipleTab.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;An interesting problem on leetcode to find minimum number of ways to pick up consecutive cards. We will start with a brute force algorithm that would exceed in time limit. Later we will improve upon this algorithm using hashmap.&lt;/p&gt;
    &lt;h2 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h2&gt;
    &lt;p&gt;You are given an integer array cards where cards[i] represents the value of the i&lt;sup&gt;th&lt;/sup&gt; card. A pair of cards are matching if the cards have the same value.&lt;/p&gt;
    &lt;p&gt;Return the minimum number of consecutive cards you have to pick up to have a pair of matching cards among the picked cards. If it is impossible to have matching cards, return -1.&lt;/p&gt;
    &lt;h2 id=&quot;brute-force-solution&quot;&gt;Brute force Solution&lt;/h2&gt;
    &lt;p&gt;A simple intuitive solution would be to pick up a card, and then iterate over the remaining cards to find the minimum length.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/2b1119ca6114e81f29c156f7f8fc4fd2.js?file=BruteMinimumCardPickUp.java&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/2b1119ca6114e81f29c156f7f8fc4fd2.js?file=brute_minimum_card_pick_up.py&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    This will fail as the time limit will exceed while submiting the solution to leetcode. This is because the time complexity of the solution is &lt;strong&gt;O(n&lt;sup&gt;2&lt;/sup&gt;)&lt;/strong&gt;.
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;using-hashmap&quot;&gt;Using HashMap&lt;/h2&gt;
    &lt;p&gt;Lets take an example with a use case of following input&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cards &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3,4,2,3,4,7]
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next we can create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hashmap&lt;/code&gt; to keep track of indices of a particular card.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;/img/min_ways_hashmap.png&quot; alt=&quot;hash map picture&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java2&quot;&gt;&lt;a href=&quot;#Java2&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python2&quot;&gt;&lt;a href=&quot;#Python2&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java2&quot; id=&quot;Java2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/2b1119ca6114e81f29c156f7f8fc4fd2.js?file=MinimumCardPickUp.java&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python2&quot; id=&quot;Python2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/2b1119ca6114e81f29c156f7f8fc4fd2.js?file=minimum_card_pick_up.py&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;complexity&quot;&gt;Complexity&lt;/h2&gt;
    &lt;p&gt;Time Complexity is &lt;strong&gt;$$\theta(n * m)$$&lt;/strong&gt;.&lt;/p&gt;
  </description>
  <pubDate>2022-05-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/minimum-consecutive-cards-to-pick-up-solution</link>
<guid isPermaLink="true">https://randomwits.com/blog/minimum-consecutive-cards-to-pick-up-solution</guid>
</item>
<item>
  <title>Neovim Setup with LunarVim</title>
  <description>&lt;p&gt;I am an ardent &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim&lt;/code&gt; user. A forked version of vim called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;neovim&lt;/code&gt; recently caught my attention. It has more features like support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;language server protocol&lt;/code&gt; that provides &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auto-complete&lt;/code&gt;, etc. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LunarVim&lt;/code&gt; provides neovim configuration files so that it behaves as an IDE.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I am an ardent &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim&lt;/code&gt; user. A forked version of vim called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;neovim&lt;/code&gt; recently caught my attention. It has more features like support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;language server protocol&lt;/code&gt; that provides &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auto-complete&lt;/code&gt;, etc. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LunarVim&lt;/code&gt; provides neovim configuration files so that it behaves as an IDE.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;As of today (May 14, 2022), Lunarvim requires Neovim v0.7 or higher. So we will install neovim from the source to get the latest version.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;install-neovim&quot;&gt;Install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;neovim&lt;/code&gt;&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libtool libtool-bin m4 automake cmake gettext ninja-build autoconf g++ pkg-config unzip curl
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone https://github.com/neovim/neovim
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;neovim
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout stable
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;make &lt;span class=&quot;nv&quot;&gt;CMAKE_BUILD_TYPE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Release
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# If  error on previous command&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;make distclean&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; make
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You can verify version of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;neovim&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nvim &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
    NVIM v0.7.0
    Build &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;: Release
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;install-tree-sitter-features-like-syntax-highlight&quot;&gt;Install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tree-sitter&lt;/code&gt; features like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;syntax highlight&lt;/code&gt;&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone https://gitlab.com/jirgn/tree-sitter-fusion.git
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;tree-sitter-fusion
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;yarn &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you get error as Yarn install command error No such file or directory: &apos;install&apos; then&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt remove cmdtest
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;npm &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;yarn
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;install-packernvim&quot;&gt;Install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;packer.nvim&lt;/code&gt;&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone &lt;span class=&quot;nt&quot;&gt;--depth&lt;/span&gt; 1 https://github.com/wbthomason/packer.nvim&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    ~/.config/nvim/site/pack/packer/start/packer.nvim
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;install-lunarvim&quot;&gt;Install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LunarVim&lt;/code&gt;&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ LV_BRANCH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;release-1.2/neovim-0.8&apos;&lt;/span&gt; bash &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; https://raw.githubusercontent.com/lunarvim/lunarvim/fc6873809934917b470bff1b072171879899a36b/utils/installer/install.sh&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Or go to the &lt;a href=&quot;https://www.lunarvim.org/&quot;&gt;website&lt;/a&gt; to get latest installation command.&lt;/p&gt;
    &lt;p&gt;To fetch the latest changes for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lunarvim&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ~/.local/share/lunarvim/lvim
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git pull
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Or by commandline&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;lvim +LvimUpdate +q
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You can start using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Lunarvim&lt;/code&gt; using&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;lvim
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;enable-copy-to-clipboard&quot;&gt;Enable &apos;Copy to Clipboard&apos;&lt;/h3&gt;
    &lt;p&gt;If you are using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wsl&lt;/code&gt; on Windows, copy to clipboard might not work automatically. To fix that -&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Go to &lt;a href=&quot;Windows clipboard tool&quot;&gt;https://github.com/equalsraf/win32yank&lt;/a&gt; and download the latest &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Releases&lt;/code&gt;, for example -&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-sLo&lt;/span&gt;/tmp/win32yank.zip https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x64.zip
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;unzip &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /tmp/win32yank.zip win32yank.exe &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /tmp/win32yank.exe
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /tmp/win32yank.exe
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo mv&lt;/span&gt; /tmp/win32yank.exe /usr/local/bin/
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;Add the following line to the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.local/share/lunarvim/lvim/init.lua&lt;/code&gt;&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-lua highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;set clipboard=unnamedplus&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now you can copy using the following command&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s2&quot;&gt;&quot;+y
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;additional-tweeks&quot;&gt;Additional tweeks&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;Add the following line to the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.local/share/lunarvim/lvim/init.lua&lt;/code&gt;&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-lua highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;set foldmethod=indent&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;set foldlevel=0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;set ai&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;set listchars=eol:$,tab:&amp;gt;-,trail:~,extends:&amp;gt;,precedes:&amp;lt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;-- show list will show all characters&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;--stop auto indent&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;set indentexpr=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;--zoom in and out&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;noremap z2 &amp;lt;c-w&amp;gt;_ \\| &amp;lt;c-w&amp;gt;\\|&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;noremap z1 &amp;lt;c-w&amp;gt;=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;[[
    set tabstop=4
    set shiftwidth=4
    set softtabstop=4
    set backspace=indent,eol,start
    set expandtab
    set autoindent
    set smarttab
    set encoding=utf-8
    set incsearch
    set hlsearch
    ]]&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;-- remove trailing whitespace --&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stripTrailing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;api&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nvim_command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%s/\\s\\+$//e&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;api&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nvim_command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;call cursor(&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;..&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;..&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;..&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;..&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;api&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nvim_command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;autocmd BufWritePre * lua stripTrailing()&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;ol&gt;
    &lt;li&gt;Supress &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;diagnostic warnings&lt;/code&gt; by adding the following to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lua/lvim/lsp/handlers.lua&lt;/code&gt;.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;div class=&quot;language-lua highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;diagnostic_opts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;underline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;virtual_text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;-- this it what you&apos;re looking for&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;signs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;update_in_insert&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lsp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;handlers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;textDocument/publishDiagnostics&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lsp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lsp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;diagnostic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;on_publish_diagnostics&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;diagnostic_opts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;errors&quot;&gt;Errors&lt;/h3&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Error detected while processing VimEnter Autocommands for &quot;*&quot;:
    Error executing lua callback: .../.local/share/lunarvim/lvim/lua/lvim/core/treesitter.lua:185: VimEnter Autocommands for &quot;*&quot;:
    Vim(lua):Installation not possible: ...er/start/nvim-treesitter/lua/nvim-treesitter/install.lua:52: Parser not available for
    language &quot;vimdoc&quot;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;solution&quot;&gt;Solution&lt;/h4&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd ~/.local/share/lunarvim/site/pack/packer/start/nvim-treesitter/
    git pull origin master
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Error executing lua: ...im/0.9.0/share/nvim/runtime/lua/vim/treesitter/query.lua:259
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h4 id=&quot;solution-1&quot;&gt;Solution&lt;/h4&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:TSInstall all
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2022-05-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/neovim-setup-with-lunarvim</link>
<guid isPermaLink="true">https://randomwits.com/blog/neovim-setup-with-lunarvim</guid>
</item>
<item>
  <title>Fix WSL2 internet connection while on VPN</title>
  <description>&lt;p&gt;Windows Subsystem for Linux (WSL2) provides native Linux environment for Windows. It&apos;s great alternative to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cygwin&lt;/code&gt; which can&apos;t run native Linux apps. However WSL2 doesn&apos;t have out-of-box connectivity with internet once you connect with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpn&lt;/code&gt;.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Windows Subsystem for Linux (WSL2) provides native Linux environment for Windows. It&apos;s great alternative to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cygwin&lt;/code&gt; which can&apos;t run native Linux apps. However WSL2 doesn&apos;t have out-of-box connectivity with internet once you connect with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpn&lt;/code&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;solution&quot;&gt;Solution&lt;/h2&gt;
    &lt;h3 id=&quot;step-1&quot;&gt;Step 1&lt;/h3&gt;
    &lt;p&gt;Open &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;powershell&lt;/code&gt; and get the list of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nameservers&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-powershell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Get-DnsClientServerAddress&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-AddressFamily&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;IPv4&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Select-Object&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-ExpandProperty&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ServerAddresses&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;step-2&quot;&gt;Step 2&lt;/h3&gt;
    &lt;p&gt;Retrive search domains via powershell&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Get-DnsClientGlobalSetting | Select-Object -ExpandProperty SuffixSearchList
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;step-3&quot;&gt;Step 3&lt;/h3&gt;
    &lt;p&gt;Open up wsl2, and run the following commands&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# this will unlink the default wsl2 resolv.conf&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sudo unlink&lt;/span&gt; /etc/resolv.conf 
    &lt;span class=&quot;c&quot;&gt;# This config will prevent wsl2 from overwritting the resolve.conf file everytime you start wsl2&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;bash &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;echo &quot;[network]&quot; &amp;gt; /etc/wsl.conf&apos;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;bash &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;echo &quot;generateResolvConf = false&quot; &amp;gt;&amp;gt; /etc/wsl.conf&apos;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo rm&lt;/span&gt; /etc/resolv.conf
    &lt;span class=&quot;c&quot;&gt;# Add nameserver and search domain&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;bash &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;echo &quot;nameserver 1.1.1.1&quot; &amp;gt; /etc/resolv.conf&apos;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;bash &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;echo &quot;nameserver 8.8.8.8&quot; &amp;gt;&amp;gt; /etc/resolv.conf&apos;&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# Get following value from step 1&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;bash &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;echo &quot;nameserver x.x.x.x&quot; &amp;gt;&amp;gt; /etc/resolv.conf&apos;&lt;/span&gt; 
    &lt;span class=&quot;c&quot;&gt;# Get following value from step 2&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;bash &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;echo &quot;search .com&quot; &amp;gt;&amp;gt; /etc/resolv.conf&apos;&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# Make the new /etc/resolve.conf immutable&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;chattr +i /etc/resolv.conf 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Remove any nameserver that starts with 172.* or 192.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h3 id=&quot;step-4&quot;&gt;Step 4&lt;/h3&gt;
    &lt;p&gt;Restart &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wsl2&lt;/code&gt; via powershell.&lt;/p&gt;
    &lt;div class=&quot;language-powershell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Restart-Service&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LxssManager&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Finally you can connect to internet with &lt;strong&gt;vpn&lt;/strong&gt;. To verify run the following command:&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nslook www.google.com
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2022-04-28T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/wsl-2-vpn-internet</link>
<guid isPermaLink="true">https://randomwits.com/blog/wsl-2-vpn-internet</guid>
</item>
<item>
  <title>Do you have triskaidekaphobia?</title>
  <description>&lt;p&gt;I grew up in India with a diet of basmati rice and superstition. I have seen pedestrians freezing at the sight of a black cat crossing their path for fear of bad luck. Lemon and chilis hang in front of vehicles to ward off bad spirits. I fondly remember numerous advertisements proclaiming protection from evil eyes. Recently I stumbled upon an ad that refreshed my memories.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;center&gt;
    &lt;img class=&quot;thumb&quot; src=&quot;https://unsplash.com/photos/yHG6llFLjS0/download?w=437&quot; alt=&quot;13 number&quot; /&gt;
    &lt;/center&gt;
    &lt;h3 id=&quot;tryst-with-superstition&quot;&gt;Tryst with Superstition&lt;/h3&gt;
    &lt;p&gt;I grew up in India with a diet of basmati rice and superstition. I have seen pedestrians freezing at the sight of a black cat crossing their path for fear of bad luck. Lemon and chilis hang in front of vehicles to ward off bad spirits. I fondly remember numerous advertisements proclaiming protection from evil eyes. Recently I stumbled upon an ad that refreshed my memories.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/3emy2HwSwuo&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/3emy2HwSwuo?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/3emy2HwSwuo/hqdefault.jpg alt=&apos;Video Sidh Nazar Raksha Kavach &apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Sidh Nazar Raksha Kavach &quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Another gem is a video by Numerologist, Sanjay Sethi, for doling out remedies for protection from Evil eyes. &quot;Take little raw milk on a Saturday or a Sunday and give 7 rounds of it around the affected person head and after that give that milk to a black dog to drink…(sic)&quot;.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/zsHsIoNr-JA&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/zsHsIoNr-JA?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/zsHsIoNr-JA/hqdefault.jpg alt=&apos;Video How to protect yourself from Evil Eye&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;How to protect yourself from Evil Eye &quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;When I moved to the United States, I believed I left behind the ghost of superstition. A society not plagued with superstition and has a knack for scientific temperament. But my beliefs were shattered when I took an elevator to my new apartment. Why was floor 13&lt;sup&gt;th&lt;/sup&gt; missing in the elevator?&lt;/p&gt;
    &lt;center&gt;
    &lt;img class=&quot;thumb&quot; src=&quot;https://unsplash.com/photos/TxprxES25nA/download?w=437&quot; alt=&quot;13 number&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;My first hunch was that maybe the construction company skipped their arithmetic class in school. Little bemused I tried searching for a secret button for 13&lt;sup&gt;th&lt;/sup&gt; floor like a secret entrance that of platform 9&lt;sup&gt;3&lt;/sup&gt;⁄&lt;sub&gt;4&lt;/sub&gt;
    . In the movie Harry Potter and the Philosopher&apos;s Stone, Harry had to run through a magical wall to reach Hogwart express. Luckily my sanity prevented me from banging my head against the wall of the elevator.&lt;/p&gt;
    &lt;div class=&quot;js-lazytube&quot; data-embed=&quot;&quot; data-width=&quot;640&quot;&gt;&lt;/div&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/MTykayOv_XA&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/MTykayOv_XA?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/MTykayOv_XA/hqdefault.jpg alt=&apos;Video The Sorceror Stone- Platform Nine and Three Quarters&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;The Sorceror Stone- Platform Nine and Three Quarters&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Why was the floor 13&lt;sup&gt;th&lt;/sup&gt; missing? It&apos;s purely a business decision. 13 percent of Americans in a 2007 Gallup poll said that it would bother them to stay in a room on 13 floors in a hotel&lt;sup id=&quot;fnref:usa-poll&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:usa-poll&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. In 2015, an NYC housing data firm called CityReality released that only 9% of all apartment buildings in NYC had 13th floor&lt;sup id=&quot;fnref:nyc&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:nyc&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. Many airlines like Air France, Lufthansa, Iberia and Ryanair are some of the airlines that don’t have row number 13&lt;sup id=&quot;fnref:airline&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:airline&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;There&apos;s also a rather cute word to describe a fear of number 13 called &lt;strong&gt;triskaidekaphobia&lt;/strong&gt;. I am an empiricist. I believe that all hypotheses must be tested against observations. So for me to fear number 13 , I have to be convinced not by any religious book or folklore but by data buttressed with empirical evidence.&lt;/p&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    &quot;The test of all knowledge is experiment. Experiment is the sole judge of scientific truth&quot; - Richard Feynman
    &lt;/blockquote&gt;
    &lt;p&gt;One of my worst nightmare is dying in a plane mishap. So I wanted to understand is there a correlation between aviation accident and number 13?&lt;/p&gt;
    &lt;h3 id=&quot;coding-in-python&quot;&gt;Coding in Python&lt;/h3&gt;
    &lt;p&gt;The National Transportation Safety Board (NTSB) maintains a database of aviation accidents and incidents that can be accessed by the general public on the NTSB web site. That database contains information about accidents and selected incidents within the United States, its territories and possessions, and in international waters. The database also includes events involving US-registered aircraft that occur outside US territory&lt;sup id=&quot;fnref:air-safe&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:air-safe&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;So lets download &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AviationData.txt&lt;/code&gt; dataset and analyze aviation accident&lt;sup id=&quot;fnref:book&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:book&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;aviation
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;wget http://www.airsafe.com/analyze/AviationData.txt
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;requirements.txt&lt;/code&gt; file for requried libraries.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat &amp;gt; requirements.txt&amp;lt;&amp;lt;EOF
    pandas
    matplotlib
    EOF
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Set up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python&lt;/code&gt; project&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry init
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;requirements.txt | xargs poetry add
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Creae a simple python file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;job.py&lt;/code&gt;.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d5936bac5ff41e578895c13061f81fc3.js?file=ex2.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;This should print the following data.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/number_post_1.png&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Remove dates which are empty.&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;selection&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;selection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Add three more columns to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dataframe&lt;/code&gt;&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d5936bac5ff41e578895c13061f81fc3.js?file=ex1.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Next convert dates as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;decimal&lt;/code&gt; year.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d5936bac5ff41e578895c13061f81fc3.js?file=ex3.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;img src=&quot;/img/number_post_2.png&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Convert Columns from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;string&lt;/code&gt; type to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;float&lt;/code&gt;.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d5936bac5ff41e578895c13061f81fc3.js?file=ex4.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Next we will plot the data  after 1981.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d5936bac5ff41e578895c13061f81fc3.js?file=ex5.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;img src=&quot;/img/number_post_3.png&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;If we only select dates on &lt;strong&gt;13&lt;/strong&gt; and recompute our result.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d5936bac5ff41e578895c13061f81fc3.js?file=ex6.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;img src=&quot;/img/number_post_4.png&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;So flying on 13&lt;sup&gt;th&lt;/sup&gt; doesn&apos;t have greatest number of aviation accidents.&lt;/p&gt;
    &lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
    &lt;p&gt;&lt;strong&gt;Pro Tip&lt;/strong&gt;: Book your flights or hotels on 13&lt;sup&gt;th&lt;/sup&gt; to avail discount.&lt;/p&gt;
    &lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:usa-poll&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://news.gallup.com/poll/26887/thirteen-percent-americans-bothered-stay-hotels-13th-floor.aspx&quot;&gt;Gallop polll&lt;/a&gt; &lt;a href=&quot;#fnref:usa-poll&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:nyc&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://streeteasy.com/blog/why-no-13th-floor-in-many-buildings/&quot;&gt;Why no 13th floor in my buildings&lt;/a&gt; &lt;a href=&quot;#fnref:nyc&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:airline&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.news.com.au/travel/travel-advice/flights/some-planes-skip-row-numbers-13-14-and-17-for-this-reason/news-story/779508d9d3088a631217ee02480b2023&quot;&gt;Some planes skip row numbers 13, 14 and 17 for this reason&lt;/a&gt; &lt;a href=&quot;#fnref:airline&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:air-safe&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.airsafe.com/analyze/ntsb.database.html&quot;&gt;AirSafe.com&lt;/a&gt; &lt;a href=&quot;#fnref:air-safe&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:book&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Mastering Python Data Analysis by Luiz Felipe Martins &lt;a href=&quot;#fnref:book&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-04-15T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/do-you-have-triskaidekaphobia</link>
<guid isPermaLink="true">https://randomwits.com/blog/do-you-have-triskaidekaphobia</guid>
</item>
<item>
  <title>A tale of Two leaders</title>
  <description>&lt;p&gt;After the outbreak of &lt;a href=&quot;https://en.wikipedia.org/wiki/COVID-19_pandemic&quot; target=&quot;#&quot;&gt;Covid-19 pandemic&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Fall_of_Kabul_(2021)&quot; target=&quot;_blank&quot;&gt;Fall of Kabul&lt;/a&gt;, year 2022 was supposed to instill normalcy back into the world. However world looks more topsy-turvy than before with the advent of war between Ukraine and Russia.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;After the outbreak of &lt;a href=&quot;https://en.wikipedia.org/wiki/COVID-19_pandemic&quot; target=&quot;#&quot;&gt;Covid-19 pandemic&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Fall_of_Kabul_(2021)&quot; target=&quot;_blank&quot;&gt;Fall of Kabul&lt;/a&gt;, year 2022 was supposed to instill normalcy back into the world. However world looks more topsy-turvy than before with the advent of war between Ukraine and Russia.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/mf6cWinJz9k&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/mf6cWinJz9k?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/mf6cWinJz9k/hqdefault.jpg alt=&apos;Video Russian President Putin announces military operation in Ukraine&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Russian President Putin announces military operation in Ukraine&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Wars is a terrible tragedy with no winners. United States has spent more than $8 trillion dollars on the post-9/11 wars in Afghanistan, Pakistan, Iraq, and elsewhere&lt;sup id=&quot;fnref:usa-cost&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:usa-cost&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. The Soviet Union had to splurge more than $50 billion in continuing the protracted war in Afghanistan&lt;sup id=&quot;fnref:soviet-cost&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:soviet-cost&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. Wars drag countries back for decades due to insurmountable economic loss.&lt;/p&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    &quot;Older men declare war. But it is youth that must fight and die&quot; - Herbert Hoover
    &lt;/blockquote&gt;
    &lt;p&gt;However wars, though most unfortunate, is a perfect platform to test a leader. Adversity is the tool that separates the chaff from the wheat. I could not help but compare &lt;a href=&quot;https://en.wikipedia.org/wiki/Ashraf_Ghani&quot;&gt;Ashraf Ghani&lt;/a&gt;, the former President of Afghanistan, with &lt;a href=&quot;https://en.wikipedia.org/wiki/Volodymyr_Zelenskyy&quot;&gt;Volodymyr Zelenskyy&lt;/a&gt;, the current President of Ukraine.&lt;/p&gt;
    &lt;p&gt;When the Taliban was advancing its onslaught against the Afghanistan army, Ashraf Ghani panicked and fled the country.&lt;/p&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Former Afghan President Ashraf Ghani, who fled Kabul as Taliban forces reached the outskirts of the city last month, apologized for the abrupt fall of his government but denied that he had taken millions of dollars with him &lt;a href=&quot;https://t.co/kBcLdbvvg0&quot;&gt;https://t.co/kBcLdbvvg0&lt;/a&gt; &lt;a href=&quot;https://t.co/AdqgYqgPFJ&quot;&gt;pic.twitter.com/AdqgYqgPFJ&lt;/a&gt;&lt;/p&gt;&amp;mdash; Reuters (@Reuters) &lt;a href=&quot;https://twitter.com/Reuters/status/1435835356583276552?ref_src=twsrc%5Etfw&quot;&gt;September 9, 2021&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;p&gt;However, Volodymyr Zelenskyy has refused to be evacuated and continues to lead against the Russian onslaught.&lt;/p&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;🇺🇦 Ukrainian President Volodymyr Zelenskyy and other government leaders vow to stay and defend Kyiv as Russia continues to pound Ukraine with airstrikes. &lt;a href=&quot;https://twitter.com/hashtag/UkraineRussia?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#UkraineRussia&lt;/a&gt; &lt;a href=&quot;https://t.co/aFUcP871HR&quot;&gt;pic.twitter.com/aFUcP871HR&lt;/a&gt;&lt;/p&gt;&amp;mdash; euronews (@euronews) &lt;a href=&quot;https://twitter.com/euronews/status/1497267140306829312?ref_src=twsrc%5Etfw&quot;&gt;February 25, 2022&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;p&gt;Numerical strength or a huge stash of weapons alone doesn&apos;t guarantee success in a war. The psyche of the armed forces is affected by the response of their leaders. Afghanistan army had fought valiantly against the Taliban on multiple occassions. However post withdrawl of United States army and lack of political will of Afghan politicians, Afghanistan army began to lose morale and some of their forces started to flee without fighting the Taliban.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/4eeQKPZsz2E&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/4eeQKPZsz2E?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/4eeQKPZsz2E/hqdefault.jpg alt=&apos;Afghan security forces flee without a fight as more districts fall to the Taliban&apos;&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Afghan security forces flee without a fight as more districts fall to the Taliban&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;In contrast, Ukrainian border guards at Snake Island, refused to surrender to a Russian warship despite knowing inevitable decimation.&lt;/p&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Ukraine&amp;#39;s President Volodymyr Zelenskyy said he would posthumously honor the Ukrainian border guards at Snake Island, whose voice recording refusing to surrender to a Russian warship went viral. &lt;a href=&quot;https://t.co/E5vnjYAyJw&quot;&gt;pic.twitter.com/E5vnjYAyJw&lt;/a&gt;&lt;/p&gt;&amp;mdash; DW News (@dwnews) &lt;a href=&quot;https://twitter.com/dwnews/status/1497341615580581888?ref_src=twsrc%5Etfw&quot;&gt;February 25, 2022&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;p&gt;Life has been on a roller coaster ride since the Covid-19 pandemic. The only likely event that is yet to unfurl is a full-blown alien invasion. However, with the maddening sequence of events on earth, aliens would most likely change their trajectory away from earth.&lt;/p&gt;
    &lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:usa-cost&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://watson.brown.edu/costsofwar/costs/economic&quot;&gt;Cost of War ~ Brown University&lt;/a&gt; &lt;a href=&quot;#fnref:usa-cost&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:soviet-cost&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.cia.gov/readingroom/docs/DOC_0000499320.pdf&quot;&gt;Cost of War ~ Soviet Union&lt;/a&gt; &lt;a href=&quot;#fnref:soviet-cost&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-02-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/tale-of-two-leaders</link>
<guid isPermaLink="true">https://randomwits.com/blog/tale-of-two-leaders</guid>
</item>
<item>
  <title>Creating Python AWS lambda layer with Docker</title>
  <description>&lt;p&gt;When you develop AWS lambda functions, you might feel the need to install additional &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python&lt;/code&gt; libraries. This can be achieved using Lambda layers that can be included in any lambda function.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When you develop AWS lambda functions, you might feel the need to install additional &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python&lt;/code&gt; libraries. This can be achieved using Lambda layers that can be included in any lambda function.&lt;/p&gt;
    &lt;h3 id=&quot;creating-lambda-layer-with-docker&quot;&gt;Creating Lambda Layer with Docker&lt;/h3&gt;
    &lt;p&gt;We will create a lambda layer &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-lambda-layer&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;my-lambda-layer
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;my-lambda-layer
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next, we need to list libraries that we want to include in the lambda layer. For our example, we will only add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pandas&lt;/code&gt; to our lambda layer.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pandas&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; requirements.txt
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Use docker to install libraries&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; python/lib/python3.7/site-packages
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker run &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:/var/task&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;lambci/lambda:build-python3.7&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    /bin/sh &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pip install -r requirements.txt &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
    -t python/lib/python3.7/site-packages/; exit&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    &lt;p&gt;This will create lambda layer for python runtime &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3.7&lt;/code&gt;. However you can also use docker image : public.ecr.aws/sam/build-python3.9 for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3.9&lt;/code&gt;.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;The example directory structure for a Lambda layer that&apos;s compatible with Python &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3.7&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;├── requirements.txt
    └── python/
    └── lib/
    ├── python3.7/
    │   └── site-packages/
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;remove-unnecessary-files-optional&quot;&gt;Remove unnecessary files (Optional)&lt;/h3&gt;
    &lt;p&gt;Sometimes you might want to reduce the size of the lambda layer since there is a size quota in AWS&lt;sup id=&quot;fnref:quota&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:quota&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;find &lt;span class=&quot;nt&quot;&gt;-name&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;__pycache__&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-type&lt;/span&gt; d | xargs &lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;find ./ &lt;span class=&quot;nt&quot;&gt;-name&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;*.pyc&apos;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;nt&quot;&gt;-delete&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;find &lt;span class=&quot;nt&quot;&gt;-name&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;tests&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-type&lt;/span&gt; d | xargs &lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;create-a-zipped-file&quot;&gt;Create a zipped file&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; 777 python/
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;zip &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; my-lambda-layer.zip python
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;create-or-update-your-layer&quot;&gt;Create or update your layer&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;aws lambda publish-layer-version &lt;span class=&quot;nt&quot;&gt;--layer-name&lt;/span&gt; my-lambda-layer &lt;span class=&quot;nt&quot;&gt;--description&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Demo Lambda Layer&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--zip-file&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;fileb://my-lambda-layer.zip&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--compatible-runtimes&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;python3.7&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;reference&quot;&gt;Reference&lt;/h3&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:quota&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html&quot;&gt;Lambda Layer Size Quota&lt;/a&gt; &lt;a href=&quot;#fnref:quota&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-02-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/lambda-layer</link>
<guid isPermaLink="true">https://randomwits.com/blog/lambda-layer</guid>
</item>
<item>
  <title>Implementing Dark Mode to Your Jekyll Site without learning CSS</title>
  <description>&lt;p&gt;Lots of website have added &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dark themes&lt;/code&gt; to their platform. &lt;a href=&quot;https://twitter.com/&quot;&gt;Twitter&lt;/a&gt; also has a dark mode which I really love while reading at night. Also there are &lt;a href=&quot;https://www.healthline.com/health/is-dark-mode-better-for-your-eyes#benefits-of-dark-mode&quot;&gt;benefits&lt;/a&gt; of using dark mode for the eyes.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Lots of website have added &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dark themes&lt;/code&gt; to their platform. &lt;a href=&quot;https://twitter.com/&quot;&gt;Twitter&lt;/a&gt; also has a dark mode which I really love while reading at night. Also there are &lt;a href=&quot;https://www.healthline.com/health/is-dark-mode-better-for-your-eyes#benefits-of-dark-mode&quot;&gt;benefits&lt;/a&gt; of using dark mode for the eyes.&lt;/p&gt;
    &lt;p&gt;There are lots of tutorials that require adding separte &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CSS&lt;/code&gt; for light and dark theme. However I wanted to leverage a simple &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javascript&lt;/code&gt; solution to implement dark mode.&lt;/p&gt;
    &lt;h3 id=&quot;dependencies&quot;&gt;Dependencies&lt;/h3&gt;
    &lt;p&gt;First we need to import necessary files to our html file.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/58c77577dbff8a291523d9cc5a4f3731.js?file=darkmode2.html&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;create-button-for-light-and-dark-mode&quot;&gt;Create button for light and dark mode&lt;/h3&gt;
    &lt;p&gt;We can use &lt;a href=&quot;https://fontawesome.com/&quot;&gt;FontAwesome&lt;/a&gt; to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;moon&lt;/code&gt; icon for light mode and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sun&lt;/code&gt; icon for dark mode.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/58c77577dbff8a291523d9cc5a4f3731.js?file=darkmode1.html&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;toggle-between-light-and-dark-mode&quot;&gt;Toggle between light and dark mode&lt;/h3&gt;
    &lt;p&gt;On clicking the button, we need to call the function &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;darkmode&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/58c77577dbff8a291523d9cc5a4f3731.js?file=darkmode3.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localStorage&lt;/code&gt; object allows you to save key/value pairs in the browser. This is useful to save the state of your application between page loads.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/58c77577dbff8a291523d9cc5a4f3731.js?file=darkmode4.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Lastly we need to call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setFetchMethod&lt;/code&gt; to check if the browser is using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;darkmode&lt;/code&gt; before enabling or disabling it.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/58c77577dbff8a291523d9cc5a4f3731.js?file=darkmode5.js&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;demo&quot;&gt;Demo&lt;/h3&gt;
    &lt;p&gt;&lt;img src=&quot;/img/dark_mode.gif&quot; alt=&quot;&quot; title=&quot;Dark Mode&quot; /&gt;&lt;/p&gt;
  </description>
  <pubDate>2022-02-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dark-mode-jekyll</link>
<guid isPermaLink="true">https://randomwits.com/blog/dark-mode-jekyll</guid>
</item>
<item>
  <title>Leetcode - All Divisions With the Highest Score of a Binary Array</title>
  <description>&lt;p&gt;You are given a &lt;strong&gt;0-indexed&lt;/strong&gt; binary array &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums&lt;/code&gt; of length &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums&lt;/code&gt; can be divided at index &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; (where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0 &amp;lt;= i &amp;lt;= n&lt;/code&gt;) into two arrays (possibly empty) nums&lt;sub&gt;left&lt;/sub&gt; and nums&lt;sub&gt;right&lt;/sub&gt;&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;h2 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h2&gt;
    &lt;p&gt;You are given a &lt;strong&gt;0-indexed&lt;/strong&gt; binary array &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums&lt;/code&gt; of length &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums&lt;/code&gt; can be divided at index &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; (where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0 &amp;lt;= i &amp;lt;= n&lt;/code&gt;) into two arrays (possibly empty) nums&lt;sub&gt;left&lt;/sub&gt; and nums&lt;sub&gt;right&lt;/sub&gt;:&lt;/p&gt;
    &lt;p&gt;nums&lt;sub&gt;left&lt;/sub&gt; has all the elements of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nums&lt;/code&gt; between index &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i - 1&lt;/code&gt; (&lt;strong&gt;inclusive&lt;/strong&gt;), while numsright has all the elements of nums between index &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n - 1&lt;/code&gt; (&lt;strong&gt;inclusive&lt;/strong&gt;).
    If i == 0, nums&lt;sub&gt;left&lt;/sub&gt; is empty, while nums&lt;sub&gt;right&lt;/sub&gt; has all the elements of nums.
    If i == n, nums&lt;sub&gt;left&lt;/sub&gt; has all the elements of nums, while nums&lt;sub&gt;right&lt;/sub&gt; is empty.
    The division score of an index i is the sum of the number of 0&apos;s in nums&lt;sub&gt;left&lt;/sub&gt; and the number of 1&apos;s in nums&lt;sub&gt;right&lt;/sub&gt;.&lt;/p&gt;
    &lt;p&gt;Return all distinct indices that have the highest possible division score. You may return the answer in any orde&lt;/p&gt;
    &lt;h3 id=&quot;example-1&quot;&gt;Example 1&lt;/h3&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: nums = [0,0,1,0]
    Output: [2,4]
    Explanation: Division at index
    - 0: numsleft is []. numsright is [0,0,1,0]. The score is 0 + 1 = 1.
    - 1: numsleft is [0]. numsright is [0,1,0]. The score is 1 + 1 = 2.
    - 2: numsleft is [0,0]. numsright is [1,0]. The score is 2 + 1 = 3.
    - 3: numsleft is [0,0,1]. numsright is [0]. The score is 2 + 0 = 2.
    - 4: numsleft is [0,0,1,0]. numsright is []. The score is 3 + 0 = 3.
    Indices 2 and 4 both have the highest possible division score 3.
    Note the answer [4,2] would also be accepted.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;example-2&quot;&gt;Example 2&lt;/h3&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: nums = [0,0,0]
    Output: [3]
    Explanation: Division at index
    - 0: numsleft is []. numsright is [0,0,0]. The score is 0 + 0 = 0.
    - 1: numsleft is [0]. numsright is [0,0]. The score is 1 + 0 = 1.
    - 2: numsleft is [0,0]. numsright is [0]. The score is 2 + 0 = 2.
    - 3: numsleft is [0,0,0]. numsright is []. The score is 3 + 0 = 3.
    Only index 3 has the highest possible division score 3.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;example-3&quot;&gt;Example 3&lt;/h3&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: nums = [1,1]
    Output: [0]
    Explanation: Division at index
    - 0: numsleft is []. numsright is [1,1]. The score is 0 + 2 = 2.
    - 1: numsleft is [1]. numsright is [1]. The score is 0 + 1 = 1.
    - 2: numsleft is [1,1]. numsright is []. The score is 0 + 0 = 0.
    Only index 0 has the highest possible division score 2.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;explanation&quot;&gt;Explanation&lt;/h2&gt;
    &lt;p&gt;We can maintain two window &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left&lt;/code&gt; with size 0 and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right&lt;/code&gt; with full length of array. For each iteration, we will increase the length of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left&lt;/code&gt; window and reduce the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right&lt;/code&gt; window. We will also keep track of number of zeros in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left&lt;/code&gt; window and number of ones in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right&lt;/code&gt; window. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;maximum sum&lt;/code&gt; of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left + right&lt;/code&gt; will contain the highest score.&lt;/p&gt;
    &lt;p&gt;&lt;img class=&quot;mermaid&quot; src=&quot;https://mermaid.ink/svg/eyJjb2RlIjoiZ3JhcGggVERcbkFbXCJbMCwgMCwgMSwgMF1cIl0gLS0-IEJbXCJbIF1cIl1cbkFbXCJbMCwgMCwgMSwgMF1cIl0gLS0-IENbXCJbMCwgMCwgMSwgMF1cIl1cbiUlLVxuQltcIlsgXVwiXSAtLT4gRFtcIlswXVwiXVxuQ1tcIlswLCAwLCAxLCAwXVwiXSAtLT4gIEVbXCJbMCwgMSwgMF1cIl1cbiUlLVxuRFtcIlswXVwiXSAtLT4gRltcIlswLCAwXVwiXVxuRVtcIlswLCAxLCAwXVwiXSAtLT4gIEdbXCJbMSwgMF1cIl1cbiUlLVxuRltcIlswLCAwXVwiXSAtLT4gSFtcIlswLCAwLCAxXVwiXVxuR1tcIlsxLCAwXVwiXSAtLT4gIElbXCJbMF1cIl1cbiUlLVxuSFtcIlswLCAwLCAxXVwiXSAtLT4gSltcIlswLCAwLCAxLCAwXVwiXVxuSVtcIlswXVwiXSAtLT4gIEtbXCJbIF1cIl0iLCJtZXJtYWlkIjpudWxsfQ&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;The maxium key in &lt;strong&gt;hashmap&lt;/strong&gt; will contain the list of indices with the highest score.&lt;/p&gt;
    &lt;h2 id=&quot;solution&quot;&gt;Solution&lt;/h2&gt;
    &lt;div class=&quot;tab-container&quot;&gt; &lt;ul&gt; &lt;li class=&quot;tab java&quot;&gt;&lt;a href=&quot;#java&quot;&gt;java&lt;/a&gt;&lt;/li&gt; &lt;li class=&quot;tab python&quot;&gt;&lt;a href=&quot;#python&quot;&gt;python&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot; code-block codeSample java&quot; id=&quot;java&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/fa433cb7d3f266f5853854805134c543.js?file=MaxScoreIndices.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;div class=&quot; code-block codeSample python&quot; id=&quot;python&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/fa433cb7d3f266f5853854805134c543.js?file=max_score_indices.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt; &lt;/div&gt;
  </description>
  <pubDate>2022-02-05T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/all-divisions-with-the-highest-score-of-a-binary-array</link>
<guid isPermaLink="true">https://randomwits.com/blog/all-divisions-with-the-highest-score-of-a-binary-array</guid>
</item>
<item>
  <title>Learning Tennis</title>
  <description>&lt;p&gt;Badminton sport has a low learning curve unlike tennis. Even your granny can hit a birdie. I grew up playing badminton but decided to try my luck with tennis. &quot;Playing tennis would be a cakewalk&quot;, I thought. However my hubris was soon deflated.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Badminton sport has a low learning curve unlike tennis. Even your granny can hit a birdie. I grew up playing badminton but decided to try my luck with tennis. &quot;Playing tennis would be a cakewalk&quot;, I thought. However my hubris was soon deflated.&lt;/p&gt;
    &lt;p&gt;Badminton is a game of reflex and agility. One of my most favourite technique in badminton you can use your full strength to smash the shuttlecock across your opponent. Since the shuttlecock is made of feather, you can easily control its trajectory.&lt;/p&gt;
    &lt;div style=&quot;position:relative; padding-bottom:calc(57.50% + 44px)&quot;&gt;&lt;iframe src=&quot;https://gfycat.com/ifr/PreciousPeriodicAlpinegoat&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; width=&quot;100%&quot; height=&quot;100%&quot; style=&quot;position:absolute;top:0;left:0;&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;However badminton skills are not directly transferable to tennis. On my first day playing tennis, I was hitting tennis ball all over the place.  So I had to learn forehand&lt;sup id=&quot;fnref:forehand&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:forehand&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; technique to properly hit the ball.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;figure&gt;
    &lt;iframe height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/JCD6_j7W2Vk&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;position: relative;  width: 100%;&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;/figure&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Currently my tennis rating is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2.5&lt;/code&gt;&lt;sup id=&quot;fnref:rating&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:rating&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. Tennis is often dubbed as a sport for anyone between 4 and 94 years of age. Luckily I little younger than 94, so I can continue to improve and enjoy game of tennis.&lt;/p&gt;
    &lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:forehand&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Forehand&quot;&gt;Forehand&lt;/a&gt; &lt;a href=&quot;#fnref:forehand&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:rating&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.usta.com/content/dam/usta/pdfs/10013_experience_player_ntrp_guidelines.pdf&quot;&gt;Ratings&lt;/a&gt; &lt;a href=&quot;#fnref:rating&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2022-01-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/learning-tennis</link>
<guid isPermaLink="true">https://randomwits.com/blog/learning-tennis</guid>
</item>
<item>
  <title>Leetcode - Longest Substring Without Repeating Characters</title>
  <description>&lt;p&gt;In this &lt;a href=&quot;https://leetcode.com/problems/longest-substring-without-repeating-characters/&quot;&gt;leetcode&lt;/a&gt; problem, we are asked to find the length of the longest string of characters in a provided string that does not contain repeating characters. In other words, in the string &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;abcabcbb&lt;/code&gt; the longest substring without repeating characters is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;abc&lt;/code&gt; (with a length of 3).&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/multipleTab.css&quot; /&gt;
    &lt;script src=&quot;/js/jquery.easytabs.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;/js/multipleTab.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;In this &lt;a href=&quot;https://leetcode.com/problems/longest-substring-without-repeating-characters/&quot;&gt;leetcode&lt;/a&gt; problem, we are asked to find the length of the longest string of characters in a provided string that does not contain repeating characters. In other words, in the string &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;abcabcbb&lt;/code&gt; the longest substring without repeating characters is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;abc&lt;/code&gt; (with a length of 3).&lt;/p&gt;
    &lt;h2 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h2&gt;
    &lt;p&gt;Given a string s, find the length of the longest substring without repeating characters.&lt;/p&gt;
    &lt;h3 id=&quot;example-1&quot;&gt;Example 1&lt;/h3&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: s &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;abcabcbb&quot;&lt;/span&gt;
    Output: 3
    Explanation: The answer is &lt;span class=&quot;s2&quot;&gt;&quot;abc&quot;&lt;/span&gt;, with the length of 3.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;example-2&quot;&gt;Example 2&lt;/h3&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: s &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;bbbbb&quot;&lt;/span&gt;
    Output: 1
    Explanation: The answer is &lt;span class=&quot;s2&quot;&gt;&quot;b&quot;&lt;/span&gt;, with the length of 1.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;example-3&quot;&gt;Example 3&lt;/h3&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: s &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pwwkew&quot;&lt;/span&gt;
    Output: 3
    Explanation: The answer is &lt;span class=&quot;s2&quot;&gt;&quot;wke&quot;&lt;/span&gt;, with the length of 3.
    Notice that the answer must be a substring,
    &lt;span class=&quot;s2&quot;&gt;&quot;pwke&quot;&lt;/span&gt; is a subsequence and not a substring.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;explanation&quot;&gt;Explanation&lt;/h2&gt;
    &lt;p&gt;We can use two pointers to solve this problem.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Assign &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; = 0 and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left&lt;/code&gt; = 0.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set&lt;/code&gt; to keep track of characters in the substring.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Loop through the string&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;If the character at index &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; is not in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set&lt;/code&gt;, we add it to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set&lt;/code&gt; and increment &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; pointer.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the character at index &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; is in the set, then we have found a new substring. We remove the character at index &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left&lt;/code&gt; from the set and increment &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left&lt;/code&gt; pointer.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;&lt;img src=&quot;/img/longest_substring.gif&quot; alt=&quot;Longest substring image&quot; /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;solution&quot;&gt;Solution&lt;/h2&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/83cc247e2832e0a381556d57a6ef8ce3.js?file=LengthOfLongestSubstring.java&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/83cc247e2832e0a381556d57a6ef8ce3.js?file=length_of_longest_substring.py&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;complexity&quot;&gt;Complexity&lt;/h2&gt;
    &lt;p&gt;Time Complexity is &lt;strong&gt;$$\mathcal{O}(n)$$&lt;/strong&gt;, Space complexity is &lt;strong&gt;$$\mathcal{O}(1)$$&lt;/strong&gt;&lt;/p&gt;
  </description>
  <pubDate>2022-01-18T02:07:00+00:00</pubDate>
  <link>https://randomwits.com/blog/leetcode-longest-substring-without-repeating-characters</link>
<guid isPermaLink="true">https://randomwits.com/blog/leetcode-longest-substring-without-repeating-characters</guid>
</item>
<item>
  <title>Debugging Spark Application Locally using remote container</title>
  <description>&lt;p&gt;One of the nifty feature in any code development is the ability to debug your application using break points. Submitting a Spark job while waiting for it to complete will waste a lot of time debugging. Spark jobs can be debugging with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;break points&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;step over&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;step into&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;step out&lt;/code&gt; commands.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;One of the nifty feature in any code development is the ability to debug your application using break points. Submitting a Spark job while waiting for it to complete will waste a lot of time debugging. Spark jobs can be debugging with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;break points&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;step over&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;step into&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;step out&lt;/code&gt; commands.&lt;/p&gt;
    &lt;h1 id=&quot;requirements&quot;&gt;Requirements&lt;/h1&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;VS Code&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.docker.com/&quot;&gt;Docker&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h1 id=&quot;setup&quot;&gt;Setup&lt;/h1&gt;
    &lt;p&gt;Lets create our project.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;SparkDemo &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;SparkDemo
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We will create a file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.devcontainer/devcontainer.json&lt;/code&gt;. &lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;VS Code&lt;/a&gt; will use this file to access (or create) a development container with a well-defined tool and runtime stack.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ mkdir .devcontainer
    $ touch .devcontainer/devcontainer.json
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;devconainter.json&lt;/code&gt; will look like this:&lt;br /&gt;&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/318bf60d15f03b0afe154f63589c2b84.js?file=devcontainer.json&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;We will need to add a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dockerfile&lt;/code&gt; to our project. This file will be used to build the container.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/318bf60d15f03b0afe154f63589c2b84.js?file=Dockerfile&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Lastly, we need to create a simple &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pyspark&lt;/code&gt; script. &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/318bf60d15f03b0afe154f63589c2b84.js?file=spark_demo.py&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h1 id=&quot;running-the-container&quot;&gt;Running the container&lt;/h1&gt;
    &lt;p&gt;Currently your project structure should look like this:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SparkDemo
    ___ .devcontainer
    ___ ___ devcontainer.json
    ___ Dockerfile
    ___ spark_demo.py
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next, we need to open the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SparkDemo&lt;/code&gt; in VS Code.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;SparkDemo
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;code &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To run the remote-container, you can click on the green button in the bottom left corner of the VS Code window.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/remote-dev-status-bar.png&quot; /&gt;&lt;/p&gt;
    &lt;h1 id=&quot;demo&quot;&gt;Demo&lt;/h1&gt;
    &lt;iframe height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/hQNbEGFpbOI&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;position: relative;  width: 100%;&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
  </description>
  <pubDate>2022-01-17T00:28:00+00:00</pubDate>
  <link>https://randomwits.com/blog/debugging-spark-application-using-remote-container</link>
<guid isPermaLink="true">https://randomwits.com/blog/debugging-spark-application-using-remote-container</guid>
</item>
<item>
  <title>Wild Marriage</title>
  <description>&lt;p&gt;&quot;Marriages are made in heaven&quot; is an old adage quite prevalent across all cultures. Whether heaven harbors any interest in the mortal affair has still scant empirical evidence. However, there is a rare marriage that not only invites heaven&apos;s fury but also is consummated by mutual suicide.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML-full&quot;&gt;&lt;/script&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/chat.css&quot; /&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2021-12-24-wild-marriage.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;
    &lt;!--begin_of_post --&gt;&lt;/p&gt;
    &lt;p&gt;&quot;Marriages are made in heaven&quot; is an old adage quite prevalent across all cultures. Whether heaven harbors any interest in the mortal affair has still scant empirical evidence. However there is a rare marriage that not only invites heaven&apos;s fury but also is consummated by mutual suicide.&lt;/p&gt;
    &lt;p&gt;&quot;Wild marriage&quot; was coined by Max Born in his book Atomic Physics. The phenomenon describes an encounter of a positron and an electron. Both particles will cease to exist and will annihilate each other by releasing intensive electromagnetic radiation (gamma [γ] rays).&lt;/p&gt;
    &lt;figure align=&quot;center&quot;&gt;
    &lt;br /&gt;&lt;video class=&quot;asset-video&quot; width=&quot;100%&quot; height=&quot;75%&quot; poster=&quot;https://svs.gsfc.nasa.gov/vis/a000000/a000100/a000182/annihilation.jpg&quot; controls=&quot;controls&quot; preload=&quot;metadata&quot;&gt;
    &lt;!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 --&gt;
    &lt;!-- movie assets *other movie type that works with Chrome* --&gt;
    &lt;source type=&quot;video/mp4&quot; src=&quot;/img/a000182.mp4&quot; /&gt;
    &lt;!-- WebM/VP8 for Firefox4, Opera, and Chrome --&gt;
    &lt;source type=&quot;video/webm&quot; src=&quot;/img/a000182.webmhd.webm&quot; /&gt;
    Your browser does not support HTML video.
    &lt;/video&gt;&lt;br /&gt;
    &lt;p&gt;  Animation Courtesy &lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;
    &lt;/p&gt;
    &lt;/figure&gt;
    &lt;h1 id=&quot;conservation-of-energy&quot;&gt;Conservation of energy&lt;/h1&gt;
    &lt;p&gt;Antimatter is the same as ordinary matter except that it has the opposite electric charge. Positron is an antimatter equivalent for an electron. They have equal mass but opposite charges. Thanks to Einstein&apos;s equation, &lt;strong&gt;E=mc&lt;sup&gt;2&lt;/sup&gt;&lt;/strong&gt;, there&apos;s an equivalence between energy and mass. So a colliding positron and electron converts their rest mass to pure energy in form of two oppositely directed 0.511 MeV photons.&lt;/p&gt;
    &lt;p&gt;$$
    \begin{align}
    e− + e+ → γ + γ (2x 0.511 MeV)
    \end{align}
    $$&lt;/p&gt;
    &lt;h1 id=&quot;prediction-of-antimatter&quot;&gt;Prediction of antimatter&lt;/h1&gt;
    &lt;p&gt;Paul Dirac had postulated that an infinitely dense totally homogeneous sea of these electrons was present everywhere in the universe called Dirac sea. If a light collides with a negative electron it can convert into positive energy state. The hole it leaves behind is called a Dirac hole. So the hole was called positron.&lt;/p&gt;
    &lt;p&gt;The homogeneous sea of electron can be described as an old Hindu story. A fish went to the Queen fish and asked: &quot;I have always heard about the sea, but what is the sea? Where is it?&quot; The Queen fish replied: &quot;You live, move, and have your being in the sea. The sea is within you and without you, and you are made of sea and you will end in sea. The sea surrounds
    you as your own being&quot;&lt;sup&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h1 id=&quot;feynmans-interpretation&quot;&gt;Feynman&apos;s interpretation&lt;/h1&gt;
    &lt;p&gt;Feynman described annihilation like an electron travelling forward interacts with some light energy and starts travelling backwards in time. So a positron is just an electron travelling backwards in time. Antimatter behaves mathematically equivalent to normal matter simply traveling backwards in time.&lt;/p&gt;
    &lt;figure&gt;
    &lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/b/ba/Feynman_EP_Annihilation.svg&quot; /&gt;
    &lt;/figure&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    &quot;It is as though a bombardier flying low over a road suddenly sees three roads and it is only when two of them come together and disappear again that he realizes that he has simply passed over a long switchback in a single road&quot; - Richard Feynman
    &lt;/blockquote&gt;
    &lt;h1 id=&quot;deficiency-of-anti-matter&quot;&gt;Deficiency of anti-matter&lt;/h1&gt;
    &lt;p&gt;Marriage as an institution is unique in humans. It&apos;s a legal contract with bells and whistles depending upon the jurisdiction. Dissolving a friendship has no legal consequences but dissolving a marriage requires an acquiesce of the court.&lt;/p&gt;
    &lt;p&gt;The marriage of particle and anti-particle is an spectacular event in microscopic world. However future generation might be able to harvest this energy. 2 kilograms of antimatter would contains 85.92 megatons of destructive force. This is more yield than the most powerful H-bomb exploded to date&lt;sup&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;. However the storage and generation of anti-matter is not feasible by our current technology.&lt;/p&gt;
    &lt;p&gt;Matter and anti matter are mostly identical twins mostly differing in electric charge and other differences in quantum numbers. Our universe owes its existence to the deficiency of anti matter else it would have been annihilated. Early universe probably had copious quantities of both matter and anti-matter. However the cards were dealt in favor of matter probably by a hand of God in favor of our universe.&lt;/p&gt;
    &lt;!--end_of_post --&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt; NASA/Goddard Space Flight Center Scientific Visualization Studio &lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;P. Reps, Zen Flesh, Zen Bones pg. 211&lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.edwardmuller.com/index.php#calculator&quot;&gt;Anti matter calculator&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-12-24T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/wild-marriage</link>
<guid isPermaLink="true">https://randomwits.com/blog/wild-marriage</guid>
</item>
<item>
  <title>Course Schedule Leetcode Solution</title>
  <description>&lt;p&gt;There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [a&lt;sub&gt;i&lt;/sub&gt;, b&lt;sub&gt;i&lt;/sub&gt;] indicates that you must take course b&lt;sub&gt;i&lt;/sub&gt; first if you want to take course a&lt;sub&gt;i&lt;/sub&gt;.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/multipleTab.css&quot; /&gt;
    &lt;script src=&quot;/js/jquery.easytabs.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;/js/multipleTab.js&quot;&gt;&lt;/script&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML-full&quot;&gt;&lt;/script&gt;
    &lt;p&gt;There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [a&lt;sub&gt;i&lt;/sub&gt;, b&lt;sub&gt;i&lt;/sub&gt;] indicates that you must take course b&lt;sub&gt;i&lt;/sub&gt; first if you want to take course a&lt;sub&gt;i&lt;/sub&gt;.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Return true if you can finish all courses. Otherwise, return false.&lt;/p&gt;
    &lt;h1 id=&quot;testcase&quot;&gt;Testcase&lt;/h1&gt;
    &lt;h2 id=&quot;example-1&quot;&gt;Example 1&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: numCourses &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2, prerequisites &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt;1,0]]
    Output: &lt;span class=&quot;nb&quot;&gt;true
    &lt;/span&gt;Explanation: There are a total of 2 courses to take. 
    To take course 1 you should have finished course 0. So it is possible.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;example-2&quot;&gt;Example 2&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: numCourses &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2, prerequisites &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt;1,0],[0,1]]
    Output: &lt;span class=&quot;nb&quot;&gt;false
    &lt;/span&gt;Explanation: There are a total of 2 courses to take. 
    To take course 1 you should have finished course 0, 
    and to take course 0 you should also have finished course 1. So it is impossible.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;constraints&quot;&gt;Constraints:&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;1 &amp;lt;= numCourses &amp;lt;= 105&lt;/li&gt;
    &lt;li&gt;0 &amp;lt;= prerequisites.length &amp;lt;= 5000&lt;/li&gt;
    &lt;li&gt;prerequisites[i].length == 2&lt;/li&gt;
    &lt;li&gt;0 &amp;lt;= ai, bi &amp;lt; numCourses&lt;/li&gt;
    &lt;li&gt;All the pairs prereq&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h1 id=&quot;explanation&quot;&gt;Explanation&lt;/h1&gt;
    &lt;p&gt;Lets take a good test case like&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;numCourses &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 5
    prerequisites &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt;1,4],[2,4],[3,1],[3,2]]
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;4&lt;/strong&gt; is prerequisite for both &lt;strong&gt;1&lt;/strong&gt; and &lt;strong&gt;2&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;1&lt;/strong&gt; is a prerequisite for &lt;strong&gt;3&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;2&lt;/strong&gt; is a prerequisite for &lt;strong&gt;3&lt;/strong&gt;.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;We can visuallize it as a &lt;strong&gt;directed graph&lt;/strong&gt;.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/YptmwmT.png&quot; alt=&quot;graph directed&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;This problem is equivalent to finding if a cycle exists in a directed graph. If a cycle exists, no topological ordering exists and therefore it will be impossible to take all courses.&lt;/p&gt;
    &lt;h1 id=&quot;solution&quot;&gt;Solution&lt;/h1&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/4e20a87e4f6622bd6996d502d528f942.js?file=CourseSchedule.java&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/4e20a87e4f6622bd6996d502d528f942.js?file=course_schedule.py&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h1 id=&quot;complexity&quot;&gt;Complexity&lt;/h1&gt;
    &lt;p&gt;Time complexity:  $$\mid V \mid  + \mid E \mid$$.&lt;/p&gt;
    &lt;p&gt;V : numCourses &amp;amp; E : prerequisites&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://leetcode.com/problems/course-schedule/&quot; target=&quot;_blank&quot;&gt;207. Course Schedule&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-12-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/course-schedule</link>
<guid isPermaLink="true">https://randomwits.com/blog/course-schedule</guid>
</item>
<item>
  <title>Remove-all-adjacent-duplicates-in-string-ii Solution</title>
  <description>&lt;p&gt;You are given a string s and an integer k, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them, causing the left and the right side of the deleted substring to concatenate together.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/multipleTab.css&quot; /&gt;
    &lt;script src=&quot;/js/jquery.easytabs.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;/js/multipleTab.js&quot;&gt;&lt;/script&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;h1 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h1&gt;
    &lt;p&gt;You are given a string s and an integer k, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them, causing the left and the right side of the deleted substring to concatenate together.&lt;/p&gt;
    &lt;p&gt;We repeatedly make k duplicate removals on s until we no longer can.&lt;/p&gt;
    &lt;p&gt;Return the final string after all such duplicate removals have been made. It is guaranteed that the answer is unique&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;!-- disclaimer --&gt;
    &lt;div class=&quot;cl disclaimer&quot;&gt;
    &lt;i class=&quot;icon-star&quot;&gt;&lt;/i&gt;
    &lt;span style=&quot;color:black&quot;&gt; &amp;nbsp;&amp;nbsp;All my solutions are uploaded to &lt;a href=&quot;https://github.com/tushar-sharma/prep-coding&quot; target=&quot;_blank&quot;&gt;Github repository&lt;/a&gt;
    &lt;/span&gt; 
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h1 id=&quot;testcase&quot;&gt;Testcase&lt;/h1&gt;
    &lt;h2 id=&quot;example-1&quot;&gt;Example 1&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: s &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;abcd&quot;&lt;/span&gt;, k &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2
    Output: &lt;span class=&quot;s2&quot;&gt;&quot;abcd&quot;&lt;/span&gt;
    Explanation: There&lt;span class=&quot;s1&quot;&gt;&apos;s nothing to delete.
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;example-2&quot;&gt;Example 2&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: s &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deeedbbcccbdaa&quot;&lt;/span&gt;, k &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 3
    Output: &lt;span class=&quot;s2&quot;&gt;&quot;aa&quot;&lt;/span&gt;
    Explanation: 
    First delete &lt;span class=&quot;s2&quot;&gt;&quot;eee&quot;&lt;/span&gt; and &lt;span class=&quot;s2&quot;&gt;&quot;ccc&quot;&lt;/span&gt;, get &lt;span class=&quot;s2&quot;&gt;&quot;ddbbbdaa&quot;&lt;/span&gt;
    Then delete &lt;span class=&quot;s2&quot;&gt;&quot;bbb&quot;&lt;/span&gt;, get &lt;span class=&quot;s2&quot;&gt;&quot;dddaa&quot;&lt;/span&gt;
    Finally delete &lt;span class=&quot;s2&quot;&gt;&quot;ddd&quot;&lt;/span&gt;, get &lt;span class=&quot;s2&quot;&gt;&quot;aa&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;example-3&quot;&gt;Example 3&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: s &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pbbcggttciiippooaais&quot;&lt;/span&gt;, k &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2
    Output: &lt;span class=&quot;s2&quot;&gt;&quot;ps&quot;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;constraints&quot;&gt;Constraints:&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;1 &amp;lt;= s.length &amp;lt;= 105&lt;/li&gt;
    &lt;li&gt;2 &amp;lt;= k &amp;lt;= 104&lt;/li&gt;
    &lt;li&gt;s only contains lower case English letters.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h1 id=&quot;explanation&quot;&gt;Explanation&lt;/h1&gt;
    &lt;ol&gt;
    &lt;li&gt;Use a stack and store a pair of character and its count.&lt;/li&gt;
    &lt;li&gt;Update the count of character if its adjacent.&lt;/li&gt;
    &lt;li&gt;If the count equals to the value of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt; then remove the character.&lt;/li&gt;
    &lt;li&gt;Iterate over the stack to generate the output string.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;For example for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Input: s = &quot;deeedbbcccbdaa&quot;, k = 3&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/iZHiqyl.gif&quot; alt=&quot;stack operation&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h1 id=&quot;solution&quot;&gt;Solution&lt;/h1&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Javascript1&quot;&gt;&lt;a href=&quot;#Javascript1&quot;&gt;Javascript&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Scala1&quot;&gt;&lt;a href=&quot;#Scala1&quot;&gt;Scala&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/00bbaae23770cf2b451ed26151951e82.js?file=RemoveDuplicates.java&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/00bbaae23770cf2b451ed26151951e82.js?file=remove_duplicates.py&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Javascript1&quot; id=&quot;Javascript1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/00bbaae23770cf2b451ed26151951e82.js?file=removeDuplicates.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Scala1&quot; id=&quot;Scala1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/00bbaae23770cf2b451ed26151951e82.js?file=RemoveDuplicates.scala&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h1 id=&quot;complexity&quot;&gt;Complexity&lt;/h1&gt;
    &lt;p&gt;Time Complexity: O(N).&lt;/p&gt;
    &lt;p&gt;Space Complexity: O(N).&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii/&quot; target=&quot;_blank&quot;&gt;Remove All Adjacent Duplicates in String II&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-12-18T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/remove-all-adjacent-duplicates-in-string-ii</link>
<guid isPermaLink="true">https://randomwits.com/blog/remove-all-adjacent-duplicates-in-string-ii</guid>
</item>
<item>
  <title>Lost Friends</title>
  <description>&lt;p&gt;Today I walked a little further, &lt;br /&gt;
    further than yesterday.&lt;br /&gt;
    while my feet ache and plead,&lt;br /&gt;
    I dragged &apos;em without paying any heed.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2021-12-13-lost-friends.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;
    &lt;!--begin_of_post --&gt;&lt;/p&gt;
    &lt;p&gt;
    &lt;img src=&quot;https://i.imgur.com/imYXtDU.jpg&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;Today I walked a little further, &lt;br /&gt;
    further than yesterday.&lt;br /&gt;
    while my feet ache and plead,&lt;br /&gt;
    I dragged &apos;em without paying any heed.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Lost in thoughts of wilderness,&lt;br /&gt;
    Caged in the civilization of life.&lt;br /&gt;
    I often stray away from a well-beaten path,&lt;br /&gt;
    only to invite a flury of ridicule and wrath.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Sometimes I have a urge to pause, &lt;br /&gt;
    To glance over my shoulders, &lt;br /&gt;
    spot silhouettes of old friends,&lt;br /&gt;
    waiting to animate to make amend.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Like an irreversible arrow of time,&lt;br /&gt;
    Aging sucks memories into oblivion,&lt;br /&gt;
    While the clock’s hand marches ahead, &lt;br /&gt;
    it obliterates lost friends and words unsaid.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Supernova is an epitaph of a dying star,&lt;br /&gt;
    For it has splendid quanity of fuel to squander,&lt;br /&gt;
    Since I am too poor to afford a grandeur farewell,&lt;br /&gt;
    hope my lost friends still harbour my memories well.&lt;br /&gt;
    &lt;!--end_of_post --&gt;&lt;/p&gt;
  </description>
  <pubDate>2021-12-13T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/lost-friends</link>
<guid isPermaLink="true">https://randomwits.com/blog/lost-friends</guid>
</item>
<item>
  <title>Lowest Common Ancestor of a Binary Tree</title>
  <description>&lt;p&gt;Questions involving the binary tree data structure are very popular in tech interviews, and can be challenging and varied! A binary tree is a data structure consisting of a collection of nodes (starting at a root node), where each node consists of a value (data), together with a directed edges to at most two nodes (the &quot;left child&quot; and &quot;right child&quot;), with the additional conditions that no two edges point to the same node and no edge points to the root. I recently solved an interesting problem on binary tree.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Questions involving the binary tree data structure are very popular in tech interviews, and can be challenging and varied! A binary tree is a data structure consisting of a collection of nodes (starting at a root node), where each node consists of a value (data), together with a directed edges to at most two nodes (the &quot;left child&quot; and &quot;right child&quot;), with the additional conditions that no two edges point to the same node and no edge points to the root. I recently solved an interesting problem on binary tree.
    &lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;!-- disclaimer --&gt;
    &lt;div class=&quot;cl disclaimer&quot;&gt;
    &lt;i class=&quot;icon-star&quot;&gt;&lt;/i&gt;
    &lt;span style=&quot;color:black&quot;&gt; &amp;nbsp;&amp;nbsp;All my solutions are uploaded to &lt;a href=&quot;https://github.com/tushar-sharma/prep-coding&quot; target=&quot;_blank&quot;&gt;Github repository&lt;/a&gt;
    &lt;/span&gt; 
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h1 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h1&gt;
    &lt;p&gt;Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.&lt;/p&gt;
    &lt;p&gt;According to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lowest_common_ancestor&quot;&gt;definition of LCA on Wikipedia&lt;/a&gt;: &quot;The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself)&quot;&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;h1 id=&quot;testcase&quot;&gt;Testcase&lt;/h1&gt;
    &lt;h2 id=&quot;example-1&quot;&gt;Example 1&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: root &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3,5,1,6,2,0,8,null,null,7,4], p &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 5, q &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 1
    Output: 3
    Explanation: The LCA of nodes 5 and 1 is 3.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;example-2&quot;&gt;Example 2&lt;/h2&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: root &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3,5,1,6,2,0,8,null,null,7,4], p &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 5, q &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 4
    Output: 5
    Explanation: The LCA of nodes 5 and 4 is 5, 
    since a node can be a descendant of itself according to the LCA definition.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;example-3&quot;&gt;Example 3&lt;/h3&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Input: root &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1,2], p &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 1, q &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2
    Output: 1
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;constraints&quot;&gt;Constraints:&lt;/h2&gt;
    &lt;ul&gt;
    &lt;li&gt;The number of nodes in the tree is in the range [2, 105].&lt;/li&gt;
    &lt;li&gt;-109 &amp;lt;= Node.val &amp;lt;= 109&lt;/li&gt;
    &lt;li&gt;All Node.val are unique.&lt;/li&gt;
    &lt;li&gt;p != q&lt;/li&gt;
    &lt;li&gt;p and q will exist in the tree.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;h1 id=&quot;explanation&quot;&gt;Explanation&lt;/h1&gt;
    &lt;p&gt;We traverse the left and right sub trees.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;If current node is NULL, then we will return NULL since we have reached the end of tree.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If current node matches node p or q, then we return current node.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the current node has node p in its left subtree and q in its right subtree or vice versa then the current node will be the lowest common ancestor.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;If the current node has nodes p and q exclusively in its left subtree or right subtree, then we will return the left or right subtree accordingly.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h1 id=&quot;solution&quot;&gt;Solution&lt;/h1&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Javascript1&quot;&gt;&lt;a href=&quot;#Javascript1&quot;&gt;Javascript&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Scala1&quot;&gt;&lt;a href=&quot;#Scala1&quot;&gt;Scala&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/313465d1f1fa21800d3a726146780020.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/a0b2faeeace2acaa3f8b61794af59976.js&quot;&gt;&lt;/script&gt;  
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Javascript1&quot; id=&quot;Javascript1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/cb9e4364f354423764459a11477c4d98.js&quot;&gt;&lt;/script&gt; 
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Scala1&quot; id=&quot;Scala1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/8611d4612495af58e3d0fb9f8e4c3883.js&quot;&gt;&lt;/script&gt; 
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;complexity&quot;&gt;Complexity&lt;/h2&gt;
    &lt;p&gt;Time Complexity: O(N).&lt;/p&gt;
    &lt;p&gt;Space Complexity: O(1).&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/&quot; target=&quot;_blank&quot;&gt;Lowest Common Ancestor of a Binary Tree&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-12-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/leetcode-lca-binary-tree</link>
<guid isPermaLink="true">https://randomwits.com/blog/leetcode-lca-binary-tree</guid>
</item>
<item>
  <title>Ternary String solution Codeforces - 1354B</title>
  <description>&lt;p&gt;Ternary string is an interesting problem that could be solved using two pointers techniques. It&apos;s a convenient way to keep track of multiple indices. This helps in making decisions based on two values.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/multipleTab.css&quot; /&gt;
    &lt;script src=&quot;/js/jquery.easytabs.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;/js/multipleTab.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML-full&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Ternary string is an interesting problem that could be solved using two pointers techniques. It&apos;s a convenient way to keep track of multiple indices. This helps in making decisions based on two values.&lt;/p&gt;
    &lt;h2 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h2&gt;
    &lt;p&gt;
    You are given a string s such that each its character is either 1, 2, or 3. You have to choose the shortest contiguous substring of s such that it contains each of these three characters at least once.
    A contiguous substring of string s is a string that can be obtained from s by removing some (possibly zero) characters from the beginning of s and some (possibly zero) characters from the end of s.&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;
    &lt;/p&gt;
    &lt;h3 id=&quot;input&quot;&gt;Input&lt;/h3&gt;
    &lt;p&gt;The first line contains one integer t (1≤t≤20000) - the number of test cases.&lt;/p&gt;
    &lt;p&gt;Each test case consists of one line containing the string s (1≤s≤200000). It is guaranteed that each character of s is either 1, 2, or 3.&lt;/p&gt;
    &lt;p&gt;The sum of lengths of all strings in all test cases does not exceed&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;7
    123
    12222133333332
    112233
    332211
    12121212
    333333
    31121
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;output&quot;&gt;Output&lt;/h3&gt;
    &lt;p&gt;For each test case, print one integer — the length of the shortest contiguous substring of s containing all three types of characters at least once. If there is no such substring, print 0 instead.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;3
    3
    4
    4
    0
    0
    4
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;two-pointers&quot;&gt;Two pointers&lt;/h2&gt;
    &lt;p&gt;We can start with two pointers; left and right. Index array is used to keep track of the frequency of each occurrence of characters in string s. We can safely increment left pointer till index[s[left]] is greater than 1. The output is the minimum value of the window (right - left + 1);&lt;/p&gt;
    &lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;/h2&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java2&quot;&gt;&lt;a href=&quot;#Java2&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python2&quot;&gt;&lt;a href=&quot;#Python2&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java2&quot; id=&quot;Java2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/08e86c62a3467e2e7566d1260abcfd70.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python2&quot; id=&quot;Python2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/67482f38af954634a068f51fbef2eb63.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;complexity&quot;&gt;Complexity&lt;/h2&gt;
    &lt;p&gt;Time Complexity is &lt;strong&gt;$$\theta(n)$$&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Footnotes&lt;/h4&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://codeforces.com/problemset/problem/1354/B&quot; target=&quot;_blank&quot;&gt;Codeforces problem 1354 B&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-11-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/ternary-string-codeforces-solution</link>
<guid isPermaLink="true">https://randomwits.com/blog/ternary-string-codeforces-solution</guid>
</item>
<item>
  <title>Coin Change solution leetcode</title>
  <description>&lt;p&gt;It&apos;s one of the most popular questions on leetcode that seems very easy at first. Coin change is a classic dynamic programming problem. I will proceed with an obvious (albeit wrong) solution and subsequently proceed to an efficient correct solution.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;It&apos;s one of the most popular questions on leetcode that seems very easy at first. Coin change is a classic dynamic programming problem. I will proceed with an obvious (albeit wrong) solution and subsequently proceed to an efficient correct solution.&lt;/p&gt;
    &lt;h2 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h2&gt;
    &lt;p&gt;You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. You may assume that you have an infinite number of each kind of coin.&lt;/p&gt;
    &lt;h2 id=&quot;greedy-solution&quot;&gt;Greedy Solution&lt;/h2&gt;
    &lt;p&gt;My first instinct is to sort the coins array. Pick the largest coin first and then subtract the largest possible value from the amount. Subsequently, proceed with smaller denominations while keeping track of the count.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/82d9dfdf52f92c4f38bfb559221c4b0f.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d5d258b7fcba9b731d37ac23dcc6cb65.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;However this solution fails the following test case as the minimum sequence is [8, 4]&lt;/strong&gt;&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;coins &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1, 2, 4, 8, 9]
    amount &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 12
    Output : 3
    Expected: 2
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;dynamic-programming&quot;&gt;Dynamic Programming&lt;/h2&gt;
    &lt;p&gt;We have to find some subproblem that will help in solving coin-change problem. Given an amount n, we want to generate an exact change using the fewest number of coins of denominations d&lt;sub&gt;1&lt;/sub&gt; &amp;lt; d&lt;sub&gt;2&lt;/sub&gt; &amp;lt; … &amp;lt; d&lt;sub&gt;m&lt;/sub&gt;.&lt;/p&gt;
    &lt;p&gt;Let Dp(n) represent the minimum number of coins required for a given amount n. Coins d&lt;sub&gt;j&lt;/sub&gt; can be added to amount n - d&lt;sub&gt;j&lt;/sub&gt; only if d&lt;sub&gt;j&lt;/sub&gt; &amp;lt;= n and 0 &amp;lt;= j &amp;lt;= n -1 wher Dp(0) is 0.&lt;/p&gt;
    &lt;p&gt;\begin{equation}
    Dp(n) = \min_{j=0}^{d_j&amp;lt;=n} Dp(n - D_j) + 1
    \end{equation}&lt;/p&gt;
    &lt;p&gt;Let us proceed with following test case&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;coins &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1, 2, 5]
    amount &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 11
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can vary the amount as i from 0 to amount. The value of Dp[i] for each iteration becomes&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt; &lt;/th&gt;
    &lt;th&gt;*0*&lt;/th&gt;
    &lt;th&gt;*1*&lt;/th&gt;
    &lt;th&gt;*2*&lt;/th&gt;
    &lt;th&gt;*3*&lt;/th&gt;
    &lt;th&gt;*4*&lt;/th&gt;
    &lt;th&gt;*5*&lt;/th&gt;
    &lt;th&gt;*6*&lt;/th&gt;
    &lt;th&gt;*7*&lt;/th&gt;
    &lt;th&gt;*8*&lt;/th&gt;
    &lt;th&gt;*9*&lt;/th&gt;
    &lt;th&gt;*10*&lt;/th&gt;
    &lt;th&gt;*11*&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 1&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 2&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 3&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 4&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 5&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 6&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 7&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 8&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 9&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 10&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;i = 11&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java2&quot;&gt;&lt;a href=&quot;#Java2&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python2&quot;&gt;&lt;a href=&quot;#Python2&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java2&quot; id=&quot;Java2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/8518f5b023dacdfac1381756ff099883.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python2&quot; id=&quot;Python2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/108a8677ef861d8af291671ff7d25708.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;h2 id=&quot;complexity&quot;&gt;Complexity&lt;/h2&gt;
    &lt;p&gt;Time Complexity is &lt;strong&gt;$$\theta(n * m)$$&lt;/strong&gt;, Space complexity is &lt;strong&gt;$$\theta(n)$$&lt;/strong&gt;&lt;/p&gt;
  </description>
  <pubDate>2021-11-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/coin-change-leetcode-solution</link>
<guid isPermaLink="true">https://randomwits.com/blog/coin-change-leetcode-solution</guid>
</item>
<item>
  <title>Dear Vishi, is snoring innocuous?</title>
  <description>&lt;p&gt;I was an intern working in &lt;a href=&quot;https://en.wikipedia.org/wiki/Upstate_New_York&quot; target=&quot;_blank&quot;&gt;Upstate New York&lt;/a&gt;. Public transport required hopping multiple trains &amp;amp; buses and was woefully tedious. I found some other interns who were willing to split the fare with me for Uber. Even a ride in Uber consumed more than two hours. Occasionally I used to steal a quick nap. After a siesta of a few hours, I had always woken up with a gaggle of laughter. My peers often pulled my leg, &quot;You were snoring like a pig&quot;. However, I dismissed my faux pas as just a mere nuisance.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2021-10-01-dear-vishi-snoring.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;
    &lt;!--begin_of_post --&gt;&lt;/p&gt;
    &lt;p&gt;I was an intern working in &lt;a href=&quot;https://en.wikipedia.org/wiki/Upstate_New_York&quot; target=&quot;_blank&quot;&gt;Upstate New York&lt;/a&gt;. Public transport required hopping multiple trains &amp;amp; buses and was woefully tedious. I found some other interns who were willing to split the fare with me for Uber. Even a ride in Uber consumed more than two hours. Occasionally I used to steal a quick nap. After a siesta of a few hours, I had always woken up with a gaggle of laughter. My peers often pulled my leg, &quot;You were snoring like a pig&quot;. However, I dismissed my faux pas as just a mere nuisance.&lt;/p&gt;
    &lt;p&gt;Recently I was listening to a clubhouse talk about snoring&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. I always believed that snoring was innocuous. However, I learned that snoring might be a symptom of a disorder like sleep apnea. Since most of us snore or are more likely to snore in the later part of our lives, it would be prudent to delve deeper into the understanding of snoring.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/Dos9r5p.jpeg&quot; alt=&quot;Snoring image&quot; width=&quot;500&quot; height=&quot;400&quot; /&gt;
    &lt;figure&gt;Image courtesy ~ deviantart.com&lt;/figure&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h2 id=&quot;how-does-breathing-works&quot;&gt;How does breathing works?&lt;/h2&gt;
    &lt;p&gt;Most of the cells in our body require oxygen for cellular respiration. Cells use oxygen to break down sugar to create a molecule called ATP or adenosine triphosphate. ATP is often called nature&apos;s batteries. Cells get energy by breaking down ATP.&lt;/p&gt;
    &lt;p&gt;During breathing, the air flows from our nose (or mouth) into our lungs. Please see the image below.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://healthysleep.med.harvard.edu/_i/278.jpg&quot; alt=&quot;breathing image&quot; /&gt;
    &lt;figure&gt;Image courtesy ~ Healthysleep.med.harvard.edu&lt;/figure&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h2 id=&quot;what-causes-snoring&quot;&gt;What causes snoring?&lt;/h2&gt;
    &lt;p&gt;Snoring is simply a vibration caused by breathing. The vibrations are the result of a partially blocked airway in the mouth, nose, or throat. Not all people who snore have sleep apnea, but all people who have sleep apnea snores.&lt;/p&gt;
    &lt;p&gt;Sleep apnea causes a person to have multiple pauses in their breathing patterns during sleep. When we sleep, the muscles in the roof of our mouth (the soft palate), tongue, throat relaxes. If the tissue in the throat can relax enough then it may partially block the airway and vibrate.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://healthysleep.med.harvard.edu/_i/280.jpg&quot; alt=&quot;breathing image&quot; /&gt;
    &lt;figure&gt;Image courtesy ~ Healthysleep.med.harvard.edu&lt;/figure&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;When sufficient air doesn&apos;t oxygen get into the lungs, the level of oxygen in the blood will fall leading to the increase in the level of carbon dioxide. The brain will force the person to wake up again and again without the person aware of repeated awakenings. Sleep apnea not only disrupts sleep, but also lead to &lt;strong&gt;morning headaches, daytime sleepiness, &amp;amp; can lead to risk factor for high blood pressure, coronary artery disease, stroke, insulin resistance, and diabetes.&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Probably this might be a reason why I am  so grumpy in the morning 🤔.&lt;/p&gt;
    &lt;h2 id=&quot;remedy&quot;&gt;Remedy&lt;/h2&gt;
    &lt;p&gt;Excess weight creates fat deposits in a person’s neck called pharyngeal fat. Pharyngeal fat can block a person’s upper airway during sleep when the airway is already relaxed. Thus exercising and weight loss will help in improving sleep apnea.&lt;/p&gt;
    &lt;p&gt;Also alcohol consumption contribute to lowest oxygen saturation (LSAT) which is linked to worsening severity of snoring. It might be also helpful in getting evaluated by a doctor for sleep apnea.&lt;/p&gt;
    &lt;p&gt;So is snoring innocuous? Probably not.&lt;/p&gt;
    &lt;!--end_of_post --&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://ios.clubhouse.com/join/medtechclub/FChPjaHX/xerbkvqY&quot; target=&quot;_blank&quot;&gt;Clubhouse&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-10-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-snoring</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-snoring</guid>
</item>
<item>
  <title>Dear Vishi, does a virus poop?</title>
  <description>&lt;p&gt;When the alarm clock breaks my slumber, I roll down on my bed, blindly crawling towards my alarm clock as if it was a bomb to diffuse it. After multiple snoozes, I relinquished my dreams and come to my senses. Gulping water after I wake up is my first activity. Next, I excuse myself to the bathroom for “nature call”. All living things from a simple bacteria to a giant dinosaur needs to perform two basic life function; eat and excrete.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2021-09-16-dear-vishi-virus-poop.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;!--begin_of_post --&gt;
    &lt;p&gt;When the alarm clock breaks my slumber, I roll down on my bed, blindly crawling towards my alarm clock as if it was a bomb to diffuse it. After multiple snoozes, I relinquished my dreams and come to my senses. Gulping water after I wake up is my first activity. Next, I excuse myself to the bathroom for “nature call”. All living things from a simple bacteria to a giant dinosaur needs to perform two basic life function; eat and excrete.&lt;/p&gt;
    &lt;p&gt;Our world has been ravaged by covid pandemic recently. So it would be apt to talk about viruses. As a child, my imagination often ran wild, wondering how viruses hijacked our bodies, and more importantly did they eat and poop like other microbes?&lt;/p&gt;
    &lt;h2 id=&quot;whats-a-virus&quot;&gt;What&apos;s a virus?&lt;/h2&gt;
    &lt;p&gt;It’s a bundle of genetic material (RNA or DNA) wrapped in a protein capsule called capsids. It&apos;s different than other microbes like single cellular organisms. For example bacteria is a free-living cell which can survive inside or outside of a body. Outside the body, viruses look like just a lifeless collection of molecule.&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Antonie_van_Leeuwenhoek&quot;&gt;Van Leeuwenhoek&lt;/a&gt; is often noted as &lt;strong&gt;&quot;father of microbiology&quot;&lt;/strong&gt;. He was able to observe many microbes like bacteria around 1676 using single-lensed microscope. However viruses are 100 times smaller than bacteria usually in the range of 100 nanometer. Visible light has a wavelength of 400-700 nanometer. So we cannot see any object less than half of the wavelength of light. So anything smaller than 200-350 nanometer is not visible under optical microscope. Hence electron microscope are used to probe the structure of a virus.&lt;/p&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://www.researchgate.net/profile/Pedro-Junger/publication/344394476/figure/fig1/AS:940202503725056@1601173153039/Viruses-are-extremely-small-20-200-nm-smaller-than-bacterial-cells-1000-nm-which.png&quot; alt=&quot;breathing image&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h2 id=&quot;are-virus-living&quot;&gt;Are virus living?&lt;/h2&gt;
    &lt;p&gt;Viruses are notorious for living a twin life. Outside the host cell, viruses are at best not alive. They can&apos;t grow, reproduce, metabolize or maintain a constant internal temperature. They don&apos;t need nutrition and thus have no excretion. So viruses can’t poop, unlike bacteria.&lt;/p&gt;
    &lt;p&gt;However something remarkable thing happens when a virus invades a host cell. It hijacks the cellular process to produce a virally encoded protein that will replicate the virus’s genetic material. So it does resemble a living entity.&lt;/p&gt;
    &lt;p&gt;Due to this disparity, scientists often describe viruses as &lt;strong&gt;&quot;organisms at the edge of life&quot;&lt;/strong&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;can-a-virus-die&quot;&gt;Can a virus die?&lt;/h2&gt;
    &lt;p&gt;Do viruses die? A virus cannot die outside the host since they are not alive. However, its capsid can degrade in the environment which ultimately makes the virus inactive. Inside our bodies, we have specialized T cells (white blood cells) that circulate looking for cells that are infected with viruses. Cytotoxic T cells kill cells that are infected with viruses. They recognize an antigenic peptide bonded to an infected cell.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/P3t5Lf2.png&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
    &lt;p&gt;There are many hypothesis regarding origin of viruses like &lt;strong&gt;escaped hypothesis&lt;/strong&gt; which describes viruses as RNA or DNA fragments which escaped from cells. Another hypothesis like &lt;strong&gt;virus-first&lt;/strong&gt; suggest that viruses predates singled cell organisms. Viruses were simple self replicating RNA molecule with enzymatic activities. Sadly virus cannot leave physical fossils since viruses persist for short duration in environment. The only footprint persist are that of those viruses which invade the genome of the host. So origin of viruses is still shrouded in mystery.&lt;/p&gt;
    &lt;p&gt;Viruses are the most sophisticated parasites that infects all living things. However not all viruses are bad for humans. Bacteriophages viruses usually found on mucus membrane lining in the digestive, respiratory and reproductive tracts. They destroy specific bacteria thus boosting immune system. However certain bacteria has developed &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/CRISPR&quot;&gt;CRISPR-Cas9&lt;/a&gt;&lt;/strong&gt; adaptive response system to protect against bacteriophages. This fortunate stroke of discovery has now enabled scientist to use Cas9 enzyme as a &lt;strong&gt;&quot;molecular&quot;&lt;/strong&gt; swiss knife to alter a specific part of genome.&lt;/p&gt;
    &lt;p&gt;Science has enabled humans to escape the perilous life of the cave and settle into modern human civilization. The comforts of modern human civilization offer us protection from predators like lions or wolves. Humans in modern cities no longer fear being devoured by giant predators but are vulnerable from invisible minuscule cellular and acellular microorganisms. Winning an &lt;strong&gt;arm race&lt;/strong&gt; against viruses for humans still appears to be a far-fetched dream.&lt;/p&gt;
    &lt;!--end_of_post --&gt;
  </description>
  <pubDate>2021-09-16T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-virus-poop</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-virus-poop</guid>
</item>
<item>
  <title>Maximum Subarray</title>
  <description>&lt;p&gt;There&apos;s an interesting problem I recently solved on leetcode based on dynamic programming. My &lt;a href=&quot;https://github.com/tushar-sharma/prep-coding&quot; target=&quot;_blank&quot;&gt;Github&lt;/a&gt; repository contains list of all problems that I have solved. I often start with a brute force approach without fretting about time complexity. Later I try to improve my algorithm for a better efficient solution.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/multipleTab.css&quot; /&gt;
    &lt;script src=&quot;/js/jquery.easytabs.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;/js/multipleTab.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;There&apos;s an interesting problem I recently solved on leetcode based on dynamic programming. My &lt;a href=&quot;https://github.com/tushar-sharma/prep-coding&quot; target=&quot;_blank&quot;&gt;Github&lt;/a&gt; repository contains list of all problems that I have solved. I often start with a brute force approach without fretting about time complexity. Later I try to improve my algorithm for a better efficient solution.&lt;/p&gt;
    &lt;p&gt;Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A subarray is a contiguous part of an array.&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h3 id=&quot;brute-force-algorithm&quot;&gt;Brute force algorithm&lt;/h3&gt;
    &lt;p&gt;We can commence with a brute force algorithm. For every element of array, we compare its sum with the rest of the element to calculate maximum sum.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://i.imgur.com/WHMSDtu.png&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java1&quot;&gt;&lt;a href=&quot;#Java1&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java1&quot; id=&quot;Java1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/5fab75b08c891f6e2ca958b2338c369d.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d8c221cf6eb1f4c8abd85c625127a9c1.js&quot;&gt;&lt;/script&gt;   
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;Time complexity is &lt;b&gt;O(n&lt;sup&gt;2&lt;/sup&gt;)&lt;/b&gt; and has &lt;strong&gt;Time Limit Exceeded&lt;/strong&gt; on leetcode.&lt;/p&gt;
    &lt;h3 id=&quot;more-efficient-solution&quot;&gt;More efficient solution&lt;/h3&gt;
    &lt;p&gt;We can use &lt;a href=&quot;https://en.wikipedia.org/wiki/Maximum_subarray_problem&quot;&gt;Kadane algorithm&lt;/a&gt; to solve. It scans the given array &lt;b&gt;A[1..n]&lt;/b&gt; from left to right. In the jth step, it computes the subarray with the largest sum ending at j; this sum is maintained in variable cSum. It computes the subarray with the largest sum anywhere in &lt;b&gt;A[1..j]&lt;/b&gt;, maintained in variable oSum;&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Java2&quot;&gt;&lt;a href=&quot;#Java2&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python2&quot;&gt;&lt;a href=&quot;#Python2&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Java2&quot; id=&quot;Java2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/e1bc03cd4bb10fe2739c8cbef11b2c47.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python2&quot; id=&quot;Python2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/d7ae08673b2170467d84fd1183ef2d34.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;The time complexity is &lt;b&gt;O(n&lt;sup&gt;&lt;/sup&gt;)&lt;/b&gt;.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Footnotes&lt;/h4&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://leetcode.com/problems/maximum-subarray/&quot; target=&quot;_blank&quot;&gt;Leetcode&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/tushar-sharma/prep-coding&quot; target=&quot;_blank&quot;&gt;Github Repository&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-09-12T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/maximum-subarray</link>
<guid isPermaLink="true">https://randomwits.com/blog/maximum-subarray</guid>
</item>
<item>
  <title>Bike Ride in Mexico City</title>
  <description>&lt;p&gt;This is my first time visiting Mexico city, also known as CDMX. Initially I was scared to come here because of Narcos. However during my brief two weeks stay I have felt safe. With my limited Spanish, I decided to book an &lt;a href=&quot;https://www.airbnb.co.in/experiences/102485&quot; target=&quot;_blank&quot;&gt;Airbnb experience&lt;/a&gt; for a bike tour.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;This is my first time visiting Mexico city, also known as CDMX. Initially I was scared to come here because of Narcos. However during my brief two weeks stay I have felt safe. With my limited Spanish, I decided to book an &lt;a href=&quot;https://www.airbnb.co.in/experiences/102485&quot; target=&quot;_blank&quot;&gt;Airbnb experience&lt;/a&gt; for a bike tour.&lt;/p&gt;
    &lt;p&gt;The tour had a meeting point at Bazar Fusion. Uber is cheap &amp;amp; convenient to commute in Mexico city. On reaching at Bazar Fusion, I had a cappuccinos before hopping on to the bike. The bike was  comfortable enough with no helmet which I didn&apos;t mind.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://i.imgur.com/wNay8o5.jpeg&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Our first stop was Mercado Medellín. It&apos;s a public market in Colonia Roma. We stopped at a juice shop. I had a juice which had pineapple, cactus, celery, etc. This was the first time I had a cactus drink. Cactus is also called Nopal in Spanish. It looked something like this&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://www.aspicyperspective.com/wp-content/uploads/2020/05/jugo-verde-recipe-11-650x946.jpg&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Next we rode to Parque Mexico. It&apos;s a large urban park located in Colonia Hipódromo in the Condesa area of Mexico City. One of the main attraction is Fuente de los Cántaros (Fountain of the jugs). It&apos;s a sculpture of an indigenous women.&lt;/p&gt;
    &lt;!-- ![img](https://i.imgur.com/UIQTx2g.jpeg) --&gt;
    &lt;p&gt;Lastly we went to Bosque de Chapultepec. It&apos;s one of the largest city parks largest in both Mexico City as well as Latin America. I saw the Monumento a los Niños Héroes. It&apos;s a monument to honor six Mexican military cadets during Mexican-American war in the battle of Chapultepec.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://i1.wp.com/mas-mexico.com.mx/wp-content/uploads/2021/05/53cb9a94dc496de08232ab0ec78a7d79.jpg?resize=1500%2C500&amp;amp;ssl=1&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;There were also other attractions in the park&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://i.imgur.com/9Ov0axF.jpg&quot; alt=&quot;img&quot; /&gt;
    &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://i.imgur.com/NEn0AH4.jpeg&quot; alt=&quot;img&quot; /&gt;
    &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://i.imgur.com/is5Nfc3.jpg&quot; alt=&quot;img&quot; /&gt;
    &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://i.imgur.com/ykzzza5.jpg&quot; alt=&quot;img&quot; /&gt;
    &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;We also stopped in between to devour local Mexican food. I really enjoyed the tacos with fries. Below is the snapshot of my route&lt;/p&gt;
    &lt;center&gt;
    &lt;a href=&quot;https://connect.garmin.com/modern/activity/7177614007&quot; target=&quot;_blank&quot;&gt;
    &lt;img src=&quot;https://i.imgur.com/Dgrkc8q.png&quot; /&gt;
    &lt;/a&gt;
    &lt;/center&gt;
  </description>
  <pubDate>2021-07-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/bike-ride-mexico-city</link>
<guid isPermaLink="true">https://randomwits.com/blog/bike-ride-mexico-city</guid>
</item>
<item>
  <title>Dear Vishi, have you seen a ghost?</title>
  <description>&lt;p&gt;Do you believe in ghosts? I did when I was a kid. I was infatuated with the paranormal. Sometimes I used to wander around desolate buildings with other kids concocting horror stories. I loquaciously gossiped about ghosts in school which earned me a sizeable audience. I was convinced that someday I would stumble upon an innocuous spirit that would instill some unearthly powers in me.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;style&gt;
    table, td, th {  
    border: 1px solid #ddd;
    text-align: center;
    }
    table {
    border-collapse: collapse;
    width: 100%;
    }
    th, td {
    padding: 15px;
    }
    &lt;/style&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://i.guim.co.uk/img/media/60f0739487bf289799b3e11daa66f1ba44da2562/1_0_2559_1536/master/2559.jpg?width=465&amp;amp;quality=45&amp;amp;auto=format&amp;amp;fit=max&amp;amp;dpr=2&amp;amp;s=69e9fa34d8a6e6f773d94d6658ca4dc4&quot; alt=&quot;ghost&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Do you believe in ghosts? I did when I was a kid. I was infatuated with the paranormal. Sometimes I used to wander around desolate buildings with other kids concocting horror stories. I loquaciously gossiped about ghosts in school which earned me a sizeable audience. I was convinced that someday I would stumble upon an innocuous spirit that would instill some unearthly powers in me.&lt;/p&gt;
    &lt;p&gt;Vic Tandy, a British engineer, was working at Warwick Laboratory when he thought he saw a ghost. He later said, &quot;I was sweating but cold, and the feeling of depression was noticeable – but there was also something else. It was as though something was in the room with me.&quot; He then claimed to have seen a spirit emerging in his peripheral vision, but when he turned to face the figure, it vanished&quot;. He later went home perplexed.&lt;/p&gt;
    &lt;p&gt;How you played a fencing match? It&apos;s an Olympic sport. Two competitors, each holding a weapon in one hand, face each other to strike their opponent on a valid target area of the body. The weapon is generally a foil blade. When a competitor hits his opponent it&apos;s called &quot;touché&quot;. This is the origin of the word &quot;touché&quot;. We can also use it to say when someone makes a witty remark.&lt;/p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://img.olympicchannel.com/images/image/private/t_16-9_360-203_2x/f_auto/v1538355600/primary/j7n3yaxfyi1voyxszsyu&quot; alt=&quot;fencing sport&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Vic Tandy returned to the research laboratory the next day. He was entering a fencing competition soon so he started working on his fencing foil. He noticed that the foil blade was vibrating even though nothing was touching it. How would you react when you experience something spooky? Our natural instinct is to fear or seek supernatural explanations.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;Extraordinary claims require extraordinary evidence” - &lt;strong&gt;Carl Sagan&lt;/strong&gt;&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;Vic Tardy began investigation for a rational explanation of this spookiness. He found that the newly installed extractor fan at his research laboratory was producing a sound wave of 19 Hz. He discovered that this low frequency sound wave was responsible for physiological effects, including feelings of fear and shivering. If we cannot hear sound less than 20 Hz frequency, why does it have an adverse effect on our psychology?&lt;/p&gt;
    &lt;p&gt;Sound is a type of wave which are caused by vibrations in the air. The source of sound creates pressure changes which creates a pressure wave. A sound wave has two characteristics&lt;/p&gt;
    &lt;p&gt;1. &lt;b&gt;Amplitude&lt;/b&gt; : The amount of sound pressure is measured in decibles (db)&lt;/p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://s3-us-west-2.amazonaws.com/courses-images-archive-read-only/wp-content/uploads/sites/222/2014/12/20105352/Figure_18_03_01ab.jpg&quot; alt=&quot;sound wave spectrum&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;2. &lt;b&gt;Frequency&lt;/b&gt;:  Number of vibrations per second. Meaured in Hertz ( 1 Hz = 1 vibration per second).  Humans can hear sound waves between 20 Hz and 20,000 Hz.&lt;/p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/gVBQiHT.png&quot; alt=&quot;sound wave spectrum&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;Most of us are familiar with Noise pollution. The blaring sound of a loudspeaker, the cacophony of the wedding,  the persistent honking, or the hurly-burly of daily life sometimes arrest the tranquility of the neighborhood. Noise intensity is measured in decibel unit (dB) which measures sound pressure level (SPL). Usually, sounds above 85 dB are considered harmful depending upon exposure time. Here&apos;s a quick lookup for noise level&lt;/p&gt;
    &lt;table&gt;
    &lt;tr&gt;
    &lt;th&gt;
    Source
    &lt;/th&gt;
    &lt;th&gt;
    Decibel
    &lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    Whisper
    &lt;/td&gt;
    &lt;td&gt;
    15 db
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    Normal conversation
    &lt;/td&gt;
    &lt;td&gt;
    60 db
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    Alarm clock
    &lt;/td&gt;
    &lt;td&gt;
    80 db
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    Drill
    &lt;/td&gt;
    &lt;td&gt;
    95 db
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    Rock band
    &lt;/td&gt;
    &lt;td&gt;
    110 db
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    Jet engine
    &lt;/td&gt;
    &lt;td&gt;
    140 db
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;p&gt;Infrasound refers to sound with a frequency of sound less than 20 Hertz. It&apos;s rarely considered a source of noise pollution. While it is imperceptible to our ears, it can still send false signals to our brain, causing dizziness, vertigo, and nausea, along with cognitive and memory deficits, anxiety, and panic attacks. People living near the vicinity of wind turbines often complain of annoyance, psychological stress, and other health complaints due to the infrasound it generates.&lt;/p&gt;
    &lt;p&gt;Professor &lt;a href=&quot;https://en.wikipedia.org/wiki/Richard_Wiseman&quot;&gt;Richard Wiseman&lt;/a&gt; has suggested that the presence of infrasound can cause people to feel the sensation of ghosts.  However, as humans, we are blind to many things in the universe. We can&apos;t see ultraviolet light like bees, infrared light like snakes, or sense magnetic fields like pigeons. However, our brains often remedy our physical shortcomings.&lt;/p&gt;
    &lt;p&gt;Pierre-Simon Laplace, was a great French mathematician. He once presented his model of the solar system to Napolean. Napolean asked him why his celestial mechanics made no mention of God. He replied, &quot;Your Highness, I have no need of this hypothesis&quot;.&lt;/p&gt;
    &lt;p&gt;There are still many mysteries in the universe. However, if history is proof, every riddle is debunked by science using natural causes without any divine intervention. The only ingredient to solving the mystery is a curious rational mind.&lt;/p&gt;
  </description>
  <pubDate>2021-06-27T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-have-you-seen-ghost</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-have-you-seen-ghost</guid>
</item>
<item>
  <title>Automate creation of AWS Stack</title>
  <description>&lt;style&gt;
    table, td, th {  
    border: 1px solid #ddd;
    text-align: center;
    }
    table {
    border-collapse: collapse;
    width: 100%;
    }
    th, td {
    padding: 15px;
    }
    &lt;/style&gt;
    &lt;p&gt;&lt;a href=&quot;https://aws.amazon.com/cdk/&quot; target=&quot;_bank&quot;&gt;AWS CDK&lt;/a&gt; is a great framework to programmatically deploy cloudformation stack. If you are unfamiliar with AWS CDK, I would recommend first to check out &lt;a href=&quot;http://randomwits.com/blog/tutorial-cdk-aws&quot;&gt;Getting started with AWS CDK&lt;/a&gt;.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;https://aws.amazon.com/cdk/&quot; target=&quot;_bank&quot;&gt;AWS CDK&lt;/a&gt; is a great framework to programmatically deploy cloudformation stack. If you are unfamiliar with AWS CDK, I would recommend first to check out &lt;a href=&quot;http://randomwits.com/blog/tutorial-cdk-aws&quot;&gt;Getting started with AWS CDK&lt;/a&gt;.&lt;/p&gt;
    &lt;p&gt;One of the pet peeves I have while designing &lt;a href=&quot;https://aws.amazon.com/cloudformation/&quot; target=&quot;_blank&quot;&gt;cloudformation&lt;/a&gt; template is redundancy. I have to manually copy-paste the same properties across multiple resources. I wanted to leverage AWS CDK to create an interface that would allow tto dynamically create cloudformation. For the interface, I harked back to the good old CSV file.&lt;/p&gt;
    &lt;p&gt;For a simple example, let&apos;s consider a simple cloudformation template&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Parameters:
    Environment:
    Type: String
    Default: dev
    AllowedValues:
    - dev
    - qa
    - prod
    Description: Enter your environment
    Project:
    Type: String
    Default: version
    Description: Enter your version
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;What if we have to maintain 100 parameters, resources, etc in our project. Soon it will become tedious to maintain multiple resources. Instead, we create a class called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Parameter&lt;/code&gt; that we instantiate multiple times using different parameters. Here is a class diagram for our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Parameter&lt;/code&gt; class.&lt;/p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/XnSkPM5.png&quot; alt=&quot;class diagram&quot; /&gt;  
    &lt;/center&gt;
    &lt;p&gt;Using typescript, we can define the class as&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/ba6ca7d009513cc3ddb0bc7105cc0aa2.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;We will create a `CSV` file under folder `resources`  which would contain information for each instance of our class.&lt;/p&gt;
    &lt;table&gt;
    &lt;tr&gt;
    &lt;th&gt;resource&lt;/th&gt;
    &lt;th&gt;create&lt;/th&gt;
    &lt;th&gt;category&lt;/th&gt;
    &lt;th&gt;default&lt;/th&gt;
    &lt;th&gt;description&lt;/th&gt;
    &lt;th&gt;allowed_values&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Environment&lt;/td&gt;
    &lt;td&gt;yes&lt;/td&gt;
    &lt;td&gt;parameter&lt;/td&gt;
    &lt;td&gt;dev&lt;/td&gt;
    &lt;td&gt;Enter your environment&lt;/td&gt;
    &lt;td&gt;dev | qa | prod&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Project&lt;/td&gt;
    &lt;td&gt;yes&lt;/td&gt;
    &lt;td&gt;parameter&lt;/td&gt;
    &lt;td&gt;version1&lt;/td&gt;
    &lt;td&gt;Enter version&lt;/td&gt;
    &lt;td&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;p&gt;First, we will read our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CSV&lt;/code&gt; file into our project. We would need to install an additional library to read the file.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;npm i &lt;span class=&quot;nt&quot;&gt;--save&lt;/span&gt; csvtojson
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We will edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib/project_cdk-stack.ts&lt;/code&gt; file.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/b541b614e6be8502c95f460ecdf2dd37.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Then we will create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib/helpers.ts&lt;/code&gt; file.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/4a080d416faf980b71723bdce21feb66.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Our code till now will not generate any cloudformation. However, we can test it for any compile errors&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cdk synth &lt;span class=&quot;nt&quot;&gt;--quiet&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next, we will implement our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;generateTemplate&lt;/code&gt; function.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/8cb4e903d0ca972ecaac81f7de042704.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Lastly, we can deploy our cloudformation stack using&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cdk deploy
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;In the next article, we will update our code to add additional classes to handle &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;resources&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;output&lt;/code&gt;, etc for our cloudformation template.&lt;/p&gt;
  </description>
  <pubDate>2021-06-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/interface-aws-cdk</link>
<guid isPermaLink="true">https://randomwits.com/blog/interface-aws-cdk</guid>
</item>
<item>
  <title>Getting Started with AWS CDK</title>
  <description>&lt;p&gt;Cloudformation service in AWS allows you to describe an entire set of resources required to make a pipeline. The cloudformation template can be described in JSON or YAML format. Updating the cloudformation template was not a pleasant experience. I wanted to discover alternative ways to generate cloudformation template programmatically.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/chat.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/multipleTab.css&quot; /&gt;
    &lt;script src=&quot;/js/jquery.easytabs.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;/js/multipleTab.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Cloudformation service in AWS allows you to describe an entire set of resources required to make a pipeline. The cloudformation template can be described in JSON or YAML format. Updating the cloudformation template was not a pleasant experience. I wanted to discover alternative ways to generate cloudformation template programmatically.&lt;/p&gt;
    &lt;p&gt;The CDK library provides you a way to declare the resources in your favorite languages like Java, Javascript, Typescript, and Python. In this tutorial, we will use &lt;strong&gt;typescript and python&lt;/strong&gt; to generate our cloudformation template.&lt;/p&gt;
    &lt;h2 id=&quot;before-we-begin&quot;&gt;Before we begin&lt;/h2&gt;
    &lt;p&gt;Just a quick referesher to few concepts before we delve into AWS CDK&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Cloudformation&lt;/strong&gt; template describes AWS resources. A running instance of cloudformation is called a stack.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Constructs&lt;/strong&gt; are the basic building blocks of AWS CDK apps.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;L1 construct&lt;/strong&gt; are named CfnXyz, where Xyz is name of the resource. They are low-level construct which directly represent cloudformation resources.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;L2 construct&lt;/strong&gt; provide common boilerplates and glue logic. These will come with convenient defaults and reduces the amount of knowledge you need to know about them.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;L3 construct&lt;/strong&gt; are called high-level patterns. These constructs are designed to help you complete common tasks in AWS, often involving multiple kinds of resources.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    &lt;i style=&quot;color: red; &quot; class=&quot;fas fa-exclamation&quot;&gt;&lt;/i&gt;
    For this tutorial, we will use L1 construct. However same concept can be used for L2 construct.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
    &lt;p&gt;First, install the AWS CDK CLI from command line using&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;npm i &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; aws-cdk@latest
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Let&apos;s create a project&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Typescript1&quot;&gt;&lt;a href=&quot;#Typescript1&quot;&gt;Typescript&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python1&quot;&gt;&lt;a href=&quot;#Python1&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Typescript1&quot; id=&quot;Typescript1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=initial1.sh&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python1&quot; id=&quot;Python1&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=initial2.sh&quot;&gt;&lt;/script&gt;   
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;Then you can verify&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=cdk-doctor.sh&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;For our first use case, will add Parameters to our cloudformation. We need to edit file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib\test-cdk-stack.ts&lt;/code&gt; for typescript or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib\test_cdk_stack.py&lt;/code&gt; for python.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Typescript2&quot;&gt;&lt;a href=&quot;#Typescript2&quot;&gt;Typescript&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python2&quot;&gt;&lt;a href=&quot;#Python2&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Typescript2&quot; id=&quot;Typescript2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=test-cdk-stack.ts&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python2&quot; id=&quot;Python2&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=test_cdk_stack.py&quot;&gt;&lt;/script&gt;   
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;We can see the output of the cloudformation template by using the following command&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cdk synth
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you want to generate cloudformation template without metadata&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cdk synth &lt;span class=&quot;nt&quot;&gt;--version-reporting&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--path-metadata&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt; 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The output is&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=synth_output1.yaml&quot;&gt;&lt;/script&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    For CDK v2, CheckBootstrapVersion rule is added to the Stack&apos;s template as a safety check, to verify that the bootstrap stack in the target environment meets the minimum requirements of the current stack&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;stepfunction&quot;&gt;Stepfunction&lt;/h2&gt;
    &lt;p&gt;The cloudformation template needs at least one resource to validate. We will add a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stepfunction&lt;/code&gt; to our cloudformation. We will define our stepfunction inside a json file, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;helloworld.asl.json&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Comment&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;A very very simple StepFunction&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;StartAt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; 
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;States&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Wait&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Seconds&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Next&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;World&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;World&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Pass&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;End&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you are not familiar with Stepfunction, AWS Stepfunction console has a nice visualization&lt;/p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://docs.aws.amazon.com/step-functions/latest/dg/images/tutorial-getting-started-visual-pane-render.png&quot; alt=&quot;stepfunction image&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Next we need to upload the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;helloworld.asl.json&lt;/code&gt; to s3 bucket. We also need to define a mapping to access this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;json&lt;/code&gt; file.&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Typescript3&quot;&gt;&lt;a href=&quot;#Typescript3&quot;&gt;Typescript&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python3&quot;&gt;&lt;a href=&quot;#Python3&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Typescript3&quot; id=&quot;Typescript3&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=test-cdk-stack2.ts&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python3&quot; id=&quot;Python3&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=test_cdk_stack2.py&quot;&gt;&lt;/script&gt;   
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Our output will still be the same since our mapping is &lt;strong&gt;lazy&lt;/strong&gt;. Next, we will add stepfunction to our resources&lt;/p&gt;
    &lt;div class=&quot;tab-container&quot;&gt;
    &lt;ul&gt;
    &lt;li class=&quot;tab Typescript4&quot;&gt;&lt;a href=&quot;#Typescript4&quot;&gt;Typescript&lt;/a&gt;&lt;/li&gt;
    &lt;li class=&quot;tab Python4&quot;&gt;&lt;a href=&quot;#Python4&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class=&quot;codeSample Typescript4&quot; id=&quot;Typescript4&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=test-cdk-stack3.ts&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
    &lt;div class=&quot;codeSample Python4&quot; id=&quot;Python4&quot;&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=test_cdk_stack3.py&quot;&gt;&lt;/script&gt;   
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;p&gt;The final cloudformation template is&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/167a194b3e9258d39e176905a6788d9b.js?file=synth_output2.yaml&quot;&gt;&lt;/script&gt;
    &lt;p&gt;The cloudformation template is generated under&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# for typescript
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cdk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;out&lt;/span&gt;\&lt;span class=&quot;n&quot;&gt;TestCdkStack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# for python 
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cdk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;out&lt;/span&gt;\&lt;span class=&quot;n&quot;&gt;test_cdk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Or you can simply deploy it using&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cdk deploy
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Footnotes&lt;/h4&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/aws/aws-cdk/issues/17942&quot; target=&quot;_blank&quot;&gt;Github issues&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-06-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/tutorial-cdk-aws</link>
<guid isPermaLink="true">https://randomwits.com/blog/tutorial-cdk-aws</guid>
</item>
<item>
  <title>Dear Vishi, what if Dehradun was in Nepal?</title>
  <description>&lt;p&gt;What’s a nationality? The idea of the nation-state is pretty modern. Ancient lands were usually under the suzerainty of kings &amp;amp; queens. While most emperors spilled blood to expand their kingdom, the common man was seldom concerned about borders.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;What’s a nationality? The idea of the nation-state is pretty modern. Ancient lands were usually under the suzerainty of kings &amp;amp; queens. While most emperors spilled blood to expand their kingdom, the common man was seldom concerned about borders.&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Peace_of_Westphalia&quot;&gt;Peace of Westphalia&lt;/a&gt; was a famous peace treaty in 1648 that ended &lt;a href=&quot;https://en.wikipedia.org/wiki/Thirty_Years&apos;_War&quot;&gt;thirty years war&lt;/a&gt;. Historians often cite this as an example of first nation state. It relied on a system of independent states refraining from interference in each other&apos;s domestic affairs and checking each other&apos;s ambitions through a general equilibrium of power.&lt;/p&gt;
    &lt;p&gt;I was born in Dehradun, a valley crowned by the mountains of Mussoorie. &quot;A town called Dehra&quot; is a phrase immortalized by Ruskin Bond stories. Doon is a place that has nurtured us. We love Dehradun because we were born there &amp;amp; it dwells in our memories. Were we born in Albania, we would probably be romanticizing the streets of Albania.&lt;/p&gt;
    &lt;p&gt;The British had a war with Nepal from 1814 to 1816. Nepal lost the war &amp;amp; signed the Treaty of Sugauli. It ceded territory to the British which included Dehradun, Kumaun &amp;amp; Nainital. This was called &lt;strong&gt;Anglo-Nepalese War&lt;/strong&gt;. With the stroke of luck, Dehradun eventually became part of independent India.&lt;/p&gt;
    &lt;p&gt;Most of the boundaries in the world are man-made. Earth doesn&apos;t have any boundaries. It reminds me of an old Sanskrit phrase, &lt;strong&gt;Vasudhaiva Kutumbakam&lt;/strong&gt; which means the world is one family.&lt;/p&gt;
    &lt;p&gt;Nehru wrote about this in his book, Glimpses of World History-&lt;/p&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;&amp;quot;British had a war with Nepal. they won in the end, this district of Dehra Dun, where I sit in prison writing this letter, and Kumaun and Nainital came under British rule&amp;quot;-excerpt from “Glimpses of World History”, Nehru &lt;a href=&quot;https://t.co/XpkgW8pFif&quot;&gt;https://t.co/XpkgW8pFif&lt;/a&gt; &lt;a href=&quot;https://t.co/nU0rg8KfnF&quot;&gt;pic.twitter.com/nU0rg8KfnF&lt;/a&gt;&lt;/p&gt;&amp;mdash; Tushar Sharma (@tshrocks) &lt;a href=&quot;https://twitter.com/tshrocks/status/1403413729715408897?ref_src=twsrc%5Etfw&quot;&gt;June 11, 2021&lt;/a&gt;&lt;/blockquote&gt;
    &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Political tensions have been simmering between India and Nepal. In 2020, the Nepal government led by &lt;a href=&quot;https://en.wikipedia.org/wiki/KP_Sharma_Oli&quot;&gt;K P Sharma Oli&lt;/a&gt; introduced a constitutional amendment that made changes to the Nepali map. This includes areas that are currently under the sovereignty of India like Kalapani territory which is part of Pithoragarh district in the Uttarakhand state.&lt;/p&gt;
    &lt;p&gt;India &amp;amp; Nepal are both Hindu majority countries. They are still plagued by border disputes. Pakistan &amp;amp; Afghanistan are both Muslim majority countries. Yet both countries regularly engaged in skirmishes over &lt;a href=&quot;https://en.wikipedia.org/wiki/Durand_Line&quot;&gt;Durand line&lt;/a&gt;. Thirty Years&apos; War, one of the most destructive conflicts in European history, was between Catholics and Protestants (both Christians).&lt;/p&gt;
    &lt;p&gt;What can history teach us? That religion is never the binding force for cordial relationships and bonhomie among countries.&lt;/p&gt;
  </description>
  <pubDate>2021-06-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-dehradun-nepal</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-dehradun-nepal</guid>
</item>
<item>
  <title>Dear Vishi, what&apos;s a carcinogen?</title>
  <description>&lt;p&gt;If you are not living under a cave, you probably have already heard about carcinogens. News is often awash with headlines alerting perils of carcinogens. In a nutshell, these are substances that have the potential to cause cancer. Not all carcinogens cause cancer. Not all cancer is caused by carcinogens. Cancer is a complicated group of diseases. Of course, it’s not my forte to expound on the subject of cancer. However, we should try to understand how carcinogens are identified and what we should do to protect ourselves.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;If you are not living under a cave, you probably have already heard about carcinogens. News is often awash with headlines alerting perils of carcinogens. In a nutshell, these are substances that have the potential to cause cancer. Not all carcinogens cause cancer. Not all cancer is caused by carcinogens. Cancer is a complicated group of diseases. Of course, it’s not my forte to expound on the subject of cancer. However, we should try to understand how carcinogens are identified and what we should do to protect ourselves.&lt;/p&gt;
    &lt;p&gt;Cancer is pathological mitosis. The cells go bonkers where they have an insatiable urge to proliferate. Carcinogens have the potential to alter the genetic material of the cell. This genetic mutation sometimes can develop into cancer.&lt;/p&gt;
    &lt;h2 id=&quot;how-do-we-know-if-a-substance-is-a-carcinogen-or-not&quot;&gt;How do we know if a substance is a carcinogen or not?&lt;/h2&gt;
    &lt;p&gt;Earlier scientists use to test the substance on animals like rodents for a year or more to see if cancer develops. However, this process is both time-consuming &amp;amp; expensive. Since there a plethora of substances that need to be tested, there was a dire need to cheaply &amp;amp; quickly identify carcinogens.&lt;/p&gt;
    &lt;p&gt;Bruce Ames developed &lt;a href=&quot;https://en.wikipedia.org/wiki/Ames_test&quot;&gt;Ames test&lt;/a&gt;. It uses bacteria to test whether a substance can cause mutation. The premise is that mutation often causes cancer. Not all substances that cause mutation are carcinogenic e.g. nitrate compounds gives false positive since they produce nitric oxide. Also, some of the carcinogens may test negative e.g. Nitroethane. Thus Ames test is followed by additional experiments like animal testing to confirm carcinogenicity.&lt;/p&gt;
    &lt;h3 id=&quot;how-does-the-ames-test-work&quot;&gt;How does the Ames test work?&lt;/h3&gt;
    &lt;p&gt;Let’s say we take a strain of bacteria called Salmonella typhimurium on glucose-minimal salts agar plates. This strain has a mutation that cannot produce histidine (the amino acid is required in biosynthesis). Such bacteria are called auxotrophs since they cannot produce a required nutrient for their growth. This is unlike prototrophs which can synthesize the particular nutrient.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://cdn.britannica.com/24/123224-004-C1A4B848/Salmonella-typhimurium.jpg&quot; alt=&quot;Bacteria&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Small traces of histidine present on the plates aids the bacteria grow for several generations until histidine is exhausted, at which time they will stop growing.&lt;/p&gt;
    &lt;p&gt;Again we repeat the same experiment, but we will also add suspected mutagenic substances on the plates. If the substance is mutagenic, we can see the cluster of bacteria continue to grow even after histidine is exhausted. This is because the bacteria have a mutation that allows them to synthesize histidine.&lt;/p&gt;
    &lt;p&gt;So Ames test identifies if a substance can cause an auxotroph to revert to prototroph by back-mutation. But remember it has both false positives and false negatives.&lt;/p&gt;
    &lt;h2 id=&quot;meditation&quot;&gt;Meditation&lt;/h2&gt;
    &lt;p&gt;Today I meditated for 15 minutes using background &lt;a href=&quot;https://www.youtube.com/watch?v=WZKW2Hq2fks&amp;amp;list=LL&amp;amp;index=1&quot;&gt;music&lt;/a&gt; on Youtube. Music aids me in meditation. I know some people prefer to meditate in silence. &lt;strong&gt;Do nothing&lt;/strong&gt; is a difficult concept to grasp for my mind. I guess someday my mind won&apos;t wander during meditation. My mind often complains that wandering is not bad. It recites a famous poem&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;All that is gold does not glitter,&lt;br /&gt;
    Not all those who wander are lost;&lt;br /&gt;
    The old that is strong does not wither,&lt;br /&gt;
    Deep roots are not reached by the frost&quot; - J.R.R. Tolkien&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h2 id=&quot;treadmill&quot;&gt;Treadmill&lt;/h2&gt;
    &lt;p&gt;Today I resumed running on a treadmill. My body becomes lethargic if I skip even a single day. Stamina is something that needs to be built gradually. Below is a snapshot of my activity.&lt;/p&gt;
    &lt;center&gt;
    &lt;a target=&quot;_blank&quot; href=&quot;https://connect.garmin.com/modern/activity/6874324160&quot;&gt;
    &lt;img src=&quot;https://i.imgur.com/Wx29yMH.png&quot; /&gt;
    &lt;/a&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;I guess running on a treadmill is the best utilization of the time when India is under lockdown due to Covid-19. In Charlotte, I use to run on a trail. I prefer it more than running on a treadmill. The trail is covered with trees on both sides.&lt;/p&gt;
    &lt;p&gt;We should feel privileged that we can work from home during this Covid-19 pandemic. A vast number of people probably don’t have that privilege. I am not religiously inclined &amp;amp; don’t prefer dogmas like praying. However, if I had to pray, I would probably chant the following Sanskrit hymn.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;सर्वे भवन्तु सुखिनः सर्वे सन्तु निरामया,&lt;br /&gt;
    सर्वे भद्राणि पश्यन्तु मा कश्चिद् दुख भागभवेत।&lt;br /&gt;
    ऊँ शान्तिः शान्तिः शान्तिः &lt;br /&gt;&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;This loosely translates as&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;May all sentient beings be at peace, may no one suffer from illness &lt;br /&gt;
    May all see what is auspicious, may no one suffer. &lt;br /&gt;
    Om Peace, peace, peace.&lt;/p&gt;
    &lt;/blockquote&gt;
  </description>
  <pubDate>2021-05-31T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-what-is-carcinogen</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-what-is-carcinogen</guid>
</item>
<item>
  <title>Dear Vishi, can you meditate like a monk?</title>
  <description>&lt;p&gt;Today I tried to meditate again. I used Insight Timer app for background sound. However I think I&apos;ll just stick to Youtube as it has more varieties. I struggled for 20 minutes sitting cross-legged as my mind wandered in the labyrinth of thoughts. I guess it will take more practice to hone my skill. Have you ever wondered how monks can meditate for countless hours or days?&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    function changeImage(elem) {
    var imageUrl = elem.getAttribute(&apos;image&apos;);
    document.getElementById(&apos;imgview&apos;).setAttribute(&apos;src&apos;, imageUrl);
    }
    document.querySelector(&apos;[value=&quot;one&quot;]&apos;).click();
    &lt;/script&gt;
    &lt;h2 id=&quot;meditation&quot;&gt;Meditation&lt;/h2&gt;
    &lt;p&gt;Today I tried to meditate again. I used Insight Timer app for background sound. However I think I&apos;ll just stick to Youtube as it has more varieties. I struggled for 20 minutes sitting cross-legged as my mind wandered in the labyrinth of thoughts. I guess it will take more practice to hone my skill. Have you ever wondered how monks can meditate for countless hours or days?&lt;/p&gt;
    &lt;p&gt;There&apos;s a very famous picture of a Vietnamese monk called &lt;a href=&quot;https://en.wikipedia.org/wiki/Th%C3%ADch_Qu%E1%BA%A3ng_%C4%90%E1%BB%A9c&quot;&gt;Thích Quảng Đức&lt;/a&gt;. He was protesting against the persecution of Buddhist. He self-immolated himself without making any fuss. I apologize if you find following image disturbing.&lt;/p&gt;
    &lt;div id=&quot;imagetest&quot;&gt;
    &lt;img id=&quot;imgview&quot; src=&quot;&quot; /&gt;
    &lt;/div&gt;
    &lt;p&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;input onclick=&quot;changeImage(this)&quot; type=&quot;radio&quot; image=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Th%C3%ADch_Qu%E1%BA%A3ng_%C4%90%E1%BB%A9c_self-immolation.jpg/1920px-Th%C3%ADch_Qu%E1%BA%A3ng_%C4%90%E1%BB%A9c_self-immolation.jpg&quot; name=&quot;field&quot; value=&quot;one&quot; /&gt;I understand that this image can be disturbing&lt;/span&gt;&lt;/p&gt;
    &lt;p&gt;David Halberstam, an American journalist was witness to self-immolation said-&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;As he burned he never moved a muscle, never uttered a sound, his outward composure in sharp contrast to the wailing people around him&quot;&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;People claim they can levitate while meditating. However I am not convinced if the laws of physics can be broken. Carl Sagan said, &quot;extraordinary claims require extraordinary evidence&quot;. So we can ignore mumbo jumbo of levitation. However meditation can certainly help to remain calm under tumultuous times.&lt;/p&gt;
    &lt;h2 id=&quot;reading&quot;&gt;Reading&lt;/h2&gt;
    &lt;p&gt;Currently I am reading &lt;a href=&quot;http://randomwits.com/books&quot;&gt;Glimpses of World History&lt;/a&gt; by Nehru. I hope you might recall some of the history of &lt;a href=&quot;https://en.wikipedia.org/wiki/Mughal_Empire&quot;&gt;Mughal Empire&lt;/a&gt;. Remember history is not fact. There are multiple interpretation &amp;amp; nuances by different people colored by their own biases. Today I&apos;ll share views of Nehru on two prominent figure in ancient India.&lt;/p&gt;
    &lt;p&gt;Babar laid the foundation of Mughal Empire in India. Nehru praises him in his description&lt;/p&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;“Babar was one of the most cultured &amp;amp; delightful persons one could meet...no sectarianism in him, no religious bigotry, he did not destroy as his ancestors used to do...was devoted to art &amp;amp; literature” -excerpt from “Glimpses of World History “, Nehru &lt;a href=&quot;https://t.co/XpkgW8Hg9N&quot;&gt;https://t.co/XpkgW8Hg9N&lt;/a&gt; &lt;a href=&quot;https://t.co/onbmEwULmc&quot;&gt;pic.twitter.com/onbmEwULmc&lt;/a&gt;&lt;/p&gt;&amp;mdash; Tushar Sharma (@tshrocks) &lt;a href=&quot;https://twitter.com/tshrocks/status/1396728857437241344?ref_src=twsrc%5Etfw&quot;&gt;May 24, 2021&lt;/a&gt;&lt;/blockquote&gt;
    &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;
    However Nehru was critical of Aurangzeb, who was the last ruler of the Mughal Empire.&lt;/p&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Aurangzeb, imprisoning his old father, was a bigot, tolerating no religion but his own. He laid down policy of persecution of Hindus..reimposed jizya tax on Hindus...destroyed Hindus temples by thousand-excerpt from “Glimpses of World History” &lt;a href=&quot;https://t.co/XpkgW8Hg9N&quot;&gt;https://t.co/XpkgW8Hg9N&lt;/a&gt; &lt;a href=&quot;https://t.co/8Mf9xOzJZN&quot;&gt;pic.twitter.com/8Mf9xOzJZN&lt;/a&gt;&lt;/p&gt;&amp;mdash; Tushar Sharma (@tshrocks) &lt;a href=&quot;https://twitter.com/tshrocks/status/1397137200492384256?ref_src=twsrc%5Etfw&quot;&gt;May 25, 2021&lt;/a&gt;&lt;/blockquote&gt;
    &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Do you think Babar was better than Aurangzeb? Remember history is nuanced. May be you can read more about it to form your own opinion.&lt;/p&gt;
  </description>
  <pubDate>2021-05-25T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-meditate-like-monk</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-meditate-like-monk</guid>
</item>
<item>
  <title>Dear Vishi, is there a time machine?</title>
  <description>&lt;p&gt;Did you remember we watched The Time Machine movie together? The protagonist loses his fiancée when a mugger kills her. He then builds a time machine to travel back in time to save her. Of course multiple movies have been made romanticizing the concept of time machine.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;!--begin_of_post --&gt;
    &lt;p&gt;Did you remember we watched The Time Machine movie together? The protagonist loses his fiancée when a mugger kills her. He then builds a time machine to travel back in time to save her. Of course multiple movies have been made romanticizing the concept of time machine.&lt;/p&gt;
    &lt;p&gt;I am not sure if the laws of physics allow time travel. There&apos;s no scientific consensus if time travel is possible in theory. Even if it was possible in theory, it might take aeons before humans could master time. However there&apos;s one time machine you see everyday.&lt;/p&gt;
    &lt;p&gt;Have you looked at the moon today?&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://imgur.com/5DSYHFZ.jpg&quot; alt=&quot;Moon&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;If I told you that sky is a time machine you might call me bonkers. However sky does mirrors the past. Moonlight takes 1.26 seconds to reach earth. So you are looking at moon 1.26 seconds in the past. This might not be a significant delay. However for other celestial objects the delay is significant. Venus, for instance, is the brightest planet you can see from earth. On some occassion, Venus can be visible on a broad daylight. It takes 3 minutes from a light to travel from Venus to Earth. Venus is so bright it is often mistook for an alien spaceship.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;https://www.nasa.gov/images/content/58794main_Laveder1_med.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;What about the sun, the gigantic ball of gas? It takes 8 minutes for light to travel from sun to earth. If the sun is diabolically annihilated, we wouldn&apos;t realize its repercussions for atleast 8 minutes. Sun is dwelling in the 8 minutes past.&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Alpha_Centauri&quot;&gt;Alpha Centauri&lt;/a&gt; is the closest star to earth. It&apos;s 4.37 light years away. 1 light year is the distance light travels in vacuum in 1 year. So it would take approx 4 years for light to travel from Alpha Centauri to us. If Alpha Centauri is annihilated today, we still will be able to see it for next 4 years. Do you wonder how many stars in the sky are already dead?&lt;/p&gt;
    &lt;h2 id=&quot;coconut-water&quot;&gt;Coconut Water&lt;/h2&gt;
    &lt;p&gt;Today I had coconut water. I drank it from the source itself, the coconut. It saves me from the added sugar &amp;amp; preservative from the packaged coconut bottle available in the shopping mall.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://i.imgur.com/fkOTlN7.jpeg&quot; alt=&quot;Coconut Water&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;In India, it&apos;s easy to find patchy shops on the road sideways selling fresh coconut water. However in the US, I couldn&apos;t find any fresh coconut water. Most of the retail sector is very organized in the US. I only relied upon packaged coconut water.&lt;/p&gt;
    &lt;h2 id=&quot;health&quot;&gt;Health&lt;/h2&gt;
    &lt;h3 id=&quot;treadmill&quot;&gt;Treadmill&lt;/h3&gt;
    &lt;p&gt;Below is the snapshot of my treadmill activity. I still need to improve my &lt;a href=&quot;https://en.wikipedia.org/wiki/Vital_capacity&quot;&gt;vital capacity&lt;/a&gt; &amp;amp; stamina.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/WADGIC9.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h2 id=&quot;code&quot;&gt;Code&lt;/h2&gt;
    &lt;p&gt;Today I solved a problem on Binary Tree, &lt;a href=&quot;https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree/&quot;&gt;All Nodes Distance K in Binary Tree&lt;/a&gt;. I&apos;ve created a repository in &lt;a href=&quot;https://github.com/tushar-sharma/prep-coding&quot;&gt;Github&lt;/a&gt; to track my progress on problem solving.&lt;/p&gt;
    &lt;p&gt;I would recommend you to create a Github repository to keep track your progress of SQL problems. This will help you to stay motivated.&lt;/p&gt;
    &lt;!--end_of_post --&gt;
  </description>
  <pubDate>2021-05-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-time-machine</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-time-machine</guid>
</item>
<item>
  <title>Dear Vishi, can you mix Covid Vaccine?</title>
  <description>&lt;p&gt;Today the sleep was better. Yesterday I was sleep deprived. Hunger is the best ingredient to make any food delicious. Likewise a sound sleep is like a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;manna from heaven&lt;/code&gt; for me.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Today the sleep was better. Yesterday I was sleep deprived. Hunger is the best ingredient to make any food delicious. Likewise a sound sleep is like a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;manna from heaven&lt;/code&gt; for me.&lt;/p&gt;
    &lt;p&gt;I hope you are spending time honing SQL skills. I hope you are making some progress in the online course at &lt;a href=&quot;https://www.educative.io/courses/introductory-guide-to-sql/&quot;&gt;Educative.io&lt;/a&gt;. There&apos;s also another resource &lt;a href=&quot;https://sqlzoo.net/&quot;&gt;SQLZoo&lt;/a&gt; that has some fun exercise that you can explore. Next week we can take a SQL quiz together to see how well we fare against each other.&lt;/p&gt;
    &lt;h2 id=&quot;health&quot;&gt;Health&lt;/h2&gt;
    &lt;h3 id=&quot;meditation&quot;&gt;Meditation&lt;/h3&gt;
    &lt;p&gt;I practiced meditation for 15 minutes today. The &lt;a href=&quot;https://www.youtube.com/watch?v=ubNfkpbxXUs&amp;amp;list=LL&amp;amp;index=1&quot;&gt;background music&lt;/a&gt; was that of rain. The murmur of the raindrops, the roar of the thunder, the michief of the winds, plays a combined symphony which fascinated me as a child. My early childhood was spent in Jodhpur. During rains, children would come out of their cages, and played in the muddy puddles thanks to the rampant potholes of Indian roads. I envied them how they get drenched in rain and mirth. Now I have grown old enough to let myself escape under the canopy of sky when the clouds bleed. I pity some, who flee at a whisper of a raindrop to a shelter, missing one of the greatest joy in the world.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;&quot;Some people walk in the rain, others just get wet.&quot; - Roger Miller&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h3 id=&quot;mixing-covid-vaccine&quot;&gt;Mixing Covid Vaccine&lt;/h3&gt;
    &lt;p&gt;I have booked my United Airline flight from Delhi to Charlotte this June. Since I was departing in less than a month, I was in a dilemma if I should delay taking Covid vaccine in India since I wont be available for second dose.&lt;/p&gt;
    &lt;p&gt;Due to an unforseen event, India is currently battling second Covid wave which is very devastating. US has banned the entry of most of visa types from India thanks to &lt;a href=&quot;https://www.whitehouse.gov/briefing-room/presidential-actions/2021/04/30/a-proclamation-on-the-suspension-of-entry-as-nonimmigrants-of-certain-additional-persons-who-pose-a-risk-of-transmitting-coronavirus-disease-2019/&quot;&gt;Presendential Proclamation&lt;/a&gt;. It&apos;s not yet known when the travel ban will be revoked.&lt;/p&gt;
    &lt;p&gt;So I&apos;ve decided to get vaccinated in India preferrably &lt;a href=&quot;https://en.wikipedia.org/wiki/Oxford%E2%80%93AstraZeneca_COVID-19_vaccine&quot;&gt;Covidshield&lt;/a&gt;. If the US revokes the travel Indian travel ban, I can take my second dose preferrably Pfizer vaccine in US. Or else I&apos;ll take my second dose of Covidshield in India itself. Though it&apos;s not yet conclusively clear if mixing vaccine is safe, however preliminary data shows it might produce more &lt;a href=&quot;https://www.nature.com/articles/d41586-021-01359-3&quot;&gt;antibodies&lt;/a&gt;.&lt;/p&gt;
    &lt;p&gt;Earlier I wanted to get vaccinated with Pfizer or Moderna in USA since it has more than &lt;a href=&quot;https://www.cdc.gov/mmwr/volumes/70/wr/mm7018e1.htm&quot;&gt;90 percent efficacy&lt;/a&gt;. Covidshield has efficacy around &lt;a href=&quot;https://www.who.int/news-room/feature-stories/detail/the-oxford-astrazeneca-covid-19-vaccine-what-you-need-to-know&quot;&gt;63%&lt;/a&gt;. Sometimes it&apos;s wise to forego choices when there&apos;s a pandemic and &lt;a href=&quot;https://www.fortuneindia.com/macro/scarcity-hit-india-looks-for-imported-vaccines/105492&quot;&gt;scarcity&lt;/a&gt; of vaccine in India.&lt;/p&gt;
    &lt;p&gt;In the meantime, getting a first dose of vaccine in India is an uphill task. Most of my family is already vaccinated with Covidshield. I am still trying to find vaccination slots online for past two days but alas no luck. Most of the time either the &lt;a href=&quot;https://www.cowin.gov.in/&quot;&gt;Cowin&lt;/a&gt; website&apos;s server crashes or the slots are already booked.&lt;/p&gt;
    &lt;p&gt;Hopefully  I&apos;ll get my first coronavirus vaccine dose soon. At least its better to have some immunity than nothing even if I miss my second dose due to some unforseen event.&lt;/p&gt;
    &lt;h3 id=&quot;warts&quot;&gt;Warts&lt;/h3&gt;
    &lt;p&gt;It has been several months since I noticed warts on my toes. It&apos;s not paintful, but it look like a black dot.&lt;/p&gt;
    &lt;p&gt;Earlier I thoguht it would disappear on its own, but it has persisted. So I had to consult a doctor. Due to Covid-19 restriction, it&apos;s better to schedule a doctor appointment online. You pay doctor fee using &lt;a href=&quot;https://en.wikipedia.org/wiki/Google_Pay&quot;&gt;Google Pay&lt;/a&gt;. After the payment,  the doctor video calls you through WhatsApp.&lt;/p&gt;
    &lt;p&gt;Salicyclic acid is the often recommended as first medication against plantar warts. Earlier I was using Salicylix SF6 which contains 6% Salicyclic acid. The results were not satisfactory.&lt;/p&gt;
    &lt;p&gt;Currently, the doctor has recommended to use Watnil Salalin lotion which contains 16.7% Salicyclic acid. I will update if this treatment is effective. The doctor also advised to take Zinc tablets to &lt;a href=&quot;https://www.ouh.nhs.uk/patient-guide/leaflets/files/14029Pzinc.pdf&quot;&gt;boost immunity&lt;/a&gt; against warts.&lt;/p&gt;
    &lt;h2 id=&quot;code&quot;&gt;Code&lt;/h2&gt;
    &lt;h3 id=&quot;poetry&quot;&gt;Poetry&lt;/h3&gt;
    &lt;p&gt;I had a python project where I was trying to setup in a new laptop. I ran the following command&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Poetry crashed with the following error&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Creating virtualenv usa &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; /home/project/.venv    
    ModuleNotFoundError  
    No module named &lt;span class=&quot;s1&quot;&gt;&apos;virtualenv.seed.via_app_data&apos;&lt;/span&gt;
    at &amp;lt;frozen importlib._bootstrap&amp;gt;:973 &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;_find_and_load_unlocked
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;My laptop has Ubuntu 20.04 LTS.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry &lt;span class=&quot;nb&quot;&gt;env &lt;/span&gt;info
    Virtualenv
    Python:         3.8.5
    Implementation: CPython
    Valid:          True
    System
    Platform: linux
    OS:       posix
    Python:   /usr
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
    Poetry version 1.1.4
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you remove &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python3-virtualenv&lt;/code&gt; then &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;poetry&lt;/code&gt; seems to work.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt remove &lt;span class=&quot;nt&quot;&gt;--purge&lt;/span&gt; python3-virtualenv
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2021-05-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-mix-covid-vaccine</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-mix-covid-vaccine</guid>
</item>
<item>
  <title>Dear Vishi, have you travelled to Virginia?</title>
  <description>&lt;p&gt;I didn&apos;t have proper sleep today. I could barely keep my eyes open. Empty stomach and a heavy mind is a disaster for sound sleep. Yesterday I was brooding too much while trying to sleep. I guess I need to filter noises in my mind. Proper sleep is the basic physiological need in Maslow&apos;s pyramid. I guess it&apos;s a blessed day not to have a insomnia.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I didn&apos;t have proper sleep today. I could barely keep my eyes open. Empty stomach and a heavy mind is a disaster for sound sleep. Yesterday I was brooding too much while trying to sleep. I guess I need to filter noises in my mind. Proper sleep is the basic physiological need in Maslow&apos;s pyramid. I guess it&apos;s a blessed day not to have a insomnia.&lt;/p&gt;
    &lt;p&gt;I am beginning to practice meditation. Though I am not a religous person, I reckon meditation is a good practice to adopt from my religion. I like the &lt;a href=&quot;https://www.youtube.com/watch?v=IvjMgVS6kng&amp;amp;list=LL&amp;amp;index=1&quot;&gt;babbling sound of the water&lt;/a&gt; while I meditate. Today I meditated for 15 minutes.&lt;/p&gt;
    &lt;h2 id=&quot;hobby&quot;&gt;Hobby&lt;/h2&gt;
    &lt;h3 id=&quot;reading&quot;&gt;Reading&lt;/h3&gt;
    &lt;p&gt;Currently, I am reading &lt;a href=&quot;http://randomwits.com/books/&quot;&gt;Glimpses of World History&lt;/a&gt; by Nehru. I read an interesting account of England&apos;s monarchy.There was a tussle between the Parliament and the king, Charles I. The Parliament introduced a &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Petition_of_Right&quot;&gt;Petition of Right&lt;/a&gt;&quot; in 1628 which limited the kings powers to impose tax or imprison anyone. This enraged the king and he dissolved the Parliament. However later he was beheaded. This episode caused panic among the royals in England. Soon the monarch started interfering less in the Parliament&apos;s affairs.&lt;/p&gt;
    &lt;p&gt;Also there&apos;s an interesting story of etymology of name of the US state &quot;Virginia&quot;. Walter Raleigh crossed Atlantic and reached the state paving way for future English settlements. It was named in honor of Queen Elizabeth I, the virgin Queen.&lt;/p&gt;
    &lt;p&gt;I&apos;ve myself drove past Virginia on a trip from New Jersey to North Carolina. One of the interesting signpost I saw while driving on freeway was &quot;Speed Limit Enforced by Aircraft&quot;. I was little scared if I inadvertently crossed the speed limit then the the SWAT-style aircraft would chase my car. However it seems like there are no traffic control aircraft in Virginia&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://gray-whsv-prod.cdn.arcpublishing.com/resizer/dXuUcxgfsnwb207wLMBrz4SEAlw=/800x800/smart/cloudfront-us-east-1.images.arcpublishing.com/gray/BYPIX7IB5ROK5JKR6RNUP2JHGA.jpg&quot; alt=&quot;Virginal Aircraft Signpost&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Another Interesting signpost while driving in Virginia is, &quot;Virginia is for lovers&quot; which is a tourism slogan of the State.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://cdn.geekwire.com/wp-content/uploads/2016/02/virginia-shutterstock_364806335.jpg&quot; alt=&quot;Virginia_Lovers&quot; /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;leisure&quot;&gt;Leisure&lt;/h3&gt;
    &lt;p&gt;Today I binged watched &lt;a href=&quot;https://en.wikipedia.org/wiki/Malgudi_Days_(TV_series)&quot;&gt;Malgudi Series&lt;/a&gt; based on the works of &lt;a href=&quot;https://en.wikipedia.org/wiki/R._K._Narayan&quot;&gt;R.K. Narayan&lt;/a&gt;. Since childhood, I am quite fond of the &lt;a href=&quot;https://www.youtube.com/watch?v=PEHj4YSS1nw&quot;&gt;Title Song&lt;/a&gt;. It has a rustic charm which draws me to memories of my childhood.&lt;/p&gt;
    &lt;h3 id=&quot;games&quot;&gt;Games&lt;/h3&gt;
    &lt;p&gt;I am currently hooked on to a tennis game called Tennis Clash in my phone. I am just wasting time in investing in improving my swiping skills. I probably should delete this game from my phone.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://richmond.com/news/virginia/virginia-does-not-enforce-speed-on-the-interstate-with-planes/article_2cc44933-d18e-5058-a9d0-2b4b5d9b0268.html&quot; target=&quot;_blank&quot;&gt;Richmond News&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-05-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/dear-vishi-about-virginia</link>
<guid isPermaLink="true">https://randomwits.com/blog/dear-vishi-about-virginia</guid>
</item>
<item>
  <title>How to Make(Or Lose) Money in Stocks Part1</title>
  <description>&lt;p&gt;Recently I finished watching web-series &lt;a href=&quot;https://en.wikipedia.org/wiki/Scam_1992&quot; target=&quot;_blank&quot;&gt;Scam 1992&lt;/a&gt;. It&apos;s based on story of Harshad Mehta, a famous Indian stockbrocker who made fortunes in stocks. Despite his iconic success &amp;amp; &lt;a href=&quot;https://en.wikipedia.org/wiki/1992_Indian_stock_market_scam&quot; target=&quot;_blank&quot;&gt;failure&lt;/a&gt;, the series rekindled my interest in world of &quot;stocks&quot;. I guess the famous dialogue &quot;Risk Hai Toh Ishq Hai&quot; has stuck with me.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Recently I finished watching web-series &lt;a href=&quot;https://en.wikipedia.org/wiki/Scam_1992&quot; target=&quot;_blank&quot;&gt;Scam 1992&lt;/a&gt;. It&apos;s based on story of Harshad Mehta, a famous Indian stockbrocker who made fortunes in stocks. Despite his iconic success &amp;amp; &lt;a href=&quot;https://en.wikipedia.org/wiki/1992_Indian_stock_market_scam&quot; target=&quot;_blank&quot;&gt;failure&lt;/a&gt;, the series rekindled my interest in world of &quot;stocks&quot;. I guess the famous dialogue &quot;Risk Hai Toh Ishq Hai&quot; has stuck with me.&lt;/p&gt;
    &lt;p&gt;I still consider myself a novice when it comes to stocks. There&apos;s a no magic bullet to make money in stocks. However you can leverage scripts to reduce time to accumulate information. I&apos;ll share one such approach in helping you to buy or sell stocks.&lt;/p&gt;
    &lt;p&gt;Lets say you want to buy or sell some stocks. You can use some website to track them everyday (too tedious). Or you can use some API (like yahoofinance) to get this information. However free API usually have some time lag. We will using python in getting our current stock prices directly from google.&lt;/p&gt;
    &lt;h1 id=&quot;setup-before-you-begin&quot;&gt;Setup before you begin&lt;/h1&gt;
    &lt;p&gt;Open your favourite terminal to create directory&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$stocks&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We will be using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;poetry&lt;/code&gt; to manage our library depedencies. Create a default &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pyproject.toml&lt;/code&gt; file like this&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry init
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Keep pressing enter to keep the defualt configuration&lt;/p&gt;
    &lt;p&gt;Next we will create a text file,  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stocks.csv&lt;/code&gt;. This will list all the stocks that we need to track. For this example I am using aaple and microsoft.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ticker,sell,sell,buy
    aapl,0,125,0,0
    msft,0,0,230,0
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here let me briefly expalin the columns:&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;ticker : stock ticker symbol&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;sell: the price at which you want to sell stock&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;buy: the price at which you want to buy stock&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;blockquote&gt;
    &quot;Investing should be more like watching paint dry or watching grass grow. If you want excitement, take $800 and go to Las Vegas.&quot;
    &lt;b&gt;- Paul Samuelson&lt;/b&gt;&lt;br /&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Next create python file, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stocks/main.py&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;io&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BytesIO&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reportlab.platypus&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SimpleDocTemplate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Paragraph&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PageBreak&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reportlab.lib.styles&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;getSampleStyleSheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ParagraphStyle&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reportlab.lib.units&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mm&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reportlab.lib.pagesizes&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;letter&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reportlab.platypus.tables&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TableStyle&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reportlab.lib&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;colors&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reportlab&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;platypus&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;reportlab.lib.styles&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ParagraphStyle&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PS&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;selenium&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webdriver&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;selenium.webdriver.common.keys&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Keys&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;selenium.webdriver.chrome.options&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Options&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;selenium.webdriver.common.action_chains&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ActionChains&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reportlab.platypus&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Image&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Image2&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;logging&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next we will open our favourite Web browser to type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aapl stocks&lt;/code&gt;&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/st1.png&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;We will then right click and use inspect the web page&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/st2.png&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Here we are looking for jsname with value &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vWLAgc&lt;/code&gt;&lt;/p&gt;
    &lt;p&gt;So our algorithm is like this for every stock&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;get current price of stock&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Prints if the current price is greater than my desired selling price&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Prints if the current price is smaller then my desired buying prices&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;I&apos;ll be using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reportlab&lt;/code&gt; library to generate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pdf&lt;/code&gt; for my output.&lt;/p&gt;
    &lt;p&gt;Run this command using&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry run python stock/main.py
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/7e84b10f862999d6a2c802cd6e1cc036.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;The output looks like this&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/st3.png&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Of course predicting the buying and selling prices is an uphill task. May be you can call up Warren Buffett for tips. But I can&apos;t since he doesn&apos;t pick up my call 😢. So in next tutorial we&apos;ll do some technical analysis on stocks.&lt;/p&gt;
  </description>
  <pubDate>2021-04-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/make-money-stock1</link>
<guid isPermaLink="true">https://randomwits.com/blog/make-money-stock1</guid>
</item>
<item>
  <title>Famous breach of Trust in Cancer</title>
  <description>&lt;p&gt;I am currently reading &lt;a href=&quot;http://randomwits.com/books&quot; target=&quot;_blank&quot;&gt;The Emperor of Maladies&lt;/a&gt;. This is a fascination book where Siddhartha Mukherjee not only educate its readers about cancer disease but also shares interesting tidbits. Werner Bezwoda was an infamous oncologist who fudged data about bone marrow transplant in women with metastatic breast cancer.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I am currently reading &lt;a href=&quot;http://randomwits.com/books&quot; target=&quot;_blank&quot;&gt;The Emperor of Maladies&lt;/a&gt;. This is a fascination book where Siddhartha Mukherjee not only educate its readers about cancer disease but also shares interesting tidbits. Werner Bezwoda was an infamous oncologist who fudged data about bone marrow transplant in women with metastatic breast cancer.&lt;/p&gt;
    &lt;p&gt;Before I understood anything, I have to understand what bone marrow was. I remembered vaguely from my science class in school but I guess I needed a revision.&lt;/p&gt;
    &lt;p&gt;What is a bone marrow? I googled it and following image popped out&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;https://medsurgeindia.com/wp-content/uploads/2020/07/bone-marrow-transplants-in-india.jpeg&quot; alt=&quot;bone marrow image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;It&apos;s a spongy substance found inside bones. It generates stem cells which in turn produce blood cells like white blood cells. White blood cells? Aren&apos;t they something that fights pathogens? I found an interesting video of white blood cell chasing a pathogen&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;White Blood Cell Chases Bacteria !&lt;a href=&quot;https://twitter.com/hashtag/MedTwitter?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#MedTwitter&lt;/a&gt; &lt;a href=&quot;https://t.co/VU4RKX3FS4&quot;&gt;pic.twitter.com/VU4RKX3FS4&lt;/a&gt;&lt;/p&gt;&amp;mdash; Dr.Deepa Sharma (@deepadoc) &lt;a href=&quot;https://twitter.com/deepadoc/status/1368175023136063493?ref_src=twsrc%5Etfw&quot;&gt;March 6, 2021&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;But why am I talking about bone marrow? I guess  I was reading about chemotherapy which is just a fancy way of “poisoning” the body to kill cancerous cells. Of course side effects also include killing normal healthy cells.&lt;/p&gt;
    &lt;p&gt;There’s a limit on how much dose of “cytoxins” a body can withstand. High chemotherapy often severely damaged the bone marrow. So doctors began removing bone marrow &amp;amp; freezing it before commencing chemotherapy. Bone marrow can later be transplanted again which could replenish white blood cells.  High-dose chemotherapy can also lead to congestive heart failure and irreversible heart damage, etc, yet people with advanced cancer cling on to any possible cure.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Werner Bezwoda&lt;/strong&gt; was a famous oncologist who published randomized controlled trials of  high-dose chemotherapy and autologous stem cell transplantation for patients with metastatic breast cancer. The results were remarkable enough to earn him a plenary session lecture at the annual meeting of the American Society of Clinical Oncology. The treatment was highly profitable for hospitals who, by 1995, were billing the procedure at $80,000 to $100,000.&lt;/p&gt;
    &lt;p&gt;But one of the tenets of science involves reproducibility. Most of the trails in America could not produce similar results. Later audits by American physicians discovered significant failings in Bezwoda’s records.&lt;/p&gt;
    &lt;p&gt;Bezwoda had taken advantage of Black women who couldn’t read, many of whom had been treated at a Blacks-only hospital. &quot;He was recruiting patients who did not know what to ask for,&quot; says Dr. Cynthia Farquhar, postgraduate professor of obstetrics and gynecology at the University of Auckland and co-author of False Hope: Bone Marrow Transplantation for Breast Cancer.Most of the women shouldn’t have been enrolled because their cancer wasn’t advanced enough to require aggressive treatment, or they had already had radiation therapy, which excluded them from the study. And even worse, no consent forms were found — meaning there was no evidence that the women agreed to be treated with highly toxic chemotherapy&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;how-do-we-trust-science&quot;&gt;How do we trust science?&lt;/h2&gt;
    &lt;p&gt;I’ve met flat earthers in life who claim that there’s a global conspiracy to fooling public into believing earth is actually round. I’ve also met an anti-vaxxer who claimed vaccination can lead to autism and it interfered with his personal religious belief.&lt;/p&gt;
    &lt;p&gt;Anti-maskers in Idaho’s Boise burned face masks to protest against coronavirus restrictions imposed upon cities.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Parents encouraging kids to burn masks on Idaho Capitol steps &lt;a href=&quot;https://t.co/VOYfOYqwwt&quot;&gt;pic.twitter.com/VOYfOYqwwt&lt;/a&gt;&lt;/p&gt;&amp;mdash; Sergio Olmos (@MrOlmos) &lt;a href=&quot;https://twitter.com/MrOlmos/status/1368261041696632832?ref_src=twsrc%5Etfw&quot;&gt;March 6, 2021&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;V. A. Shiva Ayyadurai is an Indian-American engineer, politician&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;instagram-media&quot; data-instgrm-permalink=&quot;https://www.instagram.com/p/CB_Y6XxgoV-/?utm_source=ig_embed&amp;amp;utm_campaign=loading&quot; data-instgrm-version=&quot;13&quot; style=&quot; background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:540px; min-width:326px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);&quot;&gt;&lt;div style=&quot;padding:16px;&quot;&gt; &lt;a href=&quot;https://www.instagram.com/p/CB_Y6XxgoV-/?utm_source=ig_embed&amp;amp;utm_campaign=loading&quot; style=&quot; background:#FFFFFF; line-height:0; padding:0 0; text-align:center; text-decoration:none; width:100%;&quot; target=&quot;_blank&quot;&gt; &lt;div style=&quot; display: flex; flex-direction: row; align-items: center;&quot;&gt; &lt;div style=&quot;background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 40px; margin-right: 14px; width: 40px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot;display: flex; flex-direction: column; flex-grow: 1; justify-content: center;&quot;&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 100px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 60px;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;padding: 19% 0;&quot;&gt;&lt;/div&gt; &lt;div style=&quot;display:block; height:50px; margin:0 auto 12px; width:50px;&quot;&gt;&lt;svg width=&quot;50px&quot; height=&quot;50px&quot; viewBox=&quot;0 0 60 60&quot; version=&quot;1.1&quot; xmlns=&quot;https://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;https://www.w3.org/1999/xlink&quot;&gt;&lt;g stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;&lt;g transform=&quot;translate(-511.000000, -20.000000)&quot; fill=&quot;#000000&quot;&gt;&lt;g&gt;&lt;path d=&quot;M556.869,30.41 C554.814,30.41 553.148,32.076 553.148,34.131 C553.148,36.186 554.814,37.852 556.869,37.852 C558.924,37.852 560.59,36.186 560.59,34.131 C560.59,32.076 558.924,30.41 556.869,30.41 M541,60.657 C535.114,60.657 530.342,55.887 530.342,50 C530.342,44.114 535.114,39.342 541,39.342 C546.887,39.342 551.658,44.114 551.658,50 C551.658,55.887 546.887,60.657 541,60.657 M541,33.886 C532.1,33.886 524.886,41.1 524.886,50 C524.886,58.899 532.1,66.113 541,66.113 C549.9,66.113 557.115,58.899 557.115,50 C557.115,41.1 549.9,33.886 541,33.886 M565.378,62.101 C565.244,65.022 564.756,66.606 564.346,67.663 C563.803,69.06 563.154,70.057 562.106,71.106 C561.058,72.155 560.06,72.803 558.662,73.347 C557.607,73.757 556.021,74.244 553.102,74.378 C549.944,74.521 548.997,74.552 541,74.552 C533.003,74.552 532.056,74.521 528.898,74.378 C525.979,74.244 524.393,73.757 523.338,73.347 C521.94,72.803 520.942,72.155 519.894,71.106 C518.846,70.057 518.197,69.06 517.654,67.663 C517.244,66.606 516.755,65.022 516.623,62.101 C516.479,58.943 516.448,57.996 516.448,50 C516.448,42.003 516.479,41.056 516.623,37.899 C516.755,34.978 517.244,33.391 517.654,32.338 C518.197,30.938 518.846,29.942 519.894,28.894 C520.942,27.846 521.94,27.196 523.338,26.654 C524.393,26.244 525.979,25.756 528.898,25.623 C532.057,25.479 533.004,25.448 541,25.448 C548.997,25.448 549.943,25.479 553.102,25.623 C556.021,25.756 557.607,26.244 558.662,26.654 C560.06,27.196 561.058,27.846 562.106,28.894 C563.154,29.942 563.803,30.938 564.346,32.338 C564.756,33.391 565.244,34.978 565.378,37.899 C565.522,41.056 565.552,42.003 565.552,50 C565.552,57.996 565.522,58.943 565.378,62.101 M570.82,37.631 C570.674,34.438 570.167,32.258 569.425,30.349 C568.659,28.377 567.633,26.702 565.965,25.035 C564.297,23.368 562.623,22.342 560.652,21.575 C558.743,20.834 556.562,20.326 553.369,20.18 C550.169,20.033 549.148,20 541,20 C532.853,20 531.831,20.033 528.631,20.18 C525.438,20.326 523.257,20.834 521.349,21.575 C519.376,22.342 517.703,23.368 516.035,25.035 C514.368,26.702 513.342,28.377 512.574,30.349 C511.834,32.258 511.326,34.438 511.181,37.631 C511.035,40.831 511,41.851 511,50 C511,58.147 511.035,59.17 511.181,62.369 C511.326,65.562 511.834,67.743 512.574,69.651 C513.342,71.625 514.368,73.296 516.035,74.965 C517.703,76.634 519.376,77.658 521.349,78.425 C523.257,79.167 525.438,79.673 528.631,79.82 C531.831,79.965 532.853,80.001 541,80.001 C549.148,80.001 550.169,79.965 553.369,79.82 C556.562,79.673 558.743,79.167 560.652,78.425 C562.623,77.658 564.297,76.634 565.965,74.965 C567.633,73.296 568.659,71.625 569.425,69.651 C570.167,67.743 570.674,65.562 570.82,62.369 C570.966,59.17 571,58.147 571,50 C571,41.851 570.966,40.831 570.82,37.631&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/div&gt;&lt;div style=&quot;padding-top: 8px;&quot;&gt; &lt;div style=&quot; color:#3897f0; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:550; line-height:18px;&quot;&gt; View this post on Instagram&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;padding: 12.5% 0;&quot;&gt;&lt;/div&gt; &lt;div style=&quot;display: flex; flex-direction: row; margin-bottom: 14px; align-items: center;&quot;&gt;&lt;div&gt; &lt;div style=&quot;background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(0px) translateY(7px);&quot;&gt;&lt;/div&gt; &lt;div style=&quot;background-color: #F4F4F4; height: 12.5px; transform: rotate(-45deg) translateX(3px) translateY(1px); width: 12.5px; flex-grow: 0; margin-right: 14px; margin-left: 2px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot;background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(9px) translateY(-18px);&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-left: 8px;&quot;&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 20px; width: 20px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot; width: 0; height: 0; border-top: 2px solid transparent; border-left: 6px solid #f4f4f4; border-bottom: 2px solid transparent; transform: translateX(16px) translateY(-4px) rotate(30deg)&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-left: auto;&quot;&gt; &lt;div style=&quot; width: 0px; border-top: 8px solid #F4F4F4; border-right: 8px solid transparent; transform: translateY(16px);&quot;&gt;&lt;/div&gt; &lt;div style=&quot; background-color: #F4F4F4; flex-grow: 0; height: 12px; width: 16px; transform: translateY(-4px);&quot;&gt;&lt;/div&gt; &lt;div style=&quot; width: 0; height: 0; border-top: 8px solid #F4F4F4; border-left: 8px solid transparent; transform: translateY(-4px) translateX(8px);&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;div style=&quot;display: flex; flex-direction: column; flex-grow: 1; justify-content: center; margin-bottom: 24px;&quot;&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 224px;&quot;&gt;&lt;/div&gt; &lt;div style=&quot; background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 144px;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/a&gt;&lt;p style=&quot; color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;&quot;&gt;&lt;a href=&quot;https://www.instagram.com/p/CB_Y6XxgoV-/?utm_source=ig_embed&amp;amp;utm_campaign=loading&quot; style=&quot; color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none;&quot; target=&quot;_blank&quot;&gt;A post shared by Dr.SHIVA Ayyadurai, MIT PhD (@va_shiva)&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;//www.instagram.com/embed.js&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;Science is not perfect. But people need to trust doctors or scientists. Scientists need to be honest about recommendations that are backed by &lt;a href=&quot;https://en.wikipedia.org/wiki/Scientific_consensus&quot; target=&quot;_blank&quot;&gt;Scientific consensus&lt;/a&gt; &amp;amp; not their personal opinion (unless they also explicity state it&apos;s their personal opinion). Rational wiki has a page on their website called &lt;a href=&quot;https://rationalwiki.org/wiki/Nobel_disease&quot; target=&quot;_blank&quot;&gt;Nobel Diseases&lt;/a&gt;. It contains outlandish claims made by Nobel laureates that are either pseudoscience or not backed by scientific consensus. Like Luc Montagnier, a famous virologist who believes in homeopathy, water memory, autism quackery, AIDS cured by nutrition and vaccine hysteria.&lt;/p&gt;
    &lt;p&gt;Data can be interpreted in different ways either prima facie, or using statistical analysis, by folks in right, center or left wing with their own biases. However it’s paramount that the integrity of data is never compromised. Any scientist who fudges with the data not only breaks trust of the public but is also a criminal.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.ozy.com/true-and-stories/the-fraudulent-study-that-killed-thousands-of-breast-cancer-patients/74310/&quot; target=&quot;_blank&quot;&gt;THE FRAUDULENT STUDY THAT KILLED THOUSANDS OF BREAST CANCER PATIENTS&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;  
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2021-03-03T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/breach-of-trust-cancer</link>
<guid isPermaLink="true">https://randomwits.com/blog/breach-of-trust-cancer</guid>
</item>
<item>
  <title>EnvCommandError in Windows using Poetry</title>
  <description>&lt;p&gt;Poetry is a great dependency management tool in python. It&apos;s better than managing a flat file like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;requirements.txt&lt;/code&gt;. There are also other great tools like pipenv. However I found poetry much simpler in resolving dependencies.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Poetry is a great dependency management tool in python. It&apos;s better than managing a flat file like `requirements.txt`. There are also other great tools like pipenv. However I found poetry much simpler in resolving dependencies. &lt;/p&gt;
    &lt;p&gt;Recently poetry has been crashing on my Windows machine. However, I have not encountered this issue in other platform like Linux. Folks who are unfamiliar with poetry, below is a quick refresher.&lt;/p&gt;
    &lt;p&gt;In cygwin, install poetry&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-sSL&lt;/span&gt; https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Check the curent version&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry &lt;span class=&quot;nt&quot;&gt;-version&lt;/span&gt; 
    1.0.5
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Initialize poetry by creating a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pyproject.toml&lt;/code&gt; file.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry init
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now add some library like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pandas&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;poetry add pandas
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;However this command is causing the poetry to crash&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Creating virtualenv myproject-xkRwmYf0-py3.7 &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; .venv
    &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Env CommandError]
    Command &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;.venv\\myproject\\Scripts\\python.exe&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;-&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; errored with the follwiong &lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;code 1, and output:
    The system cannot find the path specified
    input was : import sys
    is hasattr&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys, &lt;span class=&quot;s2&quot;&gt;&quot;real_prefix&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:
    print&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys.real_prefix&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;elif &lt;/span&gt;hasattr&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys, &lt;span class=&quot;s2&quot;&gt;&quot;base_prefix&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:
    print&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys.base_prefix&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;:
    print&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys.prefix&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Since poetry tries to create virtualenv under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.venv&lt;/code&gt; folder, there&apos;s a quick workaround by removing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;carriage return&lt;/code&gt; from activate Scripts&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;perl &lt;span class=&quot;nt&quot;&gt;-pe&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s/\r$//&apos;&lt;/span&gt; &amp;lt; .venv/myproject-xkRwmYf0-py3.7/Scripts/activate &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; activate
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;activate .venv/myproject-xkRwmYf0-py3.7/Scripts/activate 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Then you can manually activate the virtualenv like this&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; .venv/myproject-xkRwmYf0-py3.7/Scripts/activate 
    &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;myproject-xkRwmYf0-py3.7&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Then you can simply install dependencies like&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;myproject-xkRwmYf0-py3.7&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt; poetry add pandas
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Lastly , you can deactive the virtualenv like&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;myproject-xkRwmYf0-py3.7&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;deactivate
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This manual method may not be the best solution. May be future updates of poetry fixes this issue on Windows.&lt;/p&gt;
  </description>
  <pubDate>2020-12-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/poetry-python-fail-windows</link>
<guid isPermaLink="true">https://randomwits.com/blog/poetry-python-fail-windows</guid>
</item>
<item>
  <title>Export DynamoDB Table to S3 Bucket Using Lambda Function</title>
  <description>&lt;p&gt;Dynamodb is a great NoSQL service by AWS. One of the most common use case is to export data to s3. There are multiple ways to export data to s3. For this tutorial we will leverage lambda function to achieve our goal.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Dynamodb is a great NoSQL service by AWS. Often it&apos;s required to export data from the dynamodb table .&lt;/p&gt;
    &lt;p&gt;First, let us review our use case. Our lambda function will read from table from dynamodb and export JSON to s3.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/dynamodbexport.png&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;using-boto3-resource&quot;&gt;Using boto3 resource&lt;/h2&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/71d7b985435d2719d73dbf927e2c966a.js?file=&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We can create a payload to test our lambda function&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{
    &quot;TableName&quot;: &quot;DynamoDB_Table_name&quot;,
    &quot;s3_bucket&quot;: &quot;s3_bucket_name&quot;,
    &quot;s3_object&quot;: &quot;s3_object_name&quot;,
    &quot;filename&quot;: &quot;output.json&quot;
    }
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;However, sometimes we might encounter errors for certain values in DynamoDB.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;TypeError: Object of &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;Decimal is not JSON serializable. 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We can use a JSONEncoder class to update our lamda function.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/4d5c8a61cae95198e6033789e5dd604d.js?file=&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h2 id=&quot;using-boto3-client&quot;&gt;Using boto3 client&lt;/h2&gt;
    &lt;p&gt;Another way to export data is to use boto3 client. It&apos;s a low level AWS services.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/2d8898fd4ae7cd629657d9a241c7d829.js?file=&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;However boto3 client will generates dynamodb JSON. A simple python script to convert it back to normalized JSON using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dynamodb_json&lt;/code&gt; library.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/e7ee63cd8dcdbd2767ac34846762b72e.js?file=&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
  </description>
  <pubDate>2020-10-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/export-dynamodb-s3</link>
<guid isPermaLink="true">https://randomwits.com/blog/export-dynamodb-s3</guid>
</item>
<item>
  <title>Why homeopathy is so popular in India?</title>
  <description>&lt;p&gt;I recently came across a Youtube video of a famous Indian actress Genelia Deshmukh promoting homeopathic products. The Bollywood couple, Riteish and Genelia Deshmukh, has invested in Welcome Cure, a Homeopathy treatment service platform. Science has repeatedly dismissed homeopathy as quakery or at best placebo, but that has not deter companies or Indian government to continue to fund and research in homeopathy.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2020-06-19-homeopathy-india.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;
    &lt;!--begin_of_post --&gt;&lt;/p&gt;
    &lt;p&gt; I recently came across a Youtube video of a famous Indian actress Genelia Deshmukh promoting homeopathic products. The Bollywood couple, Riteish and Genelia Deshmukh, has invested in Welcome Cure, a Homeopathy treatment service platform. Science has repeatedly dismissed homeopathy as quakery or at best placebo, but that has not deter companies or Indian government to continue to fund and research in homeopathy.&lt;/p&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/rFP0iF5toOg&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/rFP0iF5toOg?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/rFP0iF5toOg/hqdefault.jpg &amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Homeopathy is the best friend for a Women&apos;s Health&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;allopathy-vs-homeopathy&quot;&gt;Allopathy vs Homeopathy&lt;/h2&gt;
    &lt;p&gt;As a kid I usually heard about two types of medicine. One was allopathy which is a pejorative term for modern science. Allopathy was always criticised for side effects. “Only if you are really sick&quot;, my uncle used to say, “take allopathy medicine only as a last resort.&quot;&lt;/p&gt;
    &lt;p&gt;Other was alternative medicine, which is an umbrella term for Ayurveda, homeopathy, yoga, acupuncture, etc. “They don’t have any side effects”, I often heard, “they should be recommended first”.&lt;/p&gt;
    &lt;h2 id=&quot;whats-homeopathy&quot;&gt;What’s homeopathy?&lt;/h2&gt;
    &lt;p&gt;It was developed by Samuel Hahnemann in 1796. During this time modern germ theory of disease was not prevalent. Most scientist believed in miasma theory of disease. Also unconventional methods like bloodletting was also prevalent.&lt;/p&gt;
    &lt;p&gt;Homeopathy in a nutshell has two main concepts i.e.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Like cures Like&lt;/strong&gt;: the notion that a disease can be cured by a substance that produces similar symptoms in healthy people.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Law of minimum dose&lt;/strong&gt; —the notion that the lower the dose of the medication, the greater its effectiveness. Many homeopathic products are so diluted that no molecules of the original substance remain.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;what-does-the-science-say&quot;&gt;What does the science say?&lt;/h2&gt;
    &lt;p&gt;None of the claims of homeopathy has been scientifically proven. In fact, homeopathy has been dismissed as quackery, pseudoscientific, placebo, etc&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Some homeopathic practitioner uses scientific jargon to legitimize homeopathy. &quot;For the first time in the world, we are using homeopathy for genetics&quot;- Mukesh Batra&lt;sup&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. Such claims are nothing but baloney.&lt;/p&gt;
    &lt;h2 id=&quot;no-side-effects&quot;&gt;No side effects?&lt;/h2&gt;
    &lt;p&gt;One of the myths of Homeopathy is that it has no side effects&lt;sup&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;A 2012 systematic review of case reports and case series concluded that using certain homeopathic products (such as those containing heavy metals like mercury or iron that are not highly diluted) or replacing an effective conventional treatment with an ineffective homeopathic one can cause adverse effects, some of which may be serious.&lt;/p&gt;
    &lt;p&gt;The FDA has warned consumers about different products labeled as homeopathic. For example, in 2017 it alerted consumers that some homeopathic teething tablets had excessive amounts of the toxic substance belladonna; in 2015, it warned consumers not to rely on over-the-counter asthma products labeled as homeopathic, because they are not evaluated by the FDA for safety and effectiveness.&lt;sup&gt;&lt;a href=&quot;#fn:4&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h2 id=&quot;celebrities--politicians-in-india&quot;&gt;Celebrities &amp;amp; Politicians in India&lt;/h2&gt;
    &lt;p&gt;Celebrities &amp;amp; Politicians are powerful influencers in any country. The product they endorse usually have huge impact on consumer buying behavior. List of politicians endorsing homeopathy products:
    &lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Press Information Bureau, government of India, suggesting homeopathy for coronavirus&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Advisory for &lt;a href=&quot;https://twitter.com/hashtag/CoronaVirus?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#CoronaVirus&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Homoeopathy for Prevention of Corona virus Infections&lt;br /&gt;&lt;br /&gt;Unani Medicines useful in the symptomatic management of Corona Virus infection&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://t.co/OXC7PtM7L3&quot;&gt;Details here.&lt;/a&gt;&lt;/p&gt;&amp;mdash; PIB India (@PIB_India) &lt;a href=&quot;https://twitter.com/PIB_India/status/1222385553892528128?ref_src=twsrc%5Etfw&quot;&gt;January 29, 2020&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Shashi Tharor is the Indian politician, writer, former Under-Secretary General of the United Nations.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Launching Dr Mukesh Batra&amp;#39;s new magazine &amp;quot;Homeopathy &amp;amp; You&amp;quot; at the Lalit basement shortly. Open to public, Regency Room 5&lt;/p&gt;&amp;mdash; Shashi Tharoor (@ShashiTharoor) &lt;a href=&quot;https://twitter.com/ShashiTharoor/status/395801712050454528?ref_src=twsrc%5Etfw&quot;&gt;October 31, 2013&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Shatrughan Sinha, an Indian film actor &amp;amp; politician.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;On Tuesday evening, Dr. Batra&amp;#39;s Positive Health Awards were held at the Royal Opera House. Dr. Mukesh Batra a world renowned Homeopath along with his son, Dr.Akshay Batra celebrated the 12th anniversary of these special awards.His dedication towards his work has been remarkable&lt;/p&gt;&amp;mdash; Shatrughan Sinha (@ShatruganSinha) &lt;a href=&quot;https://twitter.com/ShatruganSinha/status/1068407477165793280?ref_src=twsrc%5Etfw&quot;&gt;November 30, 2018&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Nita Ambani is the chairperson and founder of the Reliance Foundation.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;&lt;a href=&quot;https://twitter.com/hashtag/NitaAmbani?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#NitaAmbani&lt;/a&gt; receiving the ‘Shri Pravinchandra V Gandhi Award for Excellence in Public Life’ for Philanthropy from Dr Mukesh Batra &lt;a href=&quot;https://twitter.com/Rotary?ref_src=twsrc%5Etfw&quot;&gt;@Rotary&lt;/a&gt; &lt;a href=&quot;https://t.co/F0kC3CGZDh&quot;&gt;pic.twitter.com/F0kC3CGZDh&lt;/a&gt;&lt;/p&gt;&amp;mdash; Reliance Foundation (@ril_foundation) &lt;a href=&quot;https://twitter.com/ril_foundation/status/849246465272807426?ref_src=twsrc%5Etfw&quot;&gt;April 4, 2017&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Vice President of India, M. Venkaiah Naidu, said, &quot;Homeopathy should become a mass movement&quot;.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/rDy5oTAhaLw&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/rDy5oTAhaLw?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/rDy5oTAhaLw/hqdefault.jpg&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Homeopathy should become a mass movement, says Vice President on World Homeopathy Day&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Mukesh Batra is recipient of Padma Shri award from the president of India. It’s 4th highest civilian award in India.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/2r4NCbqev0M&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/2r4NCbqev0M?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/2r4NCbqev0M/hqdefault.jpg&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Dr. Mukesh Batra receives the Padma Shri Award for Medicine, 2012&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;DD News is a Indian government funded news channel. It reports how homeopathy can treat respiratory problems&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/zhoDZrGj9Kc&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/zhoDZrGj9Kc?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/zhoDZrGj9Kc/hqdefault.jpg&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Homeopathy in treating respiratory problems (Hindi)&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;Claims that homeopathy can cure genetic disorders&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;iframe style=&quot;position: relative;  width: 100%;&quot; height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/x4_HjgUgvp4&amp;amp;autoplay=1&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}&amp;lt;/style&amp;gt;&amp;lt;a href=https://www.youtube.com/embed/x4_HjgUgvp4?autoplay=1&amp;gt;&amp;lt;img src=https://img.youtube.com/vi/x4_HjgUgvp4/hqdefault.jpg&amp;gt;&amp;lt;span&amp;gt;▶&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot; title=&quot;Genetic Disorders: Treating with homeopathy - Dr. Surekha Tiwari&quot;&gt;&lt;/iframe&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;div&gt;
    &lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
    &lt;p&gt;I always believed there were two system of medicine. Modern medicine &amp;amp; traditional medicine. However, I have realized that there’s only one system of medicine - Medicine that works.&lt;/p&gt;
    &lt;p&gt;If an herb in Ayurveda can cures an illness, it becomes part of modern medicine like Sarpagandha is used in treatment of systolic hypertension. Artemisinin inhibits malaria parasite has been part of Chinese Traditional Medicine. Yoga has been demonstrated to increase mental and physical benefits.&lt;/p&gt;
    &lt;p&gt;Many countries are discontinuing funding to homeopathy for example France will end reimbursing of homeopathic patient by 2021, Spain in 2018 plans to ban homeopathy, etc. I was surprised to find homeopathy medicine in CVS, a common drugstore in the US. I came across the news that a lawsuit has been filed by the Center for Inquiry (CFI) against this practice&lt;sup&gt;&lt;a href=&quot;#fn:5&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;It&apos;s unethical for the government of India to continue to promote homeopathy. Indian budget 2019 allocated ₹ 62,398 crore for health sector. AYUSH ministry got ₹ 1,939.76 crore which is 15 per cent more than the previous fiscal&lt;sup&gt;&lt;a href=&quot;#fn:6&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;. It&apos;s a boon for politicians as they can delude India masses by providing them substandard healthcare with less expense. It&apos;s ironical that most of Indian politicians continue to go abroad for their medical care.&lt;/p&gt;
    &lt;p&gt;Investing in modern science requires both capital &amp;amp; extensive research in R&amp;amp;D. Successive Indian government have tried to use ancient past to hide their failures. Vedic Mathematics, documentary by K. Jagjivan Ram, won the 48th National Film Awards for the best scientific film by the government of India. Vedic mathematics has nothing do with either mathematics or vedas&lt;sup&gt;&lt;a href=&quot;#fn:7&quot; rel=&quot;footnote&quot;&gt;7&lt;/a&gt;&lt;/sup&gt;. Promotion of yoga is great, but obsession on research on cow&lt;sup&gt;&lt;a href=&quot;#fn:8&quot; rel=&quot;footnote&quot;&gt;8&lt;/a&gt;&lt;/sup&gt; is unwarranted. Instead of splurging money on researching on Ganga water&apos;s&lt;sup&gt;&lt;a href=&quot;#fn:9&quot; rel=&quot;footnote&quot;&gt;9&lt;/a&gt;&lt;/sup&gt; miraculous properties, it would be prudent for the government of India to clean the river first plagued by serious pollution&lt;sup&gt;&lt;a href=&quot;#fn:10&quot; rel=&quot;footnote&quot;&gt;10&lt;/a&gt;&lt;/sup&gt;. Homeopathy is one such tomfoolery which India must get rid sooner for her own good.&lt;/p&gt;
    &lt;/div&gt;
    &lt;!--end_of_post --&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://zenodo.org/record/1035885#.XveHF-hKg2x&quot; target=&quot;_blank&quot;&gt;Homeopathy is unscientific&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://health.economictimes.indiatimes.com/news/industry/for-the-first-time-in-the-world-we-are-using-homeopathy-for-genetics-dr-mukesh-batra/64657541&quot; target=&quot;_blank&quot;&gt;Homeopathy Genetics India Times&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://onlinelibrary.wiley.com/doi/full/10.1111/ijcp.12026&quot; target=&quot;_blank&quot;&gt;Online Library&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.nccih.nih.gov/health/homeopathy&quot; target=&quot;_blank&quot;&gt;NCCIH&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:4&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://centerforinquiry.org/press_releases/cfi-sues-cvs/&quot; target=&quot;_blank&quot;&gt;CFI&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:5&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://economictimes.indiatimes.com/news/economy/policy/budget-2019-in-fillip-to-traditional-medicine-ayush-ministry-gets-rs-1939-76-crore/articleshow/70094965.cms&quot; target=&quot;_blank&quot;&gt;Budget 2019&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:6&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:7&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.thehindu.com/opinion/op-ed/nothing-vedic-in-vedic-maths/article6373689.ece&quot; target=&quot;_blank&quot;&gt;Vedic Math&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:7&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:8&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://dst.gov.in/callforproposals/call-proposal-sutra-pic-india-program&quot; target=&quot;_blank&quot;&gt;PIC India Program&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:8&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:9&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://timesofindia.indiatimes.com/india/govt-body-wants-research-on-spl-properties-of-ganga-water/articleshow/75566538.cms&quot; target=&quot;_blank&quot;&gt;Gov spending on Ganga water research&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:9&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:10&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.reuters.com/article/us-india-ganges/indias-federal-auditor-slams-modis-slow-ganges-clean-up-idUSKBN1EN0LL&quot; target=&quot;_blank&quot;&gt;India&apos;s federal auditor slams Modi&apos;s slow Ganges clean-up&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:10&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2020-06-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/homeopathy-india</link>
<guid isPermaLink="true">https://randomwits.com/blog/homeopathy-india</guid>
</item>
<item>
  <title>Demon Haunted World&apos;s review part 1</title>
  <description>&lt;p&gt;This is my Part 1 of the review of Carl Sagan&apos;s book, Demon-Haunted World. This is more of my commentary rather than a review of the book.&lt;/p&gt;
    &lt;p&gt;I have begun to realize how many posts on Facebook, Whatsapp, etc contains pseudoscience and misinformation. Few posts are easy to debunk. Magic water curing cancer is a no-brainer. However other posts are too meticulous to debunk. I thought it might be fruitful for me as a layman to learn critical &amp;amp; skeptical thinking from a famous astrophysicist, Carl Sagan.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2020-04-11-demon-haunted-review-1.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;!--begin_of_post --&gt;
    &lt;p&gt;This is my Part 1 of the review of Carl Sagan&apos;s book, Demon-Haunted World. This is more of my commentary rather than a review of the book.&lt;/p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/jqKRwJx.jpg&quot; alt=&quot;Book cover image&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;I have begun to realize how many posts on Facebook, Whatsapp, etc contains pseudoscience and misinformation. Few posts are easy to debunk. Magic water curing cancer is a no-brainer. However other posts are too meticulous to debunk. I thought it might be fruitful for me as a layman to learn critical &amp;amp; skeptical thinking from a famous astrophysicist, Carl Sagan.&lt;/p&gt;
    &lt;p&gt;One day, Carl Sagan is received at the airport by his driver. On learning that he is a scientist, the driver is curious to ask lots of scientific questions? Are aliens (UFO) hiding in the Air Force Base? Was an advanced civilization living in an island Atlantis only to be destroyed by the flood? Are the prophecy of Nostradamus accurate?&lt;/p&gt;
    &lt;p&gt;Carl Sagan replied that the &quot;evidence is crummy&quot; for all these theories.&lt;/p&gt;
    &lt;p&gt;As a Hindu, I care less about Noah&apos;s Ark or the existence of shroud of Turin. I was fascinated more about whether Ram Setu was natural or man-made? I saw frequent posts on my Facebook on how NASA has confirmed that it&apos;s an ancient bridge. Though NASA said that its satellite photos had been egregiously misinterpreted to make this point (The images reproduced on the websites may well be ours, but their interpretation is certainly not ours). Ram Setu is mentioned in Sanskrit Epic Ramayana (7th century BCE). Hindus believe that the structure was constructed by god Ram.&lt;/p&gt;
    &lt;p&gt;Later I realized people of other religions did the same. Some Muslims claim that the NASA photograph of Rima Ariadaeus, the 300 km-long rift line on the surface of the Moon, confirms the splitting of the moon mentioned in the Quran. Many Christian claims of geological evidence of Noah&apos;s Ark in Eastern Turkey. Most Muslims would probably care about the miraculous properties of &lt;a href=&quot;https://en.wikipedia.org/wiki/Zamzam_Well&quot;&gt;ZamZam&lt;/a&gt; water. Hindus would care more about the piousness of &lt;a href=&quot;https://en.wikipedia.org/wiki/Ganges&quot;&gt;Ganga water&lt;/a&gt;. Chrisitan would consider water sanctified by a priest to be holy.&lt;/p&gt;
    &lt;p&gt;Every religion has its dogmas &amp;amp; beliefs. All religions contradict each other in some way. So which religion is the truth? It&apos;s a biological accident that you were born into your religion. Some religion vigorously proselytizes (like Christianity, Islam) while some don&apos;t (like Jainism).&lt;/p&gt;
    &lt;p&gt;Why does evil exist in the world? People suffer in all religions. There are poor Christians, Muslims, Hindus, Jews, etc. Of course, the opposite is also true. There are rich Christians, Hindus, Muslims, etc. But is prosperity yardstick to judge the correctness of a religion? There are lots of poor nations due to colonialism &amp;amp; other historical reason.&lt;/p&gt;
    &lt;p&gt;Do all atheists have pores in their body &amp;amp; suffering from epilepsy due to their renunciation of god? You won&apos;t become Bill Gates just because you converted to Christianity. Nor would you become a business magnate like Mukesh Ambani just because you converted to Hinduism. Of course, televangelist often claims otherwise.&lt;/p&gt;
    &lt;blockquote&gt;
    Religion is the opium of the masses - Karl Marx
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Here&apos;s a thought experiment. It might be insensitive but I hope the hypothesis are usually protected under freedom of speech. Assemble each person from all religions of the world on a plane &amp;amp; fly up to the Stratosphere. While close to 128,000 feet, throw all persons off the plane without parachute. In the meantime, ask people of all religions to earnestly pray for the person of their respective religion. Prayers for the &quot;only true&quot; religion should save the right person. Gravity would disappear allowing the person to levitate &amp;amp; reach the ground unhurt.&lt;/p&gt;
    &lt;p&gt;If you have common sense you already know experimental result of this hypothesis. Laws of physics are never suspended for anyone. Even microbes doesn&apos;t discriminate. A pious person has equal chances of catching a flu like a sinner. That&apos;s the reason why all social gathering, church, temples, mosques, bus, trains, restaurants, etc have been suspended around the world during Coronavirus pandemic.&lt;/p&gt;
    &lt;p&gt;Carl Sagan explains how ineffective prayers are, &quot;If a person suffers from Cholera, you could just pray or give him 500 mg of tetracycline. If he suffers from Schizophrenia, you could just pray or give him 500 mg of clozapine.&quot; There is no emperical evidence that prayers works other than placebo.&lt;/p&gt;
    &lt;p&gt;I fail to understand why people romanticize the past. My mother often complains about how children in the past were more obedient. My grandfather uses to say that people living in the past had a life span of more than hundred years due to pristine air. I agree that pollution &amp;amp; global warming are a recent crisis, but I fail to see how rosy life was thousands of years ago.&lt;/p&gt;
    &lt;p&gt;A classic example is of Queen Anne, British monarch of eighteen century. She was pregnant eighteen times out of which only five children survived. Another royal example is of Mumtaj Mahal, 4&lt;sup&gt;th&lt;/sup&gt; wife of Shan Jahan, an Indian Mughal Emperor in the seventeenth century. She bore thirteen children. Seven of the children died at birth or at a very young age.&lt;/p&gt;
    &lt;p&gt;If the royal families of the past had to endure such tragic pregnancies, I wonder how tragic was childbirth for poor families. Techniques like Cesarean deliveries, vacuum-assisted vaginal deliveries, ultrasound, sonogram etc have saved countless lives.&lt;/p&gt;
    &lt;p&gt;Thought science has advanced humanity, it has also poses threat to the world like&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Global warming&lt;/li&gt;
    &lt;li&gt;Nuclear weapons&lt;/li&gt;
    &lt;li&gt;Agent Orange&lt;/li&gt;
    &lt;li&gt;Nerve gas&lt;/li&gt;
    &lt;li&gt;CFC&lt;/li&gt;
    &lt;li&gt;Thalidomide, etc&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;However scientific literacy among politicians can help them make rational decision that are sustainable for the environment. For example Margaret Thatcher, British Prime Minister, played a significant role in advocating ban of CFCs.&lt;/p&gt;
    &lt;p&gt;DuPont was the largest producer of CFCs in the world. Sherry Rowland and Mario Molina discovered in 1974 how CFCs were responsible for ozone depletion. However, DuPont refused to accept the findings of Rowland and Molina&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. Margaret Thatcher had a Ph.D. in Chemistry under the tutelage of Dorothy Hodgkin, a Nobel laureate. She was instrumental in advocating a ban on CFCs worldwide. Here&apos;s &lt;a href=&quot;https://www.margaretthatcher.org/document/108133&quot;&gt;link&lt;/a&gt; to her speech at Ozone Layer Conference.&lt;/p&gt;
    &lt;p&gt;For rest of book, I am tracking my progress &lt;a href=&quot;/books&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
    &lt;!--end_of_post --&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://dust.ess.uci.edu/ppr/ppr_Smi98.pdf&quot; target=&quot;_blank&quot;&gt;DuPont Ethics&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2020-04-11T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/demon-haunted-review-1</link>
<guid isPermaLink="true">https://randomwits.com/blog/demon-haunted-review-1</guid>
</item>
<item>
  <title>Connecting to Oracle database form Scala using JDBC for large data</title>
  <description>&lt;p&gt;I was looking to write a scala script to fetch large data from Oracle database. I was earlier using the Alteryx software to fetch data (around 1 million rows) from oracle which took around 7 minutes. Licensed softwares like Alteryx or Informatica, etc are great, but I was looking for a free solution.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I was looking to write a scala script to fetch large data from Oracle database. I was earlier using the Alteryx software to fetch data (around 1 million rows) from oracle which took around 7 minutes. Licensed softwares like Alteryx or Informatica, etc are great, but I was looking for a free solution.&lt;/p&gt;
    &lt;p&gt;We need ojdbc6.jar to connect to the Oracle 12 c database. We will create a Scala script to fetch data from the oracle database &amp;amp; save it to the output file (CSV format).&lt;/p&gt;
    &lt;p&gt;Lets create a simple function &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;timed&lt;/code&gt; to time our execution&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/19b89ae593a079fea029924216dd490e.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Now create  function &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;connOracle&lt;/code&gt; to connect to Oracle&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/2095d844b5b48639bb612cf5ec332f21.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;This took me &lt;em&gt;150  minutes&lt;/em&gt; to fetch data 1 million records. That was not the performance I was looking for 😟&lt;/p&gt;
    &lt;p&gt;However I realized that I can increase JDBC performance by tweaking optimal fetch value. The default fetch size is 10 for JDBC. Since I have more than million rows in the database, I should increase the fetch size to 1000.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/04c35e6a858012c8969b6071f9c736aa.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;The execution time improved drastically  and reduced to approx &lt;em&gt;8 minutes&lt;/em&gt;.&lt;/p&gt;
    &lt;p&gt;Lastly it’s trivial to save the output to flat file (CSV format)&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/a47b868d724e24fef187e3d994db451e.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;Also below is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;build.sbt&lt;/code&gt; for resolving dependency&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;name :&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; “Oracle Connection”
    Version :&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; “0.1”
    scalaVersion :&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; “2.12.4”
    libraryDependencies +&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; “au.com.bytecode” % “opencsv” % “2.4”
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2020-03-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/oracle-scala-csv</link>
<guid isPermaLink="true">https://randomwits.com/blog/oracle-scala-csv</guid>
</item>
<item>
  <title>Sleeping At Night</title>
  <description>&lt;p&gt;It feels great to sleep at night. I have a small but a cozy room. It’s not lavish or splending. It doesn’t even hoard much furniture. However it’s as peaceful as it can get.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;It feels great to sleep at night. I have a small but a cozy room. It’s not lavish or splending. It doesn’t even hoard much furniture. However it’s as peaceful as it can get.&lt;/p&gt;
    &lt;p&gt;I wonder about those unfortunate people who couldn’t sleep at night. Some of them are stuck in war-torn countries. Around 150 million people are homeless in the world. Astonishing 1.6 billion people don’t have proper housing. That’s 20 percent of the entire human population.&lt;/p&gt;
    &lt;p&gt;My parents were living on a rented house when I was born. Had they been poorer, I might have dwelled in some slum. How did I escape the abject poverty? It&apos;s simple it was a biological accident that I had a prenatal privilege. Around 1 in 50 people are born with genetic disorder in the world. I again won a gene lottery to escape those pangs of misfortune. All men are created equal, they say, only if they had the same lottery of genes &amp;amp; privileges.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;https://images.fastcompany.net/image/upload/w_1280,f_auto,q_auto,fl_lossy/wp-cms/uploads/2018/10/p-1-army-sleep.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;As a kid I once went with my father to a far relative to spend a few days. Their house was close to the railway stations. Every hour or so  I could hear the loud whistle of the train breezing past. I couldn&apos;t sleep for those days. Once I was back to my home, I slept like a sloth &amp;amp; dreams were like manna from heaven. I wonder how people slept in such apartments?&lt;/p&gt;
    &lt;p&gt;Currently I sleep in my apartment at night without the annoyance of traffic or train. Though I fear burglary, but not enough to lose my sleep. I believe sleeping without fear is a human right. It’s a privilege that I am grateful everyday.&lt;/p&gt;
  </description>
  <pubDate>2020-03-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/sleep-at-night</link>
<guid isPermaLink="true">https://randomwits.com/blog/sleep-at-night</guid>
</item>
<item>
  <title>Connect to an Oracle Database using kerberos with python</title>
  <description>&lt;p&gt;Jobs failed! Screamed an automatic failure alert in email inbox. Existing python scripts were failing in the server which fetched data from Oracle database. I wondered if the credentials had changed.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Jobs failed! Screamed an automatic failure alert in email inbox. Existing python scripts were failing in the server which fetched data from Oracle database. I wondered if the credentials had changed.&lt;/p&gt;
    &lt;p&gt;After few emails back and forth with the Support team, I discoverd that the server had been upgraded with Kerberos authentication. I have to modify my scripts to support kerberos authentication. I have to dig up more to understand more about kerberos.&lt;/p&gt;
    &lt;h2 id=&quot;whats-a-kerberos&quot;&gt;What&apos;s a Kerberos?&lt;/h2&gt;
    &lt;p&gt;Kerberos is a system for authenticating access to services.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;The caller to a service represent a  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;principal&lt;/code&gt; in the system&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Caller to a service has been granted right on behalf of a principal for a limited period of a time&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;connectiong-to-oracle-without-kerberos&quot;&gt;Connectiong to Oracle without kerberos&lt;/h2&gt;
    &lt;h3 id=&quot;get-host-ip-address&quot;&gt;Get Host IP address&lt;/h3&gt;
    &lt;p&gt;Connect to your host server which is hosting the oracle database. For my setup, I was using RedHat Server. Get the host IP address &amp;amp; use it as $HOSTNAME&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;hostname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;download-jdbc-driver&quot;&gt;Download JDBC driver&lt;/h3&gt;
    &lt;p&gt;I am using Oracle thin client-side JDBC driver (ojdbc6.jar) for Oracle 12c. You can download the drivers from &lt;a href=&quot;https://www.oracle.com/database/technologies/jdbc-drivers-12c-downloads.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
    &lt;h3 id=&quot;create-a-config-file&quot;&gt;Create a config file&lt;/h3&gt;
    &lt;p&gt;Let&apos;s create a config.json used for our script &amp;amp; replace $HOSTNAME, $PORT_NUMBER, $SERVICE_NAME, $USERNAME, $PASSWORD respectively.&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;_hostname&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOSTNAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;_portnumber&quot;&lt;/span&gt;: &lt;span class=&quot;nv&quot;&gt;$PORT_NUMBER&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;_service_name&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$SERVICE_NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;_username&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$USERNAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;_password&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PASSWORD&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;_jdbc_jar&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;ojdbc6.jar&quot;&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;_jdbc_class&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;oracle.jdbc.OracleDriver&quot;&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;_jdbc_url&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;jdbc:oracle:thin:@//{}:{}/{}&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;parse-config-file&quot;&gt;Parse config file&lt;/h3&gt;
    &lt;p&gt;Let&apos;s create a simple python script to parse config file&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b2bdbbdd2648c4737a2f37630e5026ee.js?file=ex1.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;establishing-a-connection&quot;&gt;Establishing a connection&lt;/h3&gt;
    &lt;p&gt;Let us try to connect to oracle database using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jaydebeapi&lt;/code&gt; library.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b2bdbbdd2648c4737a2f37630e5026ee.js?file=ex2.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;However while running the script, you will get the following error&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ORA-01017: invalid username/password&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; logon denied
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h3 id=&quot;connecting-to-oracle-with-kerberos&quot;&gt;Connecting to Oracle with Kerberos&lt;/h3&gt;
    &lt;p&gt;To connect to Oracle database using kerberos, we need the following&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;kerberos principal&lt;/li&gt;
    &lt;li&gt;keytab file&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Assuming that the oracle is already configured to use kerberos,&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ssh &lt;span class=&quot;nv&quot;&gt;$HOSTNAME&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kinit
    &lt;span class=&quot;c&quot;&gt;# you should get prompt like username@MYDOMAIN.com&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# username@MYDOMAIN.com is the kerberos principal&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Ketyab file is a binary file containing pairs of Kerberos principals and encrypted keys use to authenticate to the server. It should be provided by the IT administrator. Else you can generate it like this&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ktutil
    addent &lt;span class=&quot;nt&quot;&gt;-password&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; username@MYDOMAIN.com &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; 1 &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; RC4-HMAC
    &lt;span class=&quot;c&quot;&gt;# - enter password for username -&lt;/span&gt;
    wkt username.keytab
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;This will create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;username.keytab&lt;/code&gt; file on the system. Use can verify if the file is valid&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# check if existing ticket&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;klist
    &lt;span class=&quot;c&quot;&gt;# remove the ticket&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kdestroy
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kinit &lt;span class=&quot;nt&quot;&gt;-kt&lt;/span&gt; username.keytab username@MYDOMAIN.com
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;if you got no errors till these steps, you can copy the file to your test folder&lt;/p&gt;
    &lt;h3 id=&quot;full-code-to-use-kerberos&quot;&gt;Full code to use kerberos&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/b2bdbbdd2648c4737a2f37630e5026ee.js?file=full_code.py&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;using-docker&quot;&gt;Using Docker&lt;/h3&gt;
    &lt;p&gt;As if &lt;a href=&quot;https://github.com/krbcontext/python-krbcontext/issues/33#issuecomment-569232653&quot;&gt;now&lt;/a&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;krbcontext&lt;/code&gt; library only supports Linux like OS. So we can use Docker to run the python script on windows&lt;/p&gt;
    &lt;div class=&quot;language-dockerfile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; alpine:3.7&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;### 2. config&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; WORKPATH /usr/src/project&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;WORKDIR&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; $WORKPATH&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;### 3. setup for the $WORKPATH&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;COPY&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; ./krbOracle.py $WORKPATH&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;COPY&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; ./SharmaT1.keytab $WORKPATH&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;COPY&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; ./ojdbc6.jar $WORKPATH&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;COPY&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; ./config.json $WORKPATH&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;### 4. installing req libraries&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;apk add &lt;span class=&quot;nt&quot;&gt;--update&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\
    &lt;/span&gt;    python3 &lt;span class=&quot;se&quot;&gt;\
    &lt;/span&gt;    python3-dev &lt;span class=&quot;se&quot;&gt;\
    &lt;/span&gt;    py-pip &lt;span class=&quot;se&quot;&gt;\
    &lt;/span&gt;    build-base &lt;span class=&quot;se&quot;&gt;\
    &lt;/span&gt;    openjdk8-jre &lt;span class=&quot;se&quot;&gt;\
    &lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; pip3 &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--upgrade&lt;/span&gt; pip setuptools &lt;span class=&quot;se&quot;&gt;\
    &lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; /var/cache/apk/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;apk &lt;span class=&quot;nt&quot;&gt;--update&lt;/span&gt; add krb5-dev
    &lt;span class=&quot;c&quot;&gt;### uncomment these lines if kerberos complain following error&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;### error :  Clock skew too great&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;### set the timezone accordingly&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# ENV TZ=America/New_York&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &amp;amp;&amp;amp; echo $TZ &amp;gt; /etc/timezone&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;### 5. set the environment&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; JAVA_HOME /usr/lib/jvm/java-1.8-openjdk&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; LD_LIBRARY_PATH /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/default-jvm/lib/amd64/jli&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;### 6. exports&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;JAVA_HOME
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;PATH
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;LD_LIBRARY_PATH
    &lt;span class=&quot;c&quot;&gt;### 7. install python libraries&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;pip3 &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;jaydebeapi
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;pip3 &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;krbcontext
    &lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;pip3 &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;JPype1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;0.6.3 &lt;span class=&quot;nt&quot;&gt;--force-reinstall&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;### 8. run the script&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;ADD&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; krbOracle.py /&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;CMD&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; [ &quot;python3&quot;, &quot;./krbOracle.py&quot;]&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You can build &amp;amp; run the dockerfile&lt;/p&gt;
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker build &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; tshrocks/krboracle &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker run &lt;span class=&quot;nt&quot;&gt;-it&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--rm&lt;/span&gt; tshrocks/krboracle
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2020-01-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/python-oracle-kerberos</link>
<guid isPermaLink="true">https://randomwits.com/blog/python-oracle-kerberos</guid>
</item>
<item>
  <title>Unwarranted Controversy - Hum Dekhenge</title>
  <description>&lt;p&gt;India is currently witnessing multiple protests against the Citizenship Amendment Act (CAA) passed by the BJP (the ruling party of India). In a nutshell it fast tracks citizenship to few religiously persecuted refugees like Hindu, Sikh, Jain, Buddhist, Christian and Parsi from neighbouring countries.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;India is currently witnessing multiple protests against the Citizenship Amendment Act (CAA) passed by the BJP (the ruling party of India). In a nutshell it fast tracks citizenship to few religiously persecuted refugees like Hindu, Sikh, Jain, Buddhist, Christian and Parsi from neighbouring countries.&lt;/p&gt;
    &lt;p&gt;Some argue this act brazenly violates secular structure of India by explicitly inserting religious clause in the constitution. Others are worried that CAA along with NPR &amp;amp; NRC could be used to disenfranchise poor Muslims who lack proper documentation. I will defer my opinion on this matter for another day. However I fail to understand how innocuous poem of Faiz, &lt;a href=&quot;https://en.wikipedia.org/wiki/Hum_Dekhenge&quot;&gt;Hum Dekhenge&lt;/a&gt;, is mired in controversy.&lt;/p&gt;
    &lt;p&gt;It all started when a video of a student in IIT Kanpur reciting Faiz&apos;s poem when viral on Twitter.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;blockquote class=&quot;twitter-tweet&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;A faculty at IIT Kanpur has submitted this video and a complaint to director, alleging anti-India &amp;amp; communal statements made at a recent event held in &amp;#39;solidarity with Jamia&amp;#39; &amp;amp; that event held without permission.&lt;br /&gt;&lt;br /&gt;&amp;quot;When All Idols Will Be Removed...&lt;br /&gt;Only Allah’s Name Will Remain&amp;quot; &lt;a href=&quot;https://t.co/fbmNFwVBiw&quot;&gt;pic.twitter.com/fbmNFwVBiw&lt;/a&gt;&lt;/p&gt;&amp;mdash; Swati Goel Sharma (@swati_gs) &lt;a href=&quot;https://twitter.com/swati_gs/status/1208244364364763136?ref_src=twsrc%5Etfw&quot;&gt;December 21, 2019&lt;/a&gt;&lt;/blockquote&gt; &lt;script async=&quot;&quot; src=&quot;https://platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;Following are the lines of the poems which are deemed controversial&lt;/p&gt;
    &lt;blockquote&gt;
    Sab but uthwae jaenge &lt;br /&gt;
    Hum ahl-e-safa mardood-e-harm&lt;br /&gt;
    Masnad pe bethae jaenge&lt;br /&gt;
    Sab taaj uchale jaenge&lt;br /&gt;
    Sab takht girae jaenge&lt;br /&gt;
    Bas naam rahega Allah ka&lt;br /&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;These lines loosely translates to&lt;/p&gt;
    &lt;blockquote&gt;
    When idols will be taken out,&lt;br /&gt;
    When we the faithful-who have been barred out of sacred places&lt;br /&gt;
    will be seated on high cushions&lt;br /&gt;
    When the crowns will be tossed,&lt;br /&gt;
    When the thrones will be brought down.&lt;br /&gt;
    Only Allah  name will survive&lt;br /&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;My inability to undertand Urdu compelled me to seek help of English translator. However I failed to see how the poem maligns Hinduism. Faiz was a communist in Pakistan yet he was culturally a Muslim. So it was but obvious that he draws inspiration from Islam. He used his poem to protest against the oppressive regime of &lt;strong&gt;Zia Ul Haq&lt;/strong&gt;, a military dictator. Zia imposed many bans including on sarees for being anti-Islamic. &lt;strong&gt;Iqbal Bano&lt;/strong&gt;, a famous Ghazal singer, wore Saree thus defying the ban &amp;amp; sang the poem at the Lahore Alhamra Arts Council in 1985.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://im.idiva.com/content/2020/Jan/A-History-Lesson-About-Iqbal-Bano-Who-First-Sang-Hum-Dekhenge-In-Protest-iDiva-Lead_5e16bcba7cb36.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;Since idols are sacred in Hinduism but a sin in Islam so some Hindus have objected to the allegory which glorifies idol destruction. Anybody who has studied comparative religion, can argue that almost all religions contradict themselves. So allegory from one religion can’t be extrapolated to other religious beliefs. And that’s okay because we as human beings have learned to co exist despite our difference in beliefs &amp;amp; convictions.&lt;/p&gt;
    &lt;p&gt;In hindsight, it might be prudent for Faiz to use generic word for God like &lt;a href=&quot;https://en.wikipedia.org/wiki/Khuda&quot;&gt;Khuda&lt;/a&gt; instead of Islamic god &lt;strong&gt;Allah&lt;/strong&gt;. But it&apos;s Faiz&apos;s preporgative to choose appropriate words which adorn his poetry. Since Poetry has multiple interpretations, so cherry picking few lines of a poem without context is problematic. The poem also talks about &lt;a href=&quot;https://en.wikipedia.org/wiki/Anal_Haq&quot;&gt;Anā al-Ḥaqq &lt;/a&gt; which is considered a heresy by fundamentalist Muslims.&lt;/p&gt;
    &lt;p&gt;In Somali, a Muslim extremist group banned samosas (a delicacy) as it resembles Trinity. Some Christian fundamentalists suggests against practicing Yoga since they believe it&apos;s a work of the devil. Some fringe Hindu group are trying to stop celebration of Christmas. World is full of such lunatic people. They are mostly insecure about their culture &amp;amp; suffer from xenophobia.&lt;/p&gt;
    &lt;p&gt;I&apos;ve a short life on earth &amp;amp; have no time for such bigotry. So I enjoy beautiful things from all cultures. In the end, I&apos;ll share a rendition of the poem by Coke Studio which you might enjoy&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;figure&gt;
    &lt;iframe height=&quot;500&quot; src=&quot;https://www.youtube.com/embed/unOqa2tnzSM&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;position: relative;  width: 100%;&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
    &lt;/figure&gt;
    &lt;/center&gt;
    &lt;/p&gt;
  </description>
  <pubDate>2020-01-01T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/hum-dekhenge</link>
<guid isPermaLink="true">https://randomwits.com/blog/hum-dekhenge</guid>
</item>
<item>
  <title>Getting started with Graph Part 1</title>
  <description>&lt;p&gt;Graph are data structures made of vertices &amp;amp; edges. There are lots of interesting problems that can be solved using graphs. Part 1 covers the basic for creating a template for graph data structure.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Graph are data structures made of vertices &amp;amp; edges. There are lots of interesting problems that can be solved using graphs. Part 1 covers the basic for creating a template for graph data structure.&lt;/p&gt;
    &lt;p&gt;First we need to create a vertex. A vertex is a fundamental unit of graph. A graph is a set of points (vertices) connected by lines (edges).&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;https://i.imgur.com/KdU5gTZ.png&quot; alt=&quot;Graph image&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;create-a-vertex&quot;&gt;Create a vertex&lt;/h2&gt;
    &lt;p&gt;First we need to create a vertex. A vertex is a fundamental unit of graph. A graph is a set of points (vertices) connected by lines (edges).&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;represent-a-graph&quot;&gt;Represent a graph&lt;/h2&gt;
    &lt;p&gt;We need a data structure to represent our graph. We have two choices&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Adjacency Matrix&lt;/li&gt;
    &lt;li&gt;Adjacency List&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;So we have a graph like below&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/noden.png&quot; alt=&quot;one node in a graph&quot;  /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;using-adjaceny-matrix&quot;&gt;Using Adjaceny matrix&lt;/h2&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt; means edge between two vertex where as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; means no edge&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt; &lt;/td&gt;
    &lt;td&gt;**1**&lt;/td&gt;
    &lt;td&gt;**2**&lt;/td&gt;
    &lt;td&gt;**3**&lt;/td&gt;
    &lt;td&gt;**4**&lt;/td&gt;
    &lt;td&gt;**5**&lt;/td&gt;
    &lt;td&gt;**6**&lt;/td&gt;
    &lt;td&gt;**7**&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**1**&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**2**&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**3**&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**4**&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**5**&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**6**&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**7**&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h2 id=&quot;using-adjacency-list-well-be-using-this-for-efficiency&quot;&gt;Using Adjacency List (we&apos;ll be using this for efficiency)&lt;/h2&gt;
    &lt;p&gt;Here each vertex correspond to a linked list of outgoing edges&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**1** → 2, 3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**2** →  4, 5&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**3** →  6&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**4** → 7&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**5** → 7&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**6** → 5 , 7&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;**7**&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Graph&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//adjacency list&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;add-lots-of-vertex-or-vertices&quot;&gt;Add lots of vertex (or vertices)&lt;/h2&gt;
    &lt;p&gt;We now need to add add vertex (if it doesn&apos;t exist) to our graph using method &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addVertex&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;hasKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Graph&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//adjacency list&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entry&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;entrySet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;hasKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;put&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;());&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;add-edges&quot;&gt;Add Edges&lt;/h2&gt;
    &lt;p&gt;We need to add edges between two vertex (if not already existing)&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Graph&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entry&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;entrySet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;hasKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;is-that-it&quot;&gt;Is that it?&lt;/h2&gt;
    &lt;p&gt;Yup. It&apos;s a basic template for a simple graph. Below is the full code&lt;/p&gt;
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;hasKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Graph&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//adjacency list&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entry&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;entrySet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;hasKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;put&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;());&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;label2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entry&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;entrySet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;hasKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;adjList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Main&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;Graph&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//add vertices&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;4&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;6&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addVertex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;7&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//add edges&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;4&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;4&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;6&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;4&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;7&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;7&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;6&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;graph&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addEdge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;6&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;7&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;conculsion&quot;&gt;Conculsion&lt;/h2&gt;
    &lt;p&gt;It concludes Part 1 of graph series. Later series will cover much more operations on graph.&lt;/p&gt;
  </description>
  <pubDate>2019-11-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/graph-getting-started</link>
<guid isPermaLink="true">https://randomwits.com/blog/graph-getting-started</guid>
</item>
<item>
  <title>Recursively sort a array</title>
  <description>&lt;p&gt;I recently came across a simple telephonic interview problem. The problem was to sort an array recursively. But even numbers need to be placed before odd numbers. At first glance it was obvious that it was a simple case of implementation of merge sort.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I recently came across a simple telephonic interview problem. The problem was to sort an array recursively. But even numbers need to be placed before odd numbers. At first glance it was obvious that it was a simple case of implementation of merge sort.
    &lt;/p&gt;
    &lt;h3 id=&quot;create-an-array-that-needs-to-be-sorted&quot;&gt;Create an array that needs to be sorted&lt;/h3&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/f7d4dabc928d719367ab5cb3cc2a5dcf.js?file=Rec1.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;merge-sort&quot;&gt;Merge sort&lt;/h3&gt;
    &lt;p&gt;If you are unfamiliary with merge sort, we just break the array into sub parts and later combine them based on our criteria. Here, we will maintiain left and right pointer which keeps track of the end of the array. Initially, the left is equal to 0 and right equals to the last element of the array.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/f7d4dabc928d719367ab5cb3cc2a5dcf.js?file=Rec2.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;We calculate a mid point and recursively call the method twice one half of array and another half of array. lastly we add the crux of our logic in merge sort.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/f7d4dabc928d719367ab5cb3cc2a5dcf.js?file=Rec3.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;As per our requirement we need to sort even arrays before odd arrays, so we need to have a method to check that.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/f7d4dabc928d719367ab5cb3cc2a5dcf.js?file=Rec4.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;Lastly we need to write our merge method.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/f7d4dabc928d719367ab5cb3cc2a5dcf.js?file=Rec5.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;h3 id=&quot;what-is-the-complexity-of-the-program&quot;&gt;What is the complexity of the program&lt;/h3&gt;
    &lt;p&gt;It&apos;s a recursive algorithm , so we need a recurrence&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/rec.png&quot; /&gt;&lt;/p&gt;
  </description>
  <pubDate>2019-09-07T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/recursive-sort</link>
<guid isPermaLink="true">https://randomwits.com/blog/recursive-sort</guid>
</item>
<item>
  <title>Red Queen Race</title>
  <description>&lt;p&gt;When I was a kid, I was perturbed at the outbreaks of new diseases. There was no &lt;b&gt;Swine Flue&lt;/b&gt; before twenty first century or &lt;b&gt;HIV&lt;/b&gt; before tenth century. Why nature was hell-bent in pulling diseases out of a hat everytime humans make progress in science?&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;When I was a kid, I was perturbed at the outbreaks of new diseases. There was no &lt;strong&gt;Swine Flue&lt;/strong&gt; before twenty first century or &lt;strong&gt;HIV&lt;/strong&gt; before tenth century. Why nature was hell-bent in pulling diseases out of a hat everytime humans make progress in science?&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;https://teepee12.files.wordpress.com/2014/06/alice-red-queen.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Naively I belived that new diseases were nature&apos;s way of pushing against human&apos;s advancement in science. Nature had to ensure that human&apos;s dont overflow the planet. I belived in Rita (Sanskrit ṛta ), a cosmic order of the universe. The wheel of dharma(duty) &amp;amp; karma (accumulated effects of good and bad actions) somehow illusioned to maintain harmony in the world. But evolution shattered my perception of reality.&lt;/p&gt;
    &lt;p&gt;A famous poem &quot;In Memorial A.H.H&quot; by Lord Alfred Tennyson tries to reconcile with the violent natural world&lt;/p&gt;
    &lt;blockquote&gt;
    Who trusted God was love indeed&lt;br /&gt;
    And love Creation&apos;s final law&lt;br /&gt;
    Tho&apos; Nature, red in tooth and claw&lt;br /&gt;
    With ravine, shriek&apos;d against his creed&lt;br /&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Darwinian nature&apos;s is not beingn. Natural selection, the chisel of nature, leads to increase in frequency of genes (allele) which are more reproducible. Thus both prey or predators evolve in a arm race to counter each other. But not all evolution benefit the species.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;https://news.nationalgeographic.com/content/dam/news/2015/12/cavefish.ngsversion.1441823512384.adapt.1900.1.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;A classic case of blind cave fish shows how evolution lacks any ultimate purpose. Over the past few million years, blind forms of the Mexican tetra (Astyanax mexicanus) have evolved in caves. The fish subsequently have lost their eyes after mutations disabled key genes. This trait helped fish to save energy.&lt;/p&gt;
    &lt;p&gt;The reason new diseases outbreaks is due to fast generic mutation of the pathogens. It&apos;s estimated that evolution of a bacteria in a day is equivalent of evolution of human in thousand years. That is the reaons why many antibiotic become useless after certain amount of time example staphylococcal bacteria was very vunerable to penicillin in 1941. Currently ninety five percent of staphylococcal bacteria are resistent to penicillin&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Lewis Caroll was not only a world famous children&apos;s writer but also a mathematician. Hence it&apos;s not surprising to find intriguing logics in his writings. One such writing that I stumbled upon was an incident that appears in Lewis Carroll&apos;s Through the Looking-Glass.&lt;/p&gt;
    &lt;blockquote&gt;
    &quot;Well, in our country,&quot; said Alice, still panting a little, &quot;you&apos;d generally get to somewhere else—if you run very fast for a long time, as we&apos;ve been doing.&quot;&lt;br /&gt;&lt;br /&gt;
    &quot;A slow sort of country!&quot; said the Queen. &quot;Now, here, you see, it takes all the running you can do, to keep in the same place. If you want to get somewhere else, you must run at least twice as fast as that!&quot;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Leigh Van Valen, an evolutionary biologist, proposed Red Queen hypothesis that captures arms race between co-evolving species. Coevolution leads to situations where the probabily of extinction is relatively constant over millions of years(Van Valen 1973). In tightly coevolved interactions, evolutionary change of one species could lead to extinction of other species. The longer evolutionary history is neither better adopter or less adapted. So evolution doesn&apos;t have a progressive quality. The species thus have to run(evolve) to remain in the same place (extant)&lt;sup&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;I wonder about the arm race between humans and pathogens. Will we evolve to develop invincible defense mechanism against pathogens? Or will the human race plumment to its tiniest microscopic foe? Most pathogens eventually develop resistance against antibiotics. World Health Organization have classified antimicrobial resistance as a &quot;serious threat [that] is no longer a prediction for the future, it is happening right now in every region of the world and has the potential to affect anyone, of any age, in any country&quot;&lt;sup&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;Why we get sick ? by Randolph M. Nesse&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.indiana.edu/~curtweb/Research/Red_Queen%20hyp.h&quot; target=&quot;_blank&quot;&gt;Red Queen Hypothesis&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://apps.who.int/iris/bitstream/handle/10665/112642/9789241564748_eng.pdf;jsessionid=A33A2486ED8B2999A6E44FE20B7EE1F2?sequence=1&quot; target=&quot;_blank&quot;&gt;WHO&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2019-05-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/red-queen-race</link>
<guid isPermaLink="true">https://randomwits.com/blog/red-queen-race</guid>
</item>
<item>
  <title>Merge Two Sorted Lists</title>
  <description>&lt;style type=&quot;text/css&quot;&gt;
    .myheading{font-family:Georgia, &quot;Times New Roman&quot;, Times, serif;font-size:24px;margin-top:5px;margin-bottom:0;text-align:center;font-weight:400;color:#222}
    .mysubheading{font-family:&quot;Lucida Grande&quot;, Tahoma;font-size:10px;font-weight:lighter;font-variant:normal;text-transform:uppercase;color:#666;margin-top:10px;text-align:center!important;letter-spacing:.3em}
    &lt;/style&gt;
    &lt;p&gt;Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Merge two sorted linked lists and return it as a new list.&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;The new list should be made by splicing together the nodes of the first two lists.&lt;/p&gt;
    &lt;p&gt;It&apos;s an easy problem in Leetcode for practicing linked list. It&apos;s similar to the merge step of the Merge sort.&lt;/p&gt;
    &lt;h1 id=&quot;brute-force-algorithm&quot;&gt;Brute force algorithm&lt;/h1&gt;
    &lt;p&gt;Merge the both list together and sort the returning list.  This will take complexitiy of  $ O(n + m)log(n + m) $ , where n &amp;amp; m are length of each two list&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0f11e4ba933c83ae7f1cae07b38d66e0.js?file=Simple.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;p&gt;```&lt;/p&gt;
    &lt;h1 id=&quot;more-efficient-solution&quot;&gt;More efficient solution&lt;/h1&gt;
    &lt;p&gt;Similary to algorithm used in merging step of Merge Sort, we can acheive $ O(n + m) $ time complexity. Traverse both the list together, and insert the smallest value into the new list.&lt;/p&gt;
    &lt;div class=&quot;line-numbers code-block&quot;&gt; &lt;script src=&quot;https://gist.github.com/tushar-sharma/0f11e4ba933c83ae7f1cae07b38d66e0.js?file=Solution.java&quot;&gt;&lt;/script&gt; &lt;button class=&quot;copy-button&quot;&gt;Copy&lt;/button&gt; &lt;/div&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://leetcode.com/problems/merge-two-sorted-lists/&quot; target=&quot;_blank&quot;&gt;Leetcode&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2019-01-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/merge-two-sort-list</link>
<guid isPermaLink="true">https://randomwits.com/blog/merge-two-sort-list</guid>
</item>
<item>
  <title>Decoding ndtv darwin&apos;s theory debate</title>
  <description>&lt;p&gt;I wanted to decode an old debate that I saw on ndtv. It was about a controversy erupted by the comments of a junior Indian education minister, Satyapal Singh. He is India&apos;s Minister of State for Human Resource Development. He had claimed that evolution is &quot;scientifically wrong&quot; because he never &lt;strong&gt;saw an ape turning into human being&lt;/strong&gt;.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I wanted to decode an old debate &lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; that I saw on ndtv. It was about a controversy erupted by the comments of a junior Indian education minister, Satyapal Singh. He is India&apos;s Minister of State for Human Resource Development. He had claimed that evolution is &quot;scientifically wrong&quot; because he never &quot;&lt;b&gt;saw an ape turning into human being&lt;/b&gt;&quot;.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;a href=&quot;https://www.ndtv.com/video/news/the-buck-stops-here/darwin-s-theory-should-minister-s-views-be-dismissed-477172?yt&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://i.imgur.com/nvegAOw.jpg&quot; title=&quot;source: ndtv.com&quot; /&gt;&lt;/a&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;How does he claim evolution is &quot;scientifically wrong&quot;? Does the said minister have a degree in biology or have published a paper that can be peer reviewed? On the contrary, he had a career of Police Commisioner of Mumbai.&lt;/p&gt;
    &lt;h4 id=&quot;panelist-for-the-debate&quot;&gt;Panelist for the debate&lt;/h4&gt;
    &lt;p&gt;The debate panelist include the following members viz,&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;em&gt;Das Ratan Nigam&lt;/em&gt; (a lawyer &amp;amp; also a member of RSS)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;em&gt;Ankit Sule&lt;/em&gt;, a doctorate in Astophysics from Bhabha Centre for Science Education&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;em&gt;Chandra Sharma&lt;/em&gt;, professor of education at IGNOUS&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Two young students&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;I wonder why there was no evolutionary biologist invited to the panel while discussing evolution. It&apos;s akin to debating laws without inviting lawyers. I would love to hear the defense of &quot;evolution&quot; by biologists like Richard Dawkins or Amitabh Joshi. Here&apos;s an interesting speech on evolution by Amitabh Joshi&lt;sup&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;RSS is an Indian right-wing organization. Right wing usually opposes &quot;evolution&quot; since it embarrasses their religious beliefs. Religion presents an anthropomorphic view of the world where human deserves a pedestal higher than rest of the animals. While evolution dashes those hopes stating that there is nothing special about humans who originated from last universal common ancestors 3.5 billion years ago &amp;amp; recently branched off from orangutans 14 million years ago. In the United States, many right wings religious group often opposed &quot;evolution&quot; to being taught in school&lt;sup&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Das Ratan Nigam is a lawyer by profession &amp;amp; is affiliated to RSS. He is known to espouse pseudoscientific theories likes which were promulgated by self-proclaimed historian P.N. Oak who stated that both Christianity &amp;amp; Islam were derivatives of Hinduism and that Vatican City, Kaaba, Westminster Abbey, and the Taj Mahal were once Hindu temples of Shiva. His petition to rewrite history has been dismissed by the Indian Supreme court&lt;sup&gt;&lt;a href=&quot;#fn:4&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;In 1:19 minutes of the video, Das Ratan says the minister Saytapal Singh is only challenging Darwins&apos;s theory of evolution. He says that there are multiple theories of evolution. But he didn&apos;t elaborate on what other theories of evolutions he was alluding to. Maybe he meant botanist Carolus Linnaeu&apos;s theory who based his categorization of species on the theory of unchanging life created by God. Or George Louis Leclerc who believed that Earth was only 75,000 year old &amp;amp; men descendent from apes. Or Does he believe in Genesis or tales of Hiranyagarbha (golden embryo) mentioned in the Rig Vedas?&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://media.giphy.com/media/BDz6tWBtXDL4Q/giphy.gif&quot; alt=&quot;Charles Darwin&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;However, he makes a straw man fallacy by claiming that Darwin himself didn&apos;t believe in his theory as there was a lack of fossil evidence. When confronted by the anchor that fossil evidence has been found, he retorts that &quot;no fossil evidence has come for the incomplete species&quot;. This argument has always been used in popular media to discredit evolution. But missing link is now considered a non-scientific term. Copied verbatim from Wikipedia&lt;/p&gt;
    &lt;blockquote&gt;
    The term &quot;missing link&quot; has fallen out of favor with biologists because it implies the evolutionary process is a linear phenomenon and that forms originate consecutively in a chain. Instead, last common ancestor is preferred since this does not have the connotation of a linear evolution, as evolution is a branching process.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;It would be prudent for him to listen to this speech by Richard Dawkins on &quot;missing link&quot;&lt;sup&gt;&lt;a href=&quot;#fn:5&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;He babbles that evolution taught today is Neo Darwinism which has nothing to do Darwin&apos;s theory of evolution. He confuses Modern Synthetic theory with Neo Darwinism. Neo Darwinism is the interpretation of Darwinian evolution by incorporating Mendelian genetics. However, the theory still hinges on Darwin&apos;s idea of &quot;natural selection&quot;.&lt;/p&gt;
    &lt;p&gt;Ras Ratan Nigam continues to discredit evolution by claiming that Darwin had no clue for genetic mutation. This is a similar argument to reject Newtonian physics by claiming that Newton had no idea about space-time continuum or that mass increase with velocity or space is not infinite. Newton&apos;s idea was revolutionary in understanding the laws of gravity. Einstein realized that Newton&apos;s theory of gravity was not complete which eventually gave birth to &quot;theory of relativity&quot;. Darwin didn&apos;t know much about DNA or nucleotide. He was also wrong about heredity due to blending (later it&apos;s found to be particulate). Yet his idea of natural selection lays the foundation for modern evolutionary theory. People opposing evolution however never suggest alternative theory that is both falsifiable &amp;amp; verifiable.&lt;/p&gt;
    &lt;p&gt;In 3:48 minutes of the video, anchor ask Chandra Sharma about his views on evolution. He diplomatically says that the minister has only raised the question on evolution. He said that it&apos;s valid that we must more research on evolution. He says that the Indian minister quoted scientist and books that discredit evolution. He somehow slips into Vishnu (India god) claiming that ancient India books contained much more knowledge. This is a slippery slope because many people claim that their holy ancient books contain scientific wisdom. It might be true sometimes, but often it leads into a maze of pseudo scientific claims.&lt;/p&gt;
    &lt;p&gt;In 7:21 minutes of the video, Das Ratan Nigam quotes Noble laureate Fred Hoyle who doesn&apos;t believe in Darwinian evolution. He probably forgot that Fred Hoyle also doesn&apos;t believe in Big Bang Theory. This is argument ad populum often used by people to claim a proposition is true because &quot;Some smart scientist believes so&quot;. Probably he doesn&apos;t understand science.&lt;/p&gt;
    &lt;h4 id=&quot;what-is-science&quot;&gt;What is science&lt;/h4&gt;
    &lt;p&gt;In crude terms, any scientific theory must at least satisfy the following&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;em&gt;verifiability&lt;/em&gt; (based on observation)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;em&gt;peer-reviewed&lt;/em&gt; (reviewed by other qualified scientists)&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;em&gt;falsifiability&lt;/em&gt;  (that can be refuted)&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Hence &lt;a href=&quot;https://en.wikipedia.org/wiki/Germ_theory_of_disease&quot;&gt;Germ theory of disease&lt;/a&gt; is a scientific theory but &lt;a href=&quot;https://en.wikipedia.org/wiki/Homeopathy&quot;&gt;Homeopathy&lt;/a&gt;
    is a pseudoscience. &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_healing&quot;&gt;Quantum Healing&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Law_of_attraction_(New_Thought)&quot;&gt;Law of Attraction&lt;/a&gt; also fails the scientific test despite being bestsellers. Science also dismisses &lt;a href=&quot;https://en.wikipedia.org/wiki/Astrology&quot;&gt;Astrology&lt;/a&gt; with no scientific validity yet large number of people still believe in it. &lt;a href=&quot;https://en.wikipedia.org/wiki/String_theory&quot;&gt;String theory&lt;/a&gt; with all its fanfare &amp;amp; mathematical theoretical framework is still a hypothesis.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;https://imgs.xkcd.com/comics/string_theory.png&quot; title=&quot;source: xkcd&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;scientific-consensus&quot;&gt;Scientific Consensus&lt;/h4&gt;
    &lt;p&gt;How do we know evolution is true? It’s because of &quot;scientific consensus&quot;. It’s the collective judgment, position, and opinion of the community of scientists in a particular field. Newton was a brilliant physicist who postulated laws of gravity. However, he also believed in alchemy. There is no “scientific consensus” that alchemy is valid. Kurt Wise is also a smart man who holds a Ph.D. in paleontology from Harvard University. He believes that earth is literally less than 10,000 years old. However, there is &quot;scientific consensus&quot; that earth is a 4.5 billion-year-old. So it doesn’t matter if a particular scientist holds a fringe belief which is often touted by religious people to promulgate their beliefs.&lt;/p&gt;
    &lt;p&gt;But what if Scientific consensus is wrong? Scientist in mid-20th century believed in Steady state model instead of Big Bang Theory. Or scientist believed in the ether, a hypothetical medium, that allowed light &amp;amp; heat to transmit in space. But with evidence, scientific consensus corrects itself while the religious folks are frozen in time in their scriptures.&lt;/p&gt;
    &lt;p&gt;The only sane voice I found was that of Ankit Sule. He had started the petition addressed to the minister Mr. Singh and was signed by over 5000 scientists from India and abroad&lt;sup&gt;&lt;a href=&quot;#fn:6&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;. In 9:53 minutes of the video, he says that he support the efforts to study ancient Indian scriptures but opposes reverse engineering every modern scientific fact and try to trace in the ancient scriptures.&lt;/p&gt;
    &lt;p&gt;In parliament, once a BJP MP said that cow dung and cow urine could cure cancer &lt;sup&gt;&lt;a href=&quot;#fn:7&quot; rel=&quot;footnote&quot;&gt;7&lt;/a&gt;&lt;/sup&gt;. The minister Mr. Singh had also earlier talked of airplanes in ancient India&lt;sup&gt;&lt;a href=&quot;#fn:8&quot; rel=&quot;footnote&quot;&gt;8&lt;/a&gt;&lt;/sup&gt;. Such exaggerated claims are made by all religious people. Some people have found big bang in Quran&lt;sup&gt;&lt;a href=&quot;#fn:9&quot; rel=&quot;footnote&quot;&gt;9&lt;/a&gt;&lt;/sup&gt;. Or that Bible says that earth is supended in empty space&lt;sup&gt;&lt;a href=&quot;#fn:10&quot; rel=&quot;footnote&quot;&gt;10&lt;/a&gt;&lt;/sup&gt;. Or the speed of light is mentioned in 14&lt;sup&gt;th&lt;/sup&gt; century Puranic Cosmology&lt;sup&gt;&lt;a href=&quot;#fn:11&quot; rel=&quot;footnote&quot;&gt;11&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Of course, it doesn&apos;t mean that there is no wisdom in ancient scriptures. Sushruta wrote the treatise The Compendium of Suśruta in surgery around 6 century BCE. Or Pāṇini was the father of linguistics lived around 4th century BCE. Algebra was coined by Persian mathematician and astronomer al-Khwarizmi around 820 AD. Or the works of Confucious(479 BC), one the greatest philosophers of China. And much more.&lt;/p&gt;
    &lt;p&gt;Since time immemorial, religion has to forsake some parts belief to accommodate science. Nordic believed in God Thor responsible for thunder. I guess that myth died as soon as the science filled the gaps. Some Hindus believed that demon Rahu swallows the sun to cause the eclipse. However, as science explained eclipses, people no longer believe such myths.&lt;/p&gt;
    &lt;p&gt;Even if religious books contain scientific fact, it doesn&apos;t prove them divine. As an atheist, I  refrain from commenting on the validity of religious scriptures.  I respect &amp;amp; celebrate all religion with their diversity. However, when it comes to science, the evidence is the king. And the science doesn&apos;t owe you anything that it would not offend your sentiments.&lt;/p&gt;
    &lt;p&gt;Evolution is a harsh fact&lt;sup&gt;&lt;a href=&quot;#fn:12&quot; rel=&quot;footnote&quot;&gt;12&lt;/a&gt;&lt;/sup&gt;, though sometimes I hope that there was the more gentle &amp;amp; benign beginning of the life in the universe. But I guess, I did not choose this universe, but this universe chose me.&lt;/p&gt;
    &lt;nav class=&quot;pagination clear&quot; style=&quot;padding-bottom:20px;&quot;&gt;
    &lt;a class=&quot;prev-item&quot; href=&quot;/blog/three-sum&quot; title=&quot;Previous Post: Three Sum Problem Leetcode Solution&quot;&gt;&amp;larr;Previous&lt;/a&gt;     &lt;a class=&quot;next-item&quot; href=&quot;/blog/merge-two-sort-list&quot; title=&quot;Next Post: Merge Two Sorted Lists&quot;&gt;Next&amp;rarr;&lt;/a&gt;         
    &lt;/nav&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.ndtv.com/video/news/the-buck-stops-here/darwin-s-theory-should-minister-s-views-be-dismissed-477172?yt&quot; target=&quot;_blank&quot;&gt;ndtv&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=xppn7ITteZw&quot; target=&quot;_blank&quot;&gt;Amitabh Joshi&apos;s Youtube video&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Creation_and_evolution_in_public_education_in_the_United_States&quot; target=&quot;_blank&quot;&gt;Creation and evolution in US&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.thehindu.com/2000/07/14/stories/0214000q.htm&quot; target=&quot;_blank&quot;&gt;the hindu&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:4&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=Sztt70n6geE&quot; target=&quot;_blank&quot;&gt;Missing Link&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:5&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot;&gt;
    &lt;p&gt;&lt;a href=&quot; https://drive.google.com/file/d/1P3La0NkprXiLd31V6IGQHqGsdHuV1cJ-/view&quot; target=&quot;_blank&quot;&gt;Letter address to the minster&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:6&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:7&quot;&gt;
    &lt;p&gt;&lt;a href=&quot; https://www.thehindu.com/news/national/cow-urine-can-cure-cancer-bjp-member-in-rs/article7012010.ece&quot; target=&quot;_blank&quot;&gt;cow dung &amp;amp; urine&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:7&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:8&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Vaimānika_Shāstra&quot; target=&quot;_blank&quot;&gt;Vaimānika Shāstra&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:8&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:9&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.islamreligion.com/articles/1560/quran-on-expanding-universe-and-big-bang-theory/&quot; target=&quot;_blank&quot;&gt;Big Bang Quran&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:9&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:10&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.jw.org/en/bible-teachings/questions/science-and-the-bible/&quot; target=&quot;_blank&quot;&gt;Bible science&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:10&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:11&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/physics/9804020&quot; target=&quot;_blank&quot;&gt;Speed of Light and Puranic Cosmology&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:11&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:12&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Scientific_consensus&quot; target=&quot;_blank&quot;&gt;Scientific consensus&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:12&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2018-12-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/decoding-ndtv-dawin-theory</link>
<guid isPermaLink="true">https://randomwits.com/blog/decoding-ndtv-dawin-theory</guid>
</item>
<item>
  <title>Three Sum Problem Leetcode Solution</title>
  <description>&lt;p&gt;Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h1 id=&quot;brute-force-algorithm&quot;&gt;Brute force algorithm&lt;/h1&gt;
    &lt;p&gt;This solution will result in &lt;strong&gt;Time Limit Exceeded&lt;/strong&gt; since it has complexity of &lt;strong&gt;O(n&lt;sup&gt;3&lt;/sup&gt;)&lt;/strong&gt;. We can naively check for all combination of array in three nested loops.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/fcebe82a654323cb9f963e40e7c6b5e1.js?file=ThreeSumBrute.java&quot;&gt;&lt;/script&gt;
    &lt;h1 id=&quot;more-efficient-solution&quot;&gt;More efficient solution&lt;/h1&gt;
    &lt;p&gt;Using two pointer solution, we can acheive &lt;strong&gt;O(n&lt;sup&gt;2&lt;/sup&gt;)&lt;/strong&gt; time complexity.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/fcebe82a654323cb9f963e40e7c6b5e1.js?file=ThreeSum.java&quot;&gt;&lt;/script&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://leetcode.com/problems/3sum/&quot; target=&quot;_blank&quot;&gt;Leetcode&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2018-11-13T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/three-sum</link>
<guid isPermaLink="true">https://randomwits.com/blog/three-sum</guid>
</item>
<item>
  <title>Why Baahubali is not worthy of high rating?</title>
  <description>&lt;p&gt;I might slip into a cesspool of hate in criticizing India’s most successful movie, Baahubali 2: The Conclusion. One of my Telugu colleague eyes beamed with pride when she told me how she watched first day first show &amp;amp; how this movie has propelled Telugu movies in the same league of Hollywood.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I might slip into a cesspool of hate in criticizing India’s most successful movie, Baahubali 2: The Conclusion. One of my Telugu colleague eyes beamed with pride when she told me how she watched first day first show &amp;amp; how this movie has propelled Telugu movies in the same league of Hollywood. People in India often put actors and politicians in pedestal with overwhelming emotions which is why it is sometimes difficult to have bonafide criticism of more than real life people like Rajinikanth in Tamil Nadu or Salman Khan in UP or Bihar.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;https://qph.fs.quoracdn.net/main-qimg-dffa472292c6abcb72370a93dbf0dd22&quot; alt=&quot;Photo of Baahubali&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Baahubali 2: The Conclusion has very high rating in both Rotten Tomatoes and IMDB. So it wouldn’t be surprising that I would be in minority to really not like movie.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;https://qph.fs.quoracdn.net/main-qimg-59f030e90459b563466ef15d7bef694a&quot; alt=&quot;Photo of Baahubali&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;So what is my pet peeve? It is a wishy-washy fable lacking any complex story, replete with dazzling cinematic visuals but lacking in art of story telling. If you shred the movie of its beautiful cinematography &amp;amp; dances, its story is in monotone, highly predictable and doesn’t do justice to be hailed as an pan-Indian movie.&lt;/p&gt;
    &lt;p&gt;Baahubali 2 reinstate the concept of messiah or hero worship. An all powerful Thor like king who shoots arrows immaculately mocking Newtonian idea of gravity comes to save hapless subjects. Indians are often familiar with the concept of messiah. It’s innocuously promulgated by movies, where one good cop or politicians lives altruistically and like a dynastic royal king solves problems of the people.&lt;/p&gt;
    &lt;p&gt;Indira Gandhi made a riveting election slogan “Garibi Hatao desh bachao” (&quot;Abolish poverty, save the nation&quot;) and swung back to power. Did garibi (poverty) actually vanished from India? Similar slogan was coined by Narendra Modi, “Achhe din aane waale hain” (Good days are coming). God like politician with halo around them have made similar slogans, like Mamata Banerjee, Jayalalithaa, Karunanidhi, Mayawati, Lalu Prashad, etc and is often easily bought by gullible people.&lt;/p&gt;
    &lt;p&gt;This image of a hero riding on a stallion with brandishing sword to eliminate evil and help subjects is inimical to idea of democracy. Democracy works by participation of masses with share of responsibilities. It’s not a solo reign of god like creature who has come for salvation of masses. In a true and fair democracy, even god can be questioned.&lt;/p&gt;
    &lt;p&gt;The flourishing godmen in Indian who have been accused of terrorism, rape , etc have still have hordes of people rallying for them. India probably has the only constitution in the world which explicitly promotes scientific temper.&lt;/p&gt;
    &lt;blockquote&gt;
    &apos;To develop scientific temper, humanism and the spirit of inquiry and reform&apos; is one of the fundamental duties of the people of the Republic of India, according to the Constitution of India.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;India boast of being the largest producer of films in the world and second oldest film industry in the world which originated around about 105 years ago. However it is appalling that most of the movies panders to stereotype and many lack any imaginative script albeit there are exceptions.&lt;/p&gt;
    &lt;p&gt;The Ramayana or Mahabharata can easily dwarf likes of Iliad or Odyssey by Homer. India is replete with myriad art of story telling even without the advent of technology. It’s sad that with all the visual fireworks, Baahubali may be among India’s highest grossing film, but has fell short to become an epic pan Indian film like Mother India.&lt;/p&gt;
  </description>
  <pubDate>2018-08-19T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/overrated-movie</link>
<guid isPermaLink="true">https://randomwits.com/blog/overrated-movie</guid>
</item>
<item>
  <title>How I almost fell for rent scam?</title>
  <description>&lt;p&gt;Recently, my roommate, had his job contract terminated. He found a new job in another city which meant I had to hunt for a new roommate. So I quickly posted an ad on Sulekha, a popular website in USA among Indians.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/chat.css&quot; /&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    .myheading{font-family:Georgia, &quot;Times New Roman&quot;, Times, serif;font-size:28px;margin-top:5px;margin-bottom:0;font-weight:400;color:#222}
    .mysubheading{font-family:&quot;Lucida Grande&quot;, Tahoma;font-size:10px;font-weight:lighter;font-variant:normal;text-transform:uppercase;color:#666;margin-top:10px;letter-spacing:.3em}
    &lt;/style&gt;
    &lt;p&gt;Recently, my roommate, had his job contract terminated. He found a new job in another city which meant I had to hunt for a new roommate. So I quickly posted an ad on Sulekha&lt;sup id=&quot;fnref:sulekha&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:sulekha&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, a popular website in USA among Indians.&lt;/p&gt;
    &lt;p&gt;A month ago I had stumbled upon an old friend in a private birthday bash. He was raving about a rent scam. More than thousands of dollars were siphoned off his account. Barring some sympathy, I paid little heed to his story. Little did I know I would almost fell for a similar scam.&lt;/p&gt;
    &lt;h3 id=&quot;you-have-a-text-message&quot;&gt;You have a text message!&lt;/h3&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Good morning Tushar, My name is Upeksa and I&apos;m a professional, single and decent. I find your ads on Sulekha interesting and meets my specification, can you please respond back as I&apos;m very serious about renting this unit
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Hi Upeksa. How are you? If you are interested, you can call me on my number so that we can discuss it futher
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I&apos;m here Tushar, due to middle ear infections I will only respond to text
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    If a person doesn&apos;t pick your phone, most probably he is not genuine.
    &lt;/blockquote&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Would you like to come and see the apartment?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Unfortunately I can&apos;t view this unit at the moment
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    So are you interested in the apartment?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Sure I&apos;m interested in renting this room in the apartment  
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    So how do we go forward? Do you want to see the pics or ask any details?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I will appreciate if you can send me some photos before we proceed further since I will not able to view the place in person
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;I sent him the photos of the apartment &amp;amp; its details.&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I am planning to move in as soon as you give me the go ahead and only after payment mode has been discussed and paid. I believe you are okay with Check payment in replace of cash or online transfer? If you are pleased with the check payment then you will need to forward me your mailing address/apartment number and names to be written on the check payment
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    So your total rent is $**** including all utilities. Is that k?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Perfect, I&apos;m very comfortable with my rent
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Then he begins to babble about his professonal &amp;amp; personal life.&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Brief introduction about myself. I&apos;m a pure vegetarian, a professional in the IT sector, I live and work here in Hawaii but on a job relocation hence will need a place to rent as I have 6/12 months project I need to work on. I still kind of follow the Hindu culture partially I am not a traditional Hindu person. Am originally from Eluru A.P. Have been around the USA for a while now.
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I am 34 yrs, I will be staying alone on my arrival. I work for CISCO SYSTEMS as a security expert (BASICALLY IN CHARGE OF THEIR SERVERS). I don&apos;t drink, or smoke. I am easy to get free along with others. I respect people&apos;s privacy and also love to live in a clean house
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;I am rarely interested in someone&apos;s personal belief or food habits unless it infringes in my personal space. But I patiently listened to his rambling. Later we talked about payment.&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    As regard to payment to secure this unit up front to my arrival, I have a financier and he will be handling my move in cost on my behalf
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Surely I clearly understand and will make payment for the utility bills in person once I arrive
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I have discussed with my financier and he has agreed to issue out payment to you right away through certified cheque.
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    If a person makes the process of payment complicated like involving a third person, be extra careful.
    &lt;/blockquote&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Can you transfer money via online banking? It would be much faster
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Sorry, my good friend, my financier can only issue out a cheque payment now
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    My subsequent rent bills will be made by online transfer
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    All you have to do is once you get the cheque is to deposit into your bank account and the total funds on the cheque will be cleared and made available for use tomorrow morning OK
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Address : **********.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    k. My Name: Tushar Sharma
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Thanks! I got it Tushar and I have immediately forwarded your details to my financier
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Also, can you email me any scan you your id or anything to verify your name?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Sure that is perfectly fine with me
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I will gladly send you a copy of my passport ID copy right away
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;/img/scam_passport.jpeg&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;I tried to match the passport with the sample published by the National Document Fraud Unit (NDFU)&lt;sup id=&quot;fnref:ndfu&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:ndfu&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; on their website&lt;sup id=&quot;fnref:document&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:document&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;. At a cursorty glance, font does looks weird. Since I am not a forensic expert, I gave him the benefit of doubt.&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    My financier is issuing out the cheque payment to you now
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    The amount of the cheque which you will receive shortly will consist of both my total rent and my travel expense
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    If anyone is sending you extra money, be very careful.
    &lt;/blockquote&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    What is the extra amount?
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    See if you transfer any amount to my account, it has to be exact $***, else I won&apos;t cash it
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    So all you have to do once you get the cheque copy is to make sure you deposit into your bank right away
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I need you to please help me with this huge favor, I have closed down my account with the local bank I am using here. Since I will be relocating, will only be able to open a new account on my arrival since BOH(Bank of Hawaii) does not have other branches in other cities.
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Please, this will be the only time I will make payment in this form. OK
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Please I&apos;m pleading with you to assist me with this and I promise you will not regret helping me out
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I don&apos;t want to lose this great opportunity
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I already take you as a family and I honestly can&apos;t wait to meet you in person on arrival
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Will sincerely appreciate if you could please take off the advertisement from the public view as I am more than 100% certain and committed to rent your place after we have been able to finalize on the cheque payment
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    His sane conversation had turned comical with his incessant pleading and copious excitement over meeting me &amp;amp; the apartment
    &lt;/blockquote&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    Hawaii is one of the states of United States. If he is already living in the USA (as he claims), he should be able to easily access his account or make an appropriate arrangement. If he was coming from another country, I might have believed him.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;how-the-scam-works&quot;&gt;How the scam works?&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;The buyer uses a cashier&apos;s check or money order. They explain that this is their only option for payment.&lt;/li&gt;
    &lt;li&gt;The seller or recipient gets a check for more than they asked for.&lt;/li&gt;
    &lt;li&gt;The seller is supposed to send the extra money back to the buyer or to a &quot;helper&quot;&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;But&apos;s here&apos;s the catch. After you deposit the fradulent cheque in the bank, the bank must provide you with the cash to withdraw within 2 business days. But it can take sometimes take more than four days for banks to verify if the cheque is genuine&lt;sup id=&quot;fnref:bank&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:bank&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Once the bank finds out the cheque is bogus, it reverses the amount. In the meantime, if you had already transferred money to someone else, the money is lost. And now you also owe bank that transferred amount.&lt;/p&gt;
    &lt;p&gt;So far I have realized that this was a scamster. But I wanted to have some fun 😉.&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    So when are you sending the cheque?
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Next morning, he replies with a flattery message.&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Good morning dear Tushar, how was your night? I hope you slept well?  
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Not really, my pet orangutan kept me awake all night.
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Alright, please what is the update regarding the cheque payment that I sent to you? Have you completed the Mobile deposit please?
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    He didn&apos;t ask me how come I have orangutan in my apartment. How often do people keep apes as pets ? But all he cares about is cheque deposit.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h3 id=&quot;scam-instructions&quot;&gt;Scam Instructions&lt;/h3&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;He had sent me images of the cheque to deposit with the following instructions&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;You have to first of all print out both front and back of cheque&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;PLEASE NOTE YOU MUST CUT both front and back of check out carefully to check size.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Endorse the back of the check (sign) and write &quot;For Mobile check Deposit Only&quot; and sign.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;You will have to enter the required amount.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Kindly send to me the screenshot/email from your financial institution once you are done.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Will appreciate if you can take print out today and initiate the mobile deposit so that the full amount will be credited into your account by tomorrow.&lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;/img/scam_ck1.png&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;/img/scam_ck2.png&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h3 id=&quot;fun-with-the-scammer&quot;&gt;Fun with the scammer&lt;/h3&gt;
    &lt;p&gt;Now I am fabricating outlandish lies about myself to see how he reacts.&lt;/p&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Ok . I&apos;ll deposit it today. But I wanted to know more about you? Are you married ?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Perfect and no I have never been married. I&apos;m still single
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Ok. Are you working full time or contract at CISCO ?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    I work full time with CISCO.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Are you a pure vegetarian? I sometimes eat seafood, chicken, sea-shell, duck or crave for cannibalistic desire. Is that acceptable to you?
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Sure I honestly don&apos;t have any problem with you eating habit in the unit but I&apos;m a pure vegetarian and I don&apos;t cook.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Ok. I &apos;ll deposit the cheque today after work. Also, I forgot to tell you that I practice Tantra. As a traditional Hindu myself, I sometimes practice nudity in my apartment. I hope that wouldn&apos;t bother you.
    &lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    Sure that is not a problem.
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;blockquote class=&quot;attention&quot;&gt;
    He has no problem with me being cannibal or nude. He was agreeing to pretty much everything I was saying.
    &lt;/blockquote&gt;
    &lt;ul class=&quot;chatlist &quot;&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    That&apos;s very nice. So what are your skills ? Do you work in JAVA / C++ , Python ?&lt;/li&gt;
    &lt;li class=&quot;shared received&quot;&gt;
    You have asked me a million questions, please update me as soon as you deposit the cheque.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    I asked your skills because I thought you were smart enough to earn your living without scamming innocent people.&lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    I hope you are not Indian because you are sullying the reputation of Indians. But in life everyone has their reasons so who am I to judge 🤷.
    &lt;/li&gt;
    &lt;li class=&quot;shared sent&quot;&gt;
    Goodbye
    &lt;/li&gt;
    &lt;/ul&gt;
    &lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
    &lt;p&gt;When we read about scams, our first reaction is to dismiss it wholeheartedly with a mere retort &quot;How can someone by that stupid? &quot;. But I have personally known many smart people falling to many scams like rent scam, USCIS scam, 911 scam, etc. Luckily I had met an old friend a month ago who had warned me about this scam.&lt;/p&gt;
    &lt;blockquote&gt;
    &lt;p&gt;The best remedy against any scam is knowledge.&lt;/p&gt;
    &lt;/blockquote&gt;
    &lt;h3 id=&quot;reference&quot;&gt;Reference&lt;/h3&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:sulekha&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://us.sulekha.com&quot;&gt;Sulekha Website&lt;/a&gt; &lt;a href=&quot;#fnref:sulekha&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:ndfu&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/National_Document_Fraud_Unit&quot;&gt;NDFU&lt;/a&gt; &lt;a href=&quot;#fnref:ndfu&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:document&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/869551/Guidance_on_examining_identity_documents_v._February_2020.pdf.pdf&quot;&gt;Guidance on examining identity documents&lt;/a&gt; &lt;a href=&quot;#fnref:document&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:bank&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.thebalance.com/how-long-to-wait-after-depositing-a-check-315006&quot;&gt;How long to wait for bank deposit&lt;/a&gt; &lt;a href=&quot;#fnref:bank&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2018-05-27T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/rent-scam</link>
<guid isPermaLink="true">https://randomwits.com/blog/rent-scam</guid>
</item>
<item>
  <title>Lazy Meditation</title>
  <description>&lt;p&gt;The sun’s rays had already crept through my window &amp;amp; drenched my room with light. Sleep taste sweetest when you resist it. It is but with a heavy heart that I relinquish my sleep &amp;amp; pull myself together.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;The sun’s rays had already crept through my window &amp;amp; drenched my room with light. Sleep taste sweetest when you resist it. It is but with a heavy heart that I relinquish my sleep &amp;amp; pull myself together. But not today! It was a weekend that brought me few more drops of honey as I extended my sleep while a statue of abstemious Buddha, which I recently bought, wandered at the petty cumberworld outgrowing in both time &amp;amp; stupidity.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/bhudda_st.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;It seems like yesterday when I hit a wall &amp;amp; made a crazy resolution to indulge in meditation. Before some of the readers’ protest, I dispose with an earnestness that mediation is a very useful transcendental exercise. But being Indian, along with genes to eat pani puri &amp;amp; digest spicy food, I also have some false preconceptions about myself. Like billion Indians, I believe that meditation, like cricket, dancing, acting, etc comes naturally to Indians. I once joked with my American friend on how I would have played for Indian cricket team if not for the engineering. Also, I told him that India produces 1.5 million engineers a year which is twice the population of Iceland&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, which left him gaping at me.&lt;/p&gt;
    &lt;p&gt;Before I digress more, I should come back to the bed. Yes, the bed, the abode of eternal happiness. But the tranquility was perturbed by one mistake. The crazy resolution had pumped up ideas in my mind. Yesterday I had fallen to one such idea, to set up my alarm clock. It’s a sin, decreed by the Gods, against setting up an alarm in the weekend. Inspired by ilks of Zakir Naik, I hereby proclaim that chapter 1, verse 24 of the sleeping scripture warns against any temptation to use of unholy alarm clocks. But sometimes infectious discipline creeps in &amp;amp; making us falter to the temptation of using alarm clocks.&lt;/p&gt;
    &lt;p&gt;Meditation is often advised in the wee hours of the day. My parents have a despicable habit of waking up at 5 AM. But I never caught the influenza of discipline. I was saved by the vaccination of “laziness” which I received in four years of my college. I urge the government to promulgate such vaccination to all and sundry.&lt;/p&gt;
    &lt;p&gt;Both arms of the clock had stopped graciously at 10 before the sound filled the room. A slip of hand on “snooze” and clock raced faster, a minute became a score, while I pressed another “snooze”. Before I regain consciousness &amp;amp; pulled myself out of slumber, it was already 11 AM. Half of the world was already busy doing chores and I decided it was time to practice meditation.&lt;/p&gt;
    &lt;p&gt;I pulled up a meditation lesson by “Ravi Ravi Shankar”. His photo with long hair while smiling profusely, instilled unparalleled motivation in me. “I could be next Vivekananda”, I quipped, though the Buddha statue in my room chuckled mischievously. I have seen American do challenging “yoga” while as an Indian I felt the embarrassment on failing to properly sit cross legs. Since I needed a scapegoat to blame for my flaws, I blame western culture &amp;amp; modernity. (A common phrase used India to blame for our woes&lt;sup&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;, though such reasons are as much genuine as my rambling).&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/dog_yoga.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;The meditation started with nice Sitars. And I really felt energized in midst of the meditation. It was all beautiful and I could feel the experience transcendence while inhaling &amp;amp; the exhaling. After a long time, I sheepishly opened my eye to keep track of the time. To my horror, it had only elapsed five minutes yet it appeared as eternity as if time froze. The clocks were taking revenge on me by dragging their feet slowly like a toy train, even slower than one which I took from Shimla to Kalka, jerking at regular intervals at the every junction of the seconds. With every minute I grew more uncomfortable. It seems my body had lost the capacity to comprehend stillness. And like a sponge I sat, marinating in my mediocrity.&lt;/p&gt;
    &lt;p&gt;The restless of meditation was soon crumbling down under the weight of tranquility. The car reminded me of the chariot of Arjuna, the protagonist of the ancient Indian epic in Mahabharata. The fatigue of driving against the loved one distraught Arjuna. Krishna explained the necessity and inevitability of the war to Arjuna. Krishna becomes a charioteer for Arjuna in the battle. Similarly, I felt my soul has become a charioteer for my human body as she races 299,792,458&lt;sup&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; miles per second.&lt;/p&gt;
    &lt;blockquote&gt;
    कर्मण्येवाधिकारस्ते मा फलेषु कदाचन।
    &lt;br /&gt;मा कर्मफलहेतुर्भूर्मा ते सङ्गोऽस्त्वकर्मणि॥
    &lt;sup&gt;&lt;a href=&quot;#fn:4&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;&lt;br /&gt;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/gita.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Though it was the longest half hour meditation for me, I have committed to indulging more in it. It means I might have to pick up some vices like waking up quite early with a dab of discipline. But I believe my next experience with meditation will be more consistent &amp;amp; fruitful.&lt;/p&gt;
    &lt;nav class=&quot;pagination clear&quot; style=&quot;padding-bottom:20px;&quot;&gt;
    &lt;a class=&quot;prev-item&quot; href=&quot;/blog/india-pak&quot; title=&quot;Previous Post: What India can learn from Pakistan?&quot;&gt;&amp;larr;Previous&lt;/a&gt;     &lt;a class=&quot;next-item&quot; href=&quot;/blog/rent-scam&quot; title=&quot;Next Post: How I almost fell for rent scam?&quot;&gt;Next&amp;rarr;&lt;/a&gt;         
    &lt;/nav&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.buzzfeed.com/andreborges/13-eye-opening-facts-that-show-how-engineering-obsessed-indi&quot; target=&quot;_blank&quot;&gt;Buzzfeed.com&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;    http://www.dw.com/en/blame-victims-and-the-west-indias-way-of-justifying-sexual-assaults/a-37023646&quot; target=&quot;_blank&quot;&gt;Blame victims and the West&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt; Speed of Light &lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt; &lt;b&gt;Translation:&lt;/b&gt; You have the right to perform your actions,but you are not entitled to the fruits of the actions. Do not let the fruit be the purpose of your actions, and therefore you won’t be attached to not doing your duty. &lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2017-09-23T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/lazy-meditation</link>
<guid isPermaLink="true">https://randomwits.com/blog/lazy-meditation</guid>
</item>
<item>
  <title>What India can learn from Pakistan?</title>
  <description>&lt;p&gt;On a brisk day, I was carpooling with my manager. Amidst the roaring traffic, was the familiar melodious voice on the radio. We have grown accustomed to the RJ who played songs that was music to our ears. As my manager revved up the engine, with the occasional drip in audio of the AM, often we broke into conversation.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;On a brisk day, I was carpooling with my manager. Amidst the roaring traffic, was the familiar melodious voice on the radio. We have grown accustomed to the RJ who played songs that was music to our ears. As my manager revved up the engine, with the occasional drip in audio of the AM, often we broke into conversation.&lt;/p&gt;
    &lt;p&gt;Amartya Sen in his book, The Argumentative Indian, has argued the Indians are inherently loquacious. True to the argumentative traditions, our conversation percolated through the porous soil of sports into the sedimentary rocks of politics while amassing lump of Bollywood, music, economics, etc along the way. While an old classic Bollywood song played on the radio and I hummed along, dragging our conversation to halt. I gazed out of the window, many sign posts passed by, most of them visibly crestfallen like me.&lt;/p&gt;
    &lt;p&gt;Recently I stumble upon news of lynching of twenty-three year old student in Pakistan by a vigilante mob for allegedly “publishing blasphemous content online”. In other news, Pakistans’s Punjab Food Authority (PFA) had seized a large amount of suspected pig meat (pork) during a raid conducted near Lahore Railway Station. Pork is considered “haram” in Islam &amp;amp; thus is forbidden in Pakistan which has predominantly Muslim population.&lt;/p&gt;
    &lt;p&gt;Lately I am quite perturbed by the surge in cow vigilantism in India. Recently sixty-year old Sabir Ali &amp;amp; his nomadic family, was attacked by a frenzied mob on allegation of cow smuggling. Also in another incident, Indian police in Haryana has been inspecting biryanis for forbidden beef. Cow is consider holy for majority of Hindus &amp;amp; beef is illegal in many Indian states.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;&amp;lt;img align=&quot;center&quot; src=&quot;/img/cow.jpg&quot; alt=&quot;&quot; /&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Image courtesy ~ Global Look Press&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;It is easy to draw parallel between India &amp;amp; Pakistan. Indian movies like &lt;a href=&quot;http://www.imdb.com/title/tt4807830/&quot;&gt;Lipstick Under My Burkha&lt;/a&gt; was refused  certification by Indian censor board bcause it was too &quot;lady oriented&quot; and contained sexual scenes and abusive language. Similarly movie like &lt;a href=&quot;http://www.imdb.com/title/tt5121000/&quot;&gt;Aligarh&lt;/a&gt; faced the wrath of censor board because of depiction of homosexuality. Recently Pakistan banned Indian movie Raaes because the crime thriller &quot;depicts Muslims as criminals and terrorists&quot;. I came across a joke on social media on how Pahlaj Nihalani, Chairman of India’s Central Board of Film, could easily find a comparable job in Pakistan’s censor board.&lt;/p&gt;
    &lt;blockquote&gt;
    “A word to the unwise.&lt;br /&gt;
    Torch every book.&lt;br /&gt;
    Char every page.&lt;br /&gt;
    Burn every word to ash&lt;br /&gt;
    Ideas are incombustible.&lt;br /&gt;
    And therein lies your real fear.&quot;
    ― Ellen Hopkins
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Replace “beef” with “pork”, Pakistan’s &lt;a href=&quot;https://en.wikipedia.org/wiki/Blasphemy_law_in_Pakistan&quot;&gt;blasphemy laws&lt;/a&gt; with &lt;a href=&quot;https://indiankanoon.org/doc/1803184/&quot;&gt;295 A of Indian Penal code&lt;/a&gt; &amp;amp; a common disdain for LGBT community, India exudes many similarities with Pakistan. However some would argue against drawing parallel between India &amp;amp; Pakistan.&lt;/p&gt;
    &lt;p&gt;On the midnight of August 15, 1947, Lord Mountbatten, last viceroy of British India, with his soldier&apos;s knife cut India subcontinent into three. Despite similar colonial baggage, paths of two independent nations, India &amp;amp; Pakistan, diverged. Pakistan opted for a convenient way of becoming an Islamic Republic thus pandering to the majority population, while India chose to tread an arduous path of a secular democratic country.&lt;/p&gt;
    &lt;p&gt;Often I entertain myself with the news of crazy dictator of North Korea, Kim Kong Un. His ludicrous diktat restricting North Koreans to 15 sanctioned hairdo makes me chuckle. It has made me appreciate the legacy of Indian founding fathers who had left behind a parliamentary democracy. Championing to be world&apos;s largest democracy, India must resist temptation to embrace censorship of books, movie, or idea under the garb of nationalism.&lt;/p&gt;
    &lt;p&gt;Frenzy mob running amok reeks of lawlessness in a Banana Republic. India could learn from her adversary, Pakistan, of the consequences of not separating religion and state. Though Pakistan is more vulnerable to radicalization thanks to Pakistan’s former dictator Zia-ul-Haq’s Islamization, India walks a tightrope with her feet on rope of a liberal secular democracy while holding pole of religious fundamentalism.&lt;/p&gt;
  </description>
  <pubDate>2017-04-26T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/india-pak</link>
<guid isPermaLink="true">https://randomwits.com/blog/india-pak</guid>
</item>
<item>
  <title>Find kth largest element in an array</title>
  <description>&lt;style type=&quot;text/css&quot;&gt;
    .myheading{font-family:Georgia, &quot;Times New Roman&quot;, Times, serif;font-size:24px;margin-top:5px;margin-bottom:0;text-align:center;font-weight:400;color:#222}
    .mysubheading{font-family:&quot;Lucida Grande&quot;, Tahoma;font-size:10px;font-weight:lighter;font-variant:normal;text-transform:uppercase;color:#666;margin-top:10px;text-align:center!important;letter-spacing:.3em}
    &lt;/style&gt;
    &lt;p&gt;The other day I stumble upon the question to find the k&lt;sup&gt;th&lt;/sup&gt; largest element in the array. At first glance, I thought the solution was trivial. But later I thought that there are multiple ways to achieve efficient solution.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;The other day I stumble upon the question to find the k&lt;sup&gt;th&lt;/sup&gt; largest element in the array. At first glance, I thought the solution was trivial. But later I thought that there are multiple ways to achieve efficient solution&lt;/p&gt;
    &lt;p&gt;Heap is a useful data structure when root of the tree is important. Extracting an element from the heap is in logarithmic time. This could be used to find k&lt;sup&gt;th&lt;/sup&gt; element from the array since finding maximum or minimum in heap is constant time.&lt;/p&gt;
    &lt;h1 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h1&gt;
    &lt;p&gt;Suppose, we have an array of arbitrary integer values. We need to find the k&lt;sup&gt;th&lt;/sup&gt; largest element in the array. A sample of the input file is given below&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;3
    9, 4, 5, 2, 1, 23, 55, 88, 74
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Here, the first line is the value of &lt;strong&gt;n&lt;/strong&gt; and next line contains the array&lt;/p&gt;
    &lt;h1 id=&quot;desired-output&quot;&gt;Desired Output&lt;/h1&gt;
    &lt;p&gt;The output should print the 3&lt;sup&gt;rd&lt;/sup&gt; element in the array i.e.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;55
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h1 id=&quot;step-1-aka-read-the-input-file&quot;&gt;Step 1 aka Read the input file&lt;/h1&gt;
    &lt;p&gt;Before we begin, we need to perpare our tools and gather required inputs. First we need to read the input file and get the value of &lt;strong&gt;k&lt;/strong&gt; and the array. Also I&apos;ll be using ruby to write code as it is closer to psuedo code. So fire up your text editor and paste the code below&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/16d85b3cf0c0ee0922cf.js&quot;&gt;&lt;/script&gt;
    &lt;h1 id=&quot;step-2-aka-the-easy-way&quot;&gt;Step 2 aka the easy way&lt;/h1&gt;
    &lt;p&gt;One of the first solution that pops in my mind to find the n&lt;sup&gt;th&lt;/sup&gt; largest element is&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Sort the array in descending order&lt;/li&gt;
    &lt;li&gt;Get the element at the k&lt;sup&gt;th&lt;/sup&gt; index&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;The time complexity for this solution is @L O(n\log{}n) @L . However we can still find another solution in @L O(n) @L time.&lt;/p&gt;
    &lt;h1 id=&quot;more-efficiently&quot;&gt;More Efficiently?&lt;/h1&gt;
    &lt;p&gt;We can visualize our array as tree with each value as a node of tree. However to build our array as heap , we need to satisfy certain properties&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Each node of the heap has value&lt;/li&gt;
    &lt;li&gt;Value of each node @L \ge @L values of each of its children  (Max-heap)&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;In a nutshell our array should look like this&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;88,74,23,55,1,5,9,2,4
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;/img/heap_array.png&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h2 id=&quot;building-the-heap&quot;&gt;Building the heap&lt;/h2&gt;
    &lt;p&gt;Building heap takes &lt;strong&gt;O(n)&lt;/strong&gt;  time. First visit to every non-leaf node and checks if the value at the node satisfy heap property.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/deae8f73464989f38d8e.js&quot;&gt;&lt;/script&gt;
    &lt;p&gt;&lt;strong&gt;Max_down()&lt;/strong&gt; is the most important function as it heapifies (or maintain the heap property).&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/fd126d8629dc09ed66ef.js&quot;&gt;&lt;/script&gt;
    &lt;h2 id=&quot;extract-max&quot;&gt;Extract Max&lt;/h2&gt;
    &lt;p&gt;Our last step involves extracting the k&lt;sup&gt;th&lt;/sup&gt; max element.&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Extract the fist element which is the root element     @L O(1) @L&lt;/li&gt;
    &lt;li&gt;Call heapify to maintain heap property     @L O(\log{}(n) @L&lt;/li&gt;
    &lt;li&gt;Call extract &lt;strong&gt;k&lt;/strong&gt; times extract max  @L O(k \log{}(n)) @L&lt;/li&gt;
    &lt;/ol&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/0416b51745fb165cf830.js&quot;&gt;&lt;/script&gt;
    &lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;
    &lt;p&gt;Time complexity analysis of two methods discussed above&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**Using**&lt;/td&gt;
    &lt;td&gt;**Worst Case**&lt;/td&gt;
    &lt;td&gt;**Description**&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Sort&lt;/td&gt;
    &lt;td&gt;**O(n log(n)) + O(1)**&lt;/td&gt;
    &lt;td&gt;Sorting the array + accessing the element&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Heap&lt;/td&gt;
    &lt;td&gt;**O(n) + O(k log(n))**&lt;/td&gt;
    &lt;td&gt;Building heap + extracting maximum element&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </description>
  <pubDate>2016-03-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/projects/k-largest</link>
<guid isPermaLink="true">https://randomwits.com/projects/k-largest</guid>
</item>
<item>
  <title>A random stranger</title>
  <description>&lt;p&gt;It was just another day in Bangalore. I caught the bus from the /&lt;em&gt;Kormangala&lt;/em&gt; bus depot. Amid exhausting heat &amp;amp; nudging elbows, I somehow managed to grab a seat in the bus. Securing a seat in the Indian bus during peak time is considered a fortune. This often attracts resentful eyes. However my Indian genes have made me immune to both pani puri &amp;amp; judgment.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;It was just another day in Bangalore. I caught the bus from the &lt;em&gt;Kormangala&lt;/em&gt; bus depot. Amid exhausting heat &amp;amp; nudging elbows, I somehow managed to grab a seat in the bus. Securing a seat in the Indian bus during peak time is considered a fortune. This often attracts resentful eyes. However my Indian genes have made me immune to both &lt;a href=&quot;https://en.wikipedia.org/wiki/Panipuri&quot;&gt;pani puri&lt;/a&gt; &amp;amp; judgment.&lt;/p&gt;
    &lt;center&gt;
    &lt;img src=&quot;https://i.imgur.com/VqSSlqD.jpg&quot; alt=&quot;Random stranger&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;If you are lucky, you could get a window seat. This saves you from claustrophobia of the overcrowded isles. And today was my lucky day. I happily slumped down into my seat and peeped out of my window catching some glimpse of just another life on just another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Indian road&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;For outside world, India is chaotic. They imagine cars driving in zigzag manner on roads, performing dangerous maneuver to escape potholes, honking relentlessly with drivers eager to engage in fights with each other. It is remnant image of &lt;a href=&quot;https://en.wikipedia.org/wiki/Slumdog_Millionaire&quot;&gt;Slumdog Millionaire&lt;/a&gt; where city is ripe with frantic traffic, begging children &amp;amp; ostentatious few rich. Though I resent stereotypes, however sometimes this is true.&lt;/p&gt;
    &lt;center&gt; 
    &lt;img src=&quot;/img/india-traffic.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Traffic in India at times do turn messy. Traffic overflows into pavements leading the vehicles to compete with the pedestrians for space. However pedestrians in India are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;second class&lt;/code&gt; citizen still struggling to get their rights. They are always honked at disdainfully by the drivers. Zebra crossing is often a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;piece of art&lt;/code&gt; designed for foreigners to make them feel at home. &lt;a href=&quot;https://en.wikipedia.org/wiki/Richard_Stallman&quot;&gt;Richard Stallman&lt;/a&gt;, eminent computer programmer, has boasted in his &lt;a href=&quot;https://github.com/ddol/rre-rms/blob/master/rider.txt&quot;&gt;speaking condition&lt;/a&gt;, &quot;I have crossed streets without assistance even in the chaotic traffic of Bangalore and Delhi. Please just leave me alone when I cross streets.&quot;&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/A._P._J._Abdul_Kalam&quot;&gt;A P J Abdul Kalam&lt;/a&gt;, one the most beloved President of India, was once asked, &quot;Do you think India is chaotic?&quot;. He quipped, &quot;Order comes from disorder&quot;. It is a fascinating concept in science called &lt;a href=&quot;https://en.wikipedia.org/wiki/Chaos_theory&quot;&gt;chaos theory&lt;/a&gt; in which randomness can sometimes leads to symmetry. Can India turn her chaos into her strength? I peeped down from the window at the children begging on the roads and I wondered if the earth was weeping at the loss of their innocence. However one of little girl among them was smiling. She was playfully absorbed with the marbles in her hands. I could see reflection of my past with my fixation on marbles. But I knew life had also given her broken marbles.&lt;/p&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &quot;You can find poetry in your everyday life, your memory, in what people say on the bus, in the news, or just what&apos;s in your heart.&quot; - Carol Ann Duffy 
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Traffic in Bangalore has the potential of holding the Guinness World Records for keeping people stuck for indefinite hours. The stray dogs no longer found appealing to bark at the motionless traffic. The scorching sun made debut on the wrong day; people were packed inside the bus, sweating profusely, with the dust sweeping across the window blocking our nostrils thus saving us from the odor of our fellow passenger. And the bus moved sluggishly, I wondered if I would grow old in this traffic. I even imagined myself getting married and dying in the bus.&lt;/p&gt;
    &lt;p&gt;A fine gentleman was sitting in front of me. He was typing frantically on his laptop absorbed in deep smadhi. He occasionally slipped open his blackberry phone, a rarity in this day. He spoke IT, a common language usually spoken by Indian graduates who could not change their career before their marriageable age. Beside him sat a tired man, who occasionally made his shoulders rest on the fine gentleman. However after much discomfort, the fine gentleman exchanged some not so fine pleasantries which lead to the conductor to intervene.&lt;/p&gt;
    &lt;p&gt;When you have abundant time, your mind begins to play tricks on you. I tried, albeit unsuccessfully, listening to radio station but the excruciating pain of some senseless &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bollywood&lt;/code&gt; songs made me quit. I cursed myself for not subscribing to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3G&lt;/code&gt; connection which left me in the bus without water &amp;amp; fast internet. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2G&lt;/code&gt; internet is limited to messaging. This is the time when you realize why facebook reminds you that your are single. I seldom chat with my friends but when I do, I usually look like a walrus trying to play saxophone. Chatting is not my cup of tea.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;/img/walrus.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;With the looming danger of hallucination, I began crunching numbers. How much is 327 X 42. Seven times two is eight, and two times two is four but I forgot the previous value. How much is the total? &quot;Thirty&quot;, said a loud voice. I shook my head as it can’t be that less. But as my sense prevailed, I panicked fearing if I had thought loudly enough for everyone to hear. &quot;Sir, Thirty change?&quot;, said the conductor. I took my change quickly, partly relieved as the laws of the physics were not broken and I could still think quietly.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;/img/laws-physics.gif&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;Amid all my rambling, I forgot introduce to you my protagonist, a random stranger. On that fateful day, he was also accompanying me in the bus. However he rarely attracted my attention. He was sitting somewhere in the front seat shrouded with many occupied seats. Tangential to him, sat a beautiful girl who was busy caressing her hair. Einstein showed in his theory of relativity how gravity can curve the space. Well my sensory neurons occasionally warped space to catch glimpse of her.&lt;/p&gt;
    &lt;p&gt;Growing up  with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bollywood movies&lt;/code&gt; has given me unearthly ideas which defies common sense. I began interweaving story in which some miscreants would break into the bus, attack the girl, and I gallantly saved her. After I penned my imaginary love story, I reckon a less risky approach would be to just simply say &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hi&lt;/code&gt;. However people especially girls don&apos;t entertain greetings from random strangers. With a sigh, I opened my phone and began playing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Candy Crush&lt;/code&gt;. (Later that night, lot of my friends in Facebook blocked me for sending them &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Candy Crush&lt;/code&gt; request).&lt;/p&gt;
    &lt;p&gt;Soon more passengers flooded the bus thus disturbing the geometry of space. The tangential space changed to orthogonal, and my sensor neurons no longer caught the sight of her. However some abstruse angle allowed me to notice my random stranger. But why should I be intrigued by him? I ignored him, for lack of interest and resumed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Candy Crush&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &quot;Have you ever had a dream, Neo, that you were so sure was real? What if you were unable to wake from that dream? How would you know the difference between the dream world and the real world?&quot; - Morpheus
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;The other day I was reading about &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Quantum Physics&lt;/code&gt;. Bizarre events happens in quantum which are antithesis to common sense. Atoms could be at two different position at the same time thanks to superpostition. Or electrons could message each other instantly from any distance due to quantum entanglement. But ripples of such quantum effects are usually not felt in our larger world. However scientist agree that this whole universe is quantum. And sometimes such bizarre quantum effects may spill into our world.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;/img/atom-superposition.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;His glanced at me occasionally, arousing my curiosity. However I shrugged off this behaviour as it was trivial. There was nothing appealing in him. May be his prosaicness was his hallmark; bland, unpolished shoes, uncouth hair, with a air of callousness. His shoes were worn out and his looks had fatigue. His eyes met mine more than once and it seems they spoke. And it seems the surrounding around me grew dimmer until I could feel only his presence in the bus.&lt;/p&gt;
    &lt;p&gt;Time often slows down when you move closer to the speed of light. Electrons communicates at wide distances almost instantly. However sometimes you experience quantum physics in your macro life. When you see your own reflection sitting in front of you. And your heart beats faster when you realize that your reflection is real. I stood motionless when I saw the random stranger was nothing but my own reflection. The random stranger was me.&lt;/p&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    Mad Hatter: &quot;Have I gone mad?&quot; &lt;br /&gt;
    Alice Kingsley: &quot;I’m afraid so. You’re entirely bonkers. But I’ll tell you a secret. All the best people are.&quot;
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Some times traffic makes you mad. Common symptom involves visualizing cinematic effects around you. The windows of the bus turned into a hologram projecting the life outside the bus. And time slowed down and nothing moved except the flurry of images on the window.&lt;/p&gt;
    &lt;p&gt;Out of the cosmic window I saw lives of people dragging their mundane lives. A lady was selling buttermilk on the sides of the pavement. And every time a customer came, she smiled and thanked him wholeheartedly. Her protruding teeth and bare foot could not conceal her poverty. And the sun felt pity on her and blaze down on the people below which attracted her more customers.&lt;/p&gt;
    &lt;p&gt;I caught the glance of another window. Few people were standing across the street waiting for the bus. Girls had draped scarf over ther head to avoid any dust and ogling. A young boy was absorbed in his music as he stood in corner separated from the crowd. I saw two man crossing the street while holding hands. Such behaviour is tacitly considered as romantic worldwide. However Indian government doesn&apos;t believe homosexuality exist as it is against Indian culture. They were just close friends, I believed.&lt;/p&gt;
    &lt;p&gt;Another window had a reflection of a beautiful young girl. Wearing a funky T-shirt and a jean, she leaned towards the shop to have a cigarette. One middle age man was scornfully looking at her. &quot;Girls wearing jeans these days have lost all values&quot;, he mumbled while puffing his own smoke. Another young lad stood at the opposite side of the road bore a distressed look. &quot;But why is she smoking. She is so pretty&quot;, he thought. Like some men he also held common misconceptions about pretty descent girls in India. However he forgot that pretty girls were humans too. They also did fart.&lt;/p&gt;
    &lt;p&gt;And the images continued to flash. It was difficult to describe the immense diversity of the life I saw at once; both the rich and the poor; the beauty and their admirers, hawkers selling in their high pitched voice. Lastly I saw the random stranger, a common man who was everywhere.&lt;/p&gt;
    &lt;p&gt;And soon the hangover of the images had a anathestic effect on me. And the light grew dimmer until my surrounding were devoid of any images and sound.. According to quantum mechanics, I had plunged into a quantum sleep.&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;/img/quantum_mechanics.png&quot; /&gt;
    &lt;/center&gt;
    &lt;center&gt;
    Image credit ~ &lt;a href=&quot;https://xkcd.com/1240/&quot;&gt;xckd&lt;/a&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;Heavy bumps are often advised by doctors to cure for day dreaming. Luckily Indian Municipality has heeded to doctor&apos;s advice and deliberately created potholes on Indian roads at regular intervals for convenience. However sudden brakes of the bus literary pulled me out of my dreams. I stood up &amp;amp; offered my seat to another man, who thanked me. I somehow squeezed through to reach the exit and alighted from the bus.&lt;/p&gt;
    &lt;p&gt;The sun had now retired to give respite to people for the day. The traffic was gradually uncoiling. I stood there watching the bus depart. The experience I spent in the bus was surreal. The bus was anthropomorphically transmuted into a random stranger with whom I shared my dream. My eyes were moist as I saw the bus dissolve into traffic and disappear (May be my emotions were due to inhaling of smoke). I pulled out my ticket &amp;amp; tossed it into the air in agony of estrangement. And I walked away in the opposite direction of the bus.&lt;/p&gt;
  </description>
  <pubDate>2016-02-07T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/random-stranger</link>
<guid isPermaLink="true">https://randomwits.com/blog/random-stranger</guid>
</item>
<item>
  <title>Setup php on MacOS localhost</title>
  <description>&lt;p&gt;Users with the newest versions of Mac OS X (Mountain Lion or later) no longer see the option of web sharing in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;System Preferences-&amp;gt;Sharing&lt;/code&gt;. If you are a web developer / designer, you might find this change unpleasant. However Mac OS X still includes Apache HTTP version.&lt;/p&gt;
    &lt;p&gt;Testing web sites on your personal computer is indispensable for web developers / designers. Enabling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php&lt;/code&gt; on Mac OX S is plain and easy. &lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Users with the newest versions of Mac OS X (Mountain Lion or later) no longer see the option of web sharing in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;System Preferences-&amp;gt;Sharing&lt;/code&gt;. If you are a web developer / designer, you might find this change unpleasant. However Mac OS X still includes Apache HTTP version.&lt;/p&gt;
    &lt;p&gt;Testing web sites on your personal computer is indispensable for developers / designers. Enabling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php&lt;/code&gt; on Mac OX S is plain and easy.&lt;/p&gt;
    &lt;p&gt;First test your apache server. Open your terminal and type&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;httpd &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you see something similar, we are good to proceed.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Server version: Apache/2.4.16 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Unix&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    Server built:   Jul 31 2015 15:53:26
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Unix like operating system keep its configuration files in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /etc 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Copy the default &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php&lt;/code&gt; file.  The php.ini file is where you declare changes to your PHP settings. You can use the default settings for the server, change specific settings by editing the existing php.ini, or create a new text file and name it php.ini`.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo cp &lt;/span&gt;php.ini.default php.ini 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Open the following file &amp;amp; search line number containing  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libexec/apache2/libphp5.so&lt;/code&gt; &amp;amp; uncomment it (remove the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#&lt;/code&gt; from the front)&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;pico /etc/apache2/httd.conf 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Save and close the editor by pressing &lt;strong&gt;Control-O&lt;/strong&gt; followed by &lt;strong&gt;Control-X&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Next we need to create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sites&lt;/code&gt; folder. It will be used for saving sites hosted on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo mkdir&lt;/span&gt; ~/Sites
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo chmod &lt;/span&gt;o+r ~/Sites
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;?php phpinfo(); ?&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; ~/Sites/phptest.php
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo chmod &lt;/span&gt;o+r ~/Sites/phptest.php
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next, edit the following file. Write your username instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tushar&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;pico /etc/apache2/users/&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;whoami&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;.conf
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;For all systems other than Yosemite, use the following as the content:&lt;/p&gt;
    &lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;Directory&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;/Users/tushar/Sites/&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from localhost
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/Directory&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;For Yosemite, use this content:&lt;/p&gt;
    &lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;Directory&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;/Users/tushar/Sites/&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    AddLanguage en .en
    LanguagePriority en fr de
    ForceLanguagePriority Fallback
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from localhost
    Require all granted
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/Directory&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Enable the web server&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apachectl start
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Change the permission of the configuration folder.&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo chown &lt;/span&gt;root:wheel /etc/apache2/users/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo chmod &lt;/span&gt;644 /etc/apache2/users/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Restart the server&lt;/p&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apachectl restart
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Lastly , go to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost&lt;/code&gt; to confirm.&lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/localhost.png&quot; /&gt;
    &lt;/p&gt;
  </description>
  <pubDate>2016-01-29T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/localhost-php-setup-mac</link>
<guid isPermaLink="true">https://randomwits.com/blog/localhost-php-setup-mac</guid>
</item>
<item>
  <title>Get all GET and POST requests using tshark</title>
  <description>&lt;p&gt;Browsers have made browsing insanely easy. Toolbar fetches webpage magically. However, under the hood, lots of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;requests&lt;/code&gt; are exchanged. These requests are based on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REST&lt;/code&gt; architecture.&lt;/p&gt;
    &lt;p&gt;What is REST? REST is &lt;strong&gt;RE&lt;/strong&gt;presentational &lt;strong&gt;S&lt;/strong&gt;tate &lt;strong&gt;T&lt;/strong&gt;ransfer. Loosely speaking it defines how resources are exchanged based on item of request. Two most common HTTP Request Methods are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt;. Using tshark, we can see the headers exchange as you browse the web.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Browsers have made browsing insanely easy. Toolbar fetches webpage magically. However, under the hood, lots of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;requests&lt;/code&gt; are exchanged. These requests are based on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REST&lt;/code&gt; architecture.&lt;/p&gt;
    &lt;p&gt;What is REST? REST is &lt;strong&gt;RE&lt;/strong&gt;presentational &lt;strong&gt;S&lt;/strong&gt;tate &lt;strong&gt;T&lt;/strong&gt;ransfer. Loosely speaking it defines how resources are exchanged based on item of request. Two most common HTTP Request Methods are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt;. Using tshark, we can see the headers exchange as you browse the web.&lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/shart.jpg&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;Check your network interface by typing (Mac or Linux)&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ ifconfig
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Capture all &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; request using tshark on the network interface &amp;amp; save it to the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/out.ncap&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ tshark -i en1 -f &apos;port 80 and 
    (tcp[((tcp[12:1] &amp;amp; 0xf0) &amp;gt;&amp;gt; 2):4] = 0x504F5354 or 
    tcp[((tcp[12:1] &amp;amp; 0xf0) &amp;gt;&amp;gt; 2):4] = 0x47455420)&apos; -w ~/out.ncap   
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The above commands looks gibberish, however if you analyze closely, its plain easy. Lets read it line by line&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tshark&lt;/code&gt;
    &lt;ul&gt;
    &lt;li&gt;Network Protocol Analyzer&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-i&lt;/code&gt;
    &lt;ul&gt;
    &lt;li&gt;Interface&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;en1&lt;/code&gt;
    &lt;ul&gt;
    &lt;li&gt;Name of the interface&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80&lt;/code&gt;
    &lt;ul&gt;
    &lt;li&gt;Default &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http&lt;/code&gt; port number&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(tcp[((tcp[12:1] &amp;amp; 0xf0) &amp;gt;&amp;gt; 2):4] = 0x504F5354&lt;/code&gt;
    &lt;ul&gt;
    &lt;li&gt;Take the upper 4 bits of the 12th octet in the tcp header  ( tcp[12:1] &amp;amp; 0xf0 )&lt;/li&gt;
    &lt;li&gt;multiply it by four &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;((tcp[12:1] &amp;amp; 0xf0)&amp;gt;&amp;gt;2)&lt;/code&gt; which should give the tcp header length&lt;/li&gt;
    &lt;li&gt;Take Four octets from the tcp stream, starting at that offset &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(tcp[(((tcp[12:1] &amp;amp; 0xf0) &amp;gt;&amp;gt; 2)):4])&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Lastly, verify that they are equal to POST which is 0x504F5354 in hex.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tcp[((tcp[12:1] &amp;amp; 0xf0) &amp;gt;&amp;gt; 2):4] = 0x47455420)&lt;/code&gt;
    &lt;ul&gt;
    &lt;li&gt;Like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; command, it checks for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt; request.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-w&lt;/code&gt;
    &lt;ul&gt;
    &lt;li&gt;Dumps the output&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/out.ncap&lt;/code&gt;
    &lt;ul&gt;
    &lt;li&gt;The output file&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Now start surfing the web &amp;amp; see the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; &amp;amp; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt; request by typing&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ tail -f ~/out.ncap 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
  </description>
  <pubDate>2016-01-14T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/get-post-requests</link>
<guid isPermaLink="true">https://randomwits.com/blog/get-post-requests</guid>
</item>
<item>
  <title>Guide to install Arch Linux</title>
  <description>&lt;style type=&quot;text/css&quot;&gt;
    .myheading{font-family:Georgia, &quot;Times New Roman&quot;, Times, serif;font-size:24px;margin-top:5px;margin-bottom:0;text-align:center;font-weight:400;color:#222}
    .mysubheading{font-family:&quot;Lucida Grande&quot;, Tahoma;font-size:10px;font-weight:lighter;font-variant:normal;text-transform:uppercase;color:#666;margin-top:10px;text-align:center!important;letter-spacing:.3em}
    &lt;/style&gt;
    &lt;p&gt;I finally divorced &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Windows&lt;/code&gt; soon after I fell in love with Linux. Ubuntu was my first love. I met her on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Distrowatch&lt;/code&gt;. But she spoke no English. So I spent hours gawking at her sleaky terminal trying to learn her language, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bash&lt;/code&gt;.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;/js/shCore.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;/js/shBrushCpp.js&quot;&gt;&lt;/script&gt;
    &lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;/css/shCoreDefault.css&quot; /&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;SyntaxHighlighter.all();&lt;/script&gt;
    &lt;p&gt;I finally divorced &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Windows&lt;/code&gt; soon after I fell in love with Linux. Ubuntu was my first love. I met her on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Distrowatch&lt;/code&gt;. But she spoke no English. So I spent hours gawking at her sleaky terminal trying to learn her language, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bash&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;Soon I flirted with others; Mint came but reminded me of my ex, Fedora had a different &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yum&lt;/code&gt;, BSD couldn&apos;t agree on my license, Debian was old schooled. Few months ago, I discovered grey hair on my head and decided to settle down. So I started looking for someone who was simple yet was elegant. Little did I know that I would stumble upon Arch Linux.&lt;/p&gt;
    &lt;p&gt;Dating Arch is a different game. She is not just another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;click-next-install&lt;/code&gt; Linux. Like any good relationship, it needs time. So you need to undertand &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bricks &amp;amp; bolts&lt;/code&gt; of Linux system. Well it turns out, learning Arch is much simpler than building a house in LEGO.&lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/lego_walls.jpg&quot; /&gt;
    &lt;/p&gt;
    &lt;h1 id=&quot;step-1--find-the-base&quot;&gt;Step 1 : Find the base&lt;/h1&gt;
    &lt;p&gt;Through out this guide, I&apos;ll keep our LEGO analogy. At the end we&apos;ll have a working house i.e. Arch Linux. But before we begin installing Arch, we need to decide our base.&lt;/p&gt;
    &lt;p&gt;Loosely speaking, Base is a box on which the Arch Linux will be installed. There are multiple candidates for the base&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Whole system&lt;/li&gt;
    &lt;li&gt;Dual Boot&lt;/li&gt;
    &lt;li&gt;Hypervisor&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;&lt;b&gt;Whole System&lt;/b&gt; : Choose this if you want to remain faithful to only Arch Linux. This would wipe off any other operating system you have on your computer. Though Arch is great, however some your fancy hardware may not find their drivers. If you like games, probably you also occassionally need to talk to Windows. &lt;/p&gt;
    &lt;p&gt;&lt;b&gt;Dual Boot&lt;/b&gt; : Choose this if you want the best of both worlds. You can install Arch Linux along side your legacy operating system. However this requires little effort in trying to keep both operating system together. You need to manually partition physical file system and edit the boot loader.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Hypervisor&lt;/strong&gt; : Choose this if you dont want to physically partition your memory. It lets you create an abstraction layer where you could virtually run mutliple operating systems. Also if you&apos;re beginning to learn Arch Linux, I would recommend you to proceed with this method.&lt;/p&gt;
    &lt;h1 id=&quot;step-2--plan-your-house&quot;&gt;Step 2 : Plan your house&lt;/h1&gt;
    &lt;p&gt;Next step in our LEGO design, require us to plan our house. For Arch Linux, we need to prepare our system before installing Arch it.&lt;/p&gt;
    &lt;p&gt;I&apos;m assuming that you have createa a bootable medium (CD or usb)  for Arch Linux. If you are on a Unix like system, you can type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo dd if=/path/to/arch.iso  of=/dev/sdX bs=4m &amp;amp;&amp;amp; sync
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If you are using Windows, you can find many bootable software like Unetbootin.&lt;/p&gt;
    &lt;p&gt;Next you need to plug in your bootable medium &amp;amp; select your computer to boot from that instead of your default boot medium. After successful booting, you will be greeted with a bluish black screen with multiple options. I&apos;ll proceed with the first option which loads a 64 bits Arch Linux. &lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_start.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_root.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;Check all the available &lt;strong&gt;sysfs filesystem&lt;/strong&gt; on the system. We only have one primary hard drive &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/sda&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# lsblk
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_lsblk.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;Next we need to partition the filesystem. I&apos;ll divide the filesystem into following&lt;/p&gt;
    &lt;p&gt;1.&lt;strong&gt;BIOS Partition&lt;/strong&gt; : This is the partition for BIOS grub.  We set &quot;bios_grub&quot; flag on.&lt;/p&gt;
    &lt;p&gt;2.&lt;strong&gt;Boot Partition&lt;/strong&gt; : This is the partition for virtual &quot;boot loader&quot;.&lt;/p&gt;
    &lt;p&gt;3.&lt;strong&gt;Swap Partition&lt;/strong&gt; : (Optional) This is used for computer to free use extra space, when computer with lots of applications running can free some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RAM&lt;/code&gt;.&lt;/p&gt;
    &lt;p&gt;4.&lt;strong&gt;Root Partition&lt;/strong&gt; : This is the partition that serves as the highest level of your computer’s file system&lt;/p&gt;
    &lt;p&gt;5.&lt;strong&gt;Home Partition&lt;/strong&gt; : This is the partition where rest of your files and personal settings will live.&lt;/p&gt;
    &lt;p&gt;Each partition information is stored in &quot;partition table&quot;. There are 2 main formats in use: the classic Master Boot Record, and the modern GUID Partition Table. I&apos;ll be using GPT partition table which is an improved version that does away with several limitations of MBR style.&lt;/p&gt;
    &lt;p&gt;To use &lt;strong&gt;GPT partition&lt;/strong&gt;, type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# gdisk /dev/sda
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_gdisk.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;To create five partion, follow five parts&lt;/p&gt;
    &lt;h2 id=&quot;create-partition-one&quot;&gt;Create Partition ONE&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Type ‘n’ at the prompt and hit &apos;Return&apos;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a partition number, hit ‘Return’ to accept the default (1).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “first sector”, hit &apos;Return&apos; to accept the default.  This will start the partition at the beginning of your virtual hard disk.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “last sector”, type  &apos;+32m&apos;. This will create 32 megabytes in size, which is used for BIOS grub.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a &quot;hex code&quot;, type &apos;EF02&apos; and hit &apos;Return&apos;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_gpt.png&quot; /&gt;
    &lt;/p&gt;
    &lt;h2 id=&quot;create-partition-two&quot;&gt;Create Partition Two&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Type ‘n’ at the prompt and hit &apos;Return&apos;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a partition number, hit ‘Return’ to accept the default (1).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “first sector”, hit &apos;Return&apos; to accept the default.  This will start the partition at the beginning of your virtual hard disk.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “last sector”, type  &apos;+1g&apos;. This will create 1 gigabytes in size, which is used for bootloader partition.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a &quot;hex code&quot;, type &apos;8300&apos; and hit &apos;Return&apos;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;create-partition-three&quot;&gt;Create Partition Three&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Type ‘n’ at the prompt and hit &apos;Return&apos;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a partition number, hit ‘Return’ to accept the default (1).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “first sector”, hit &apos;Return&apos; to accept the default.  This will start the partition at the beginning of your virtual hard disk.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “last sector”, type  &apos;+2g&apos;. This will create 2 gigabytes in size, which is used for swap partition.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a &quot;hex code&quot;, type &apos;8200&apos; and hit &apos;Return&apos;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;create-partition-four&quot;&gt;Create Partition Four&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Type ‘n’ at the prompt and hit &apos;Return&apos;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a partition number, hit ‘Return’ to accept the default (1).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “first sector”, hit &apos;Return&apos; to accept the default.  This will start the partition at the beginning of your virtual hard disk.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “last sector”, type  &apos;+15g&apos;. This will create 15 gigabytes in size, which is used for root partition.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a &quot;hex code&quot;, type &apos;8300&apos; and hit &apos;Return&apos;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;create-partition-five&quot;&gt;Create Partition Five&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Type ‘n’ at the prompt and hit &apos;Return&apos;.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a partition number, hit ‘Return’ to accept the default (1).&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “first sector”, hit &apos;Return&apos; to accept the default.  This will start the partition at the beginning of your virtual hard disk.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a “last sector”, hit &apos;Return&apos;. This will allocate remaining size, which is used for home partition.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;When it asks for a &quot;hex code&quot;, type &apos;8300&apos; and hit &apos;Return&apos;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;h2 id=&quot;write-to-partition&quot;&gt;Write to Partition&lt;/h2&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Type &apos;p&apos; to see all the partition&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Type &apos;w&apos; to save the partition to the filesystem.&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_gpt_write.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;You can also see your final filesystem, by typing&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# fdisk -l  
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_fdisk.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;Next we need to format our partitons before we install Arch Linux. However don&apos;t format the first partition i.e. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/sda1&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# mkfs -t ext4 /dev/sda2
    # mkfs -t ext4 /dev/sda4
    # mkfs -t ext4 /dev/sda5
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt; 
    Also format the swap space and switch it on.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# mkswap /dev/sda3
    # swapon /dev/sda3
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h1 id=&quot;step-3--build-the-walls&quot;&gt;Step 3 : Build the walls&lt;/h1&gt;
    &lt;p&gt;We are very close to building &lt;strike&gt;our house in Lego&lt;/strike&gt; Arch Linux. We need to start building our &lt;strike&gt;walls&lt;/strike&gt; system.
    &lt;/p&gt;
    &lt;p&gt;Linux follows the root hierarchy. So we need to mount the root partition first i.e. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/sda4&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# mount /dev/sda4 /mnt
    # cd /mnt
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next we need to mount partition for bootloader and home on root partition.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# mkdir boot home
    # mount /dev/sda2 boot
    # mount /dev/sda5 home
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now we are ready to install Arch Linux on our system. Type the following command and sit back for few minutes before everything is loaded&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# pacstrap /mnt base base-devel
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;After this we need to install bootloader. When a computer loads up, it needs bootloader to find and load an operating system. There are many bootloaders to install like syslinux, grub, LILO, etc but we&apos;ll be using GRUB for this guide.&lt;/p&gt;
    &lt;p&gt;Local and remote filesystem mounts a special file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/fstab&lt;/code&gt; which contains instructions on starting up all your Linux system’s various partitions. To generate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fstab&lt;/code&gt; file type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#  genfstab -p /mnt &amp;gt;&amp;gt; /mnt/etc/fstab
    #  nano /mnt/etc/fstab 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_fstab.png&quot; /&gt;
    &lt;/p&gt;
    &lt;h1 id=&quot;step-4--add-a-roof&quot;&gt;Step 4 : Add a roof&lt;/h1&gt;
    &lt;p&gt;You can&apos;t live in your Lego home before you add a roof. Similarly you can&apos;t reboot your system now before you initialize your Boot Loader.&lt;/p&gt;
    &lt;h2 id=&quot;install-grub-on-non-efi-system&quot;&gt;Install Grub on non-efi system&lt;/h2&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# pacstrap /mnt grub
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Next you need to login to your system without rebooting. Type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# arch-chroot /mnt /bin/bash
    # grub-install --no-floppy /dev/sda
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_grub_install.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;Lastly, generate the configuration file for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grub&lt;/code&gt;.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# grub-mkconfig -o /boot/grub/grub.cfg
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you are dual booting on efi system, installing grub would be slightly different. You could follow this &lt;a href=&quot;https://github.com/pandeiro/arch-on-air&quot;&gt;blog&lt;/a&gt;&lt;/p&gt;
    &lt;p&gt;Now you could easily reboot your system. However it&apos;s advised that you follow the last step to make it more usable.&lt;/p&gt;
    &lt;h1 id=&quot;step-5--add-final-touches&quot;&gt;Step 5 : Add final touches&lt;/h1&gt;
    &lt;p&gt;We have built our little home, Arch Linux. However we need more than a blank terminal to stare at.&lt;/p&gt;
    &lt;p&gt;First we’ll edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/locale.gen&lt;/code&gt;. type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# nano /etc/locale.gen 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;And uncomment the following two lines by removing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#&lt;/code&gt; from the front&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;en_US.UTF-8 UTF-8
    en_US ISO-8859-1
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Generate the updated file by typing&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# locale.gen
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Change the hostname and enter the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hostname&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# nano /etc/hostname
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Change the time zone to your location&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# ln -s /usr/share/zoneinfo/America/New\_York /etc/localtime
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;We need to tell the computer to connect to the internet. We need to run the following command&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# dhcpcd
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;To permanently make this changes, type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# systemctl enable dhcpcd 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;You dont want to forever live with the terminal. Legacy operating system usually come preinstalled with Windowing Environment. For Unix like OS we need to install Window Manger to manage graphical user interface. X11 is a windowing protocol which provides basic user interface. To install X11, type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# sudo pacman -S xorg-twm xorg-xclock xterm
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Well we also need to install a destop environment. Destop environment uses X11 to provide better user interface. Popular examples are GNOME, KDE, etc. I like tiling window environment which is suited for people who like tinkering &amp;amp; since you&apos;re installing Arch Linux, I reckon i3 would appeal to you. To install i3, type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# sudo pacman -S i3
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now, once you have .i3 installed, just go to your ~/.xinitrc and add:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;exec i3
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Customize GTK&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo pacman -S lxappearance 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Sometimes we need to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh&lt;/code&gt; into the virtual box. First select your virtual machine &amp;amp; click &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Settings-&amp;gt;Network-&amp;gt;Advanced-&amp;gt;Port Forwarding&lt;/code&gt;&lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/vbox_ssh1.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/vbox_ssh2.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/vbox_ssh3.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;Now we need to login into virtual box, &amp;amp; install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;openssh&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo pacman -S openssh 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Generate your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh-key&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ ssh-keygen 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Start &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh daemon&lt;/code&gt; at the login time&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo systemctl enable sshd.socket
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Finally on your Host computer, type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ ssh -p 3333 username@127.0.0.1 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;And finally :)&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# reboot
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;!--break--&gt;
    &lt;h1 id=&quot;step-6--play-with-your-house&quot;&gt;Step 6 : Play with your house&lt;/h1&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/final.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/final_display.png&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;To start the Window Enviroment, type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ startx 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/arch_i3.png&quot; /&gt;
    &lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://wiki.archlinux.org/index.php/Arch_Linux#Principles&quot; target=&quot;_blank&quot;&gt;Arch Linux Priniples&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.pcworld.com/article/2911459/why-nvidia-graphics-cards-are-the-worst-for-open-source-but-the-best-for-linux-gaming.html&quot; target=&quot;_blank&quot;&gt;Graphics Card NVIDIA&lt;/a&gt;&lt;/p&gt; 
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://arstechnica.com/information-technology/2013/09/nvidia-seeks-peace-with-linux-pledges-help-on-open-source-driver/&quot; target=&quot;_blank&quot;&gt;NVIDIA pledges support to Linux&lt;/a&gt;&lt;/p&gt; 
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2015-12-26T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/arch-linux</link>
<guid isPermaLink="true">https://randomwits.com/blog/arch-linux</guid>
</item>
<item>
  <title>Quickly sort large file in linear time</title>
  <description>&lt;p&gt;Any deterministic general sorting algorithm  has average case time complexity $ O(nlogn) $ . However, certain sorting algorithm can run faster in $ O(n) $ but with limitation. Instead of comparision-based sort, each element is looked individually by its value. Radix sort is one fine example of integer sorting.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;/js/shCore.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;/js/shBrushCpp.js&quot;&gt;&lt;/script&gt;
    &lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;/css/shCoreDefault.css&quot; /&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;SyntaxHighlighter.all();&lt;/script&gt;
    &lt;p&gt;Any deterministic general sorting algorithm has an average-case time complexity of Ω(nlogn). However, certain sorting algorithms can run faster in O(n) but with limitations&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. Instead of comparison-based sorting, each element is examined individually based on its value. Radix sort is a prime example of an integer sorting algorithm.&lt;/p&gt;
    &lt;center&gt;
    &lt;img src=&quot;/img/alphabet.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h1 id=&quot;problem-statement&quot;&gt;Problem Statement&lt;/h1&gt;
    &lt;p&gt;Suppose, we have large directory containing names of people in random order. The names need not be distinct. We need to sort the name in the ascending order. Also our algorithm should run in linear time. A sample of the input file is shown below&lt;sup&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;JAMES          1.664  1.664      1
    TUSHARSHARMATUSHARSHARMA   1.99 3
    JOHN           1.642  3.305      2
    ROBERT         1.576  4.881      3
    MICHAEL        1.321  6.202      4
    MARY           1.319  7.521      5
    WILLIAM        1.230  8.750      6
    DAVID          1.185  9.934      7
    RICHARD        0.854 10.788      8
    CHARLES        0.765 11.552      9
    JOSEPH         0.705 12.257     10
    THOMAS         0.692 12.948     11
    PATRICIA       0.539 13.486     12
    CHRISTOPHER    0.519 14.005     13
    LINDA          0.518 14.523     14
    BARBARA        0.490 15.013     15
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h1 id=&quot;desired-output&quot;&gt;Desired Output&lt;/h1&gt;
    &lt;p&gt;The output file contains the names read from the file and sort them alphabetically.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;AARON
    ABBEY
    ABBIE
    ABBY
    ABDUL
    ABE
    ABEL
    ABIGAIL
    ABRAHAM
    ABRAM
    ADA
    ADAH
    ADALBERTO
    ADALINE
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Each line is read upto k = 21 characters (arbitrary). Any character after 21st position is truncated.&lt;/p&gt;
    &lt;h1 id=&quot;radix-sort&quot;&gt;Radix Sort&lt;/h1&gt;
    &lt;p&gt;Radix sorts the integer by their least significant @L \mathtt{d}@L bits. @L \mathtt{w}/\mathtt{d}@L passes  are made to &lt;strong&gt;counting-sort&lt;/strong&gt; which sorts @L \mathtt{w}@L-bit integers. Following could be easily implemented in &lt;strong&gt;C++&lt;/strong&gt;.&lt;/p&gt;
    &lt;pre class=&quot;brush: cpp;  title: ; notranslate&quot;&gt;
    void lsdRadixSort(char S[][k])
    {
    for (int d = k - 1; d &amp;gt;=0 ; d--) {
    countingSort(S, d);
    }
    }
    &lt;/pre&gt;
    &lt;p&gt;Procedure &lt;strong&gt;lsdRadixSort&lt;/strong&gt; reads an array &lt;strong&gt;S&lt;/strong&gt; of size &lt;strong&gt;n * k&lt;/strong&gt;. For each &lt;strong&gt;d&lt;/strong&gt; integers, it passes array and the index to &lt;strong&gt;countingSort&lt;/strong&gt; procedure. The main sorting occurs at Counting Sort.&lt;/p&gt;
    &lt;h1 id=&quot;counting-sort&quot;&gt;Counting Sort&lt;/h1&gt;
    &lt;p&gt;Counting sort an array of integer of length &lt;strong&gt;n&lt;/strong&gt;. Radix sort uses several passes of Counting Sort to sort the array of size &lt;strong&gt;n * k&lt;/strong&gt; . The algorithm works like this&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;
    &lt;p&gt;Count frequencies of each letter using key as index&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Compute frequency cumulates&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Access cumulates using key as index to find record positions.&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p&gt;Copy back into original array&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;
    &lt;center&gt;
    &lt;img src=&quot;/img/counting.png&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;Following is the &lt;strong&gt;C++&lt;/strong&gt; implementation of Counting Sort.&lt;/p&gt;
    &lt;pre class=&quot;brush: cpp;  title: ; notranslate&quot;&gt;
    void countingSortSwap(char S[][k], int j)
    {
    //here j is the column 
    int count[256] = {0};
    char temp[n][k];
    temp[0][0] = &apos; &apos;;
    for (int i = 0; i &amp;lt; n; i++) {
    int valueChar = (int) S[i][j];
    count[valueChar + 1]++;
    }
    for (int p = 1; p &amp;lt; 256; p++) {
    count[p] += count[p - 1];
    }
    for (int i = 0; i &amp;lt; n; i++) {
    int valueChar = (int)S[i][j];
    int index = count[valueChar++]++;
    for (int p = 0; p &amp;lt; k; p++) {
    temp[index][p] = S[i][p];
    }
    }
    for (int i = 0; i &amp;lt; n; i++) {
    for (int p = 0; p &amp;lt; k; p++) {
    S[i][p] = temp[i][p];
    }
    }
    }
    &lt;/pre&gt;
    &lt;h1 id=&quot;more-efficiently&quot;&gt;More Efficiently?&lt;/h1&gt;
    &lt;p&gt;Radix sort can also be implemented without avoiding the hassle of moving the array to and fro. We use a pointer array (array of string indices) &lt;strong&gt;indexP[0..n−1]&lt;/strong&gt;. Initially, set indexP[i] = i for all i. During the sorting, we move these indices. At the end of sorting, indexP[0] will be the index of the string which is the first in the sorted order, indexP[1] the second string in the sorted order, and so on.&lt;/p&gt;
    &lt;p&gt;We also declare &lt;strong&gt;prevIndex[0..n-1]&lt;/strong&gt; to keep track of indicies of previous sorting. Thus our &lt;strong&gt;lsdRadixSort&lt;/strong&gt; procedure would be slighlty different as&lt;/p&gt;
    &lt;pre class=&quot;brush: cpp;  title: ; notranslate&quot;&gt;
    void lsdRadixSort(char S[][k], int indexP[])
    {
    int count[k];
    int prevIndex[n];
    for (int d = 0; d &amp;lt; n ; d++ )
    prevIndex[d] = d;
    for (int d = k - 1; d &amp;gt;=0 ; d--) {
    countingSortp(S, d, indexP, prevIndex);
    }
    }
    &lt;/pre&gt;
    &lt;p&gt;Following is the new C++ implementation of Counting Sort.&lt;/p&gt;
    &lt;pre class=&quot;brush: cpp;  title: ; notranslate&quot;&gt;
    void countingSort(char S[][k], int j, int indexP[], int prevIndex[])
    {
    //here j is the column 
    int count[256] = {0};
    int tempCount[n];
    memset(tempCount, 0, sizeof(int) * n);
    for (int i = 0; i &amp;lt; n; i++) {
    int valueChar = (int) S[prevIndex[i]][j];
    count[valueChar + 1]++;
    }
    for (int p = 1; p &amp;lt; 256; p++) {
    count[p] += count[p - 1];
    }
    for (int i = 0; i &amp;lt; n; i++) {
    int valueChar = (int)S[prevIndex[i]][j];
    int index = count[valueChar++]++;
    tempCount[index] =   prevIndex[i];
    }
    for (int i = 0; i &amp;lt; n; i++) {
    indexP[i] = tempCount[i];
    prevIndex[i] = tempCount[i];
    }
    }
    &lt;/pre&gt;
    &lt;p&gt;Finally we print the names in ascending order in the file as per as the sorted &lt;strong&gt;indexP[0 .. n-1]&lt;/strong&gt;.&lt;/p&gt;
    &lt;pre class=&quot;brush: cpp;  title: ; notranslate&quot;&gt;
    printToFile(char S[][k], string filename, int indexP[])         
    {
    int tempP[n];
    memset(tempP, 0, sizeof(int) * n);
    fo.open\(filename.c\_str\(), ios::out | ios::binary);
    if (!fo) {
    cout&amp;lt;&amp;lt;&quot;Error opening the file\n&quot;;
    exit(-1);
    }
    for (int i = 0; i &amp;lt; n; i++) {
    for (int j = 0; j &amp;lt; k; j++) {
    fo &amp;lt;&amp;lt;S[indexP[i]][j];
    }
    fo&amp;lt;&amp;lt;endl;
    }
    }
    &lt;/pre&gt;
    &lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;
    &lt;p&gt;The sort runs in linear time as discussed earlier. Below is time it took against input of different size.&lt;/p&gt;
    &lt;table&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;**n**&lt;/td&gt;
    &lt;td&gt;**k**&lt;/td&gt;
    &lt;td&gt;**time (s)**&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;8&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.000591&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;16&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.000674&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;32&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.000762&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;64&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.000961&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;128&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.001582&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;256&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.002517&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;512&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.004514&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;1024&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.008236&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;2048&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.013947&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;4096&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.0263&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;5164&lt;/td&gt;
    &lt;td&gt;21&lt;/td&gt;
    &lt;td&gt;0.033631&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;/img/lsd.png&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;Download the &lt;a href=&quot;https://github.com/tushar-sharma/lsdRadixSort.git&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt; Special case for Integers&lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;Assuming that the names are not greater than arbitrary number k&lt;/p&gt; 
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2015-11-20T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/lsd</link>
<guid isPermaLink="true">https://randomwits.com/blog/lsd</guid>
</item>
<item>
  <title>Why people like Programming</title>
  <description>&lt;style type=&quot;text/css&quot;&gt;
    .myheading{font-family:Georgia, &quot;Times New Roman&quot;, Times, serif;font-size:24px;margin-top:5px;margin-bottom:0;text-align:center;font-weight:400;color:#222}
    .mysubheading{font-family:&quot;Lucida Grande&quot;, Tahoma;font-size:10px;font-weight:lighter;font-variant:normal;text-transform:uppercase;color:#666;margin-top:10px;text-align:center!important;letter-spacing:.3em}
    &lt;/style&gt;
    &lt;p&gt;Imagine a sunset, with a tired sun sinking over a meadow. The chirping of birds steals your attention as they return to their homes. And while the sun disappears, you sink back and relish your sourrounding.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;
    Imagine a sunset, with a tired sun sinking over a meadow. The chirping of birds steals your attention as they return to their homes. And while the sun disappears, you sink back and
    relish your sourrounding. 
    &lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/sunset.jpg&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;Well, the sunset is beautiful because it&apos;s obvious to your eyes. Similarly programming is beautiful for those who enjoy it. Below is the poem which which eulogises lisp programming language&lt;sup&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; but it may be bland for those who have no experience with lisp.
    &lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Now, some folks on the Internet
    put their faith in C++.
    They swear that it&apos;s so powerful,
    it&apos;s what God used for us.
    And maybe it lets mortals dredge
    their objects from the C.
    But I think that explains
    why only God can make a tree.
    For God wrote in Lisp code
    When he filled the leaves with green.
    The fractal flowers and recursive roots:
    The most lovely hack I&apos;ve seen.
    And when I ponder snowflakes,
    never finding two the same,
    I know God likes a language
    with its own four-letter name.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p class=&quot;myheading&quot;&gt;&lt;b&gt;What makes anything beautiful?&lt;/b&gt;&lt;/p&gt;
    &lt;p&gt;Programming is beautiful because you could write code which could gives you desired output. This output may power a hydral plant, or drives your laptop or does little hacks which help people in their task. And this is true for any other thing in life. Srinivasa Ramanujan found mathematics beautiful and he believed his acumen was a gift of goddess  Namagiri Thayar. Unless you understand theory of relativity, you cannot appreciate the beauty of it.&lt;/p&gt;
    &lt;p&gt;In the 1830s, English scientist Michael Faraday discovered that changing magnetic fields produced electric fields. In 1861, Scottish physicist James Clerk Maxwell postulated that the opposite should be true: A changing electric field would produce a magnetic field. Maxwell developed equations that unified magnetic and electric field and gave us the understanding of electromagnetic force. &lt;b&gt;These equations are the equations of light&lt;/b&gt;. And in the beginning God created the heavens and earth. And God said,&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;/img/maxwell-eq.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;and then there was light&lt;sup&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p class=&quot;myheading&quot;&gt;&lt;b&gt;Programming is an Art&lt;/b&gt;&lt;/p&gt;
    &lt;p&gt; 
    &lt;img src=&quot;/img/programming-art.jpg&quot; /&gt;
    &lt;/p&gt;
    &lt;p&gt;I&apos;ve tried my hands on cooking albeit unsuccessfully. But I&apos;ve learned to cook a descent meal as to not scare off my guests. I usually search online for the recipe or occassionally call my mother for tips. Afterwards I collect all the required ingredients. Then I follow the each step to conclusively prepare a meal. Afterwards I record the method in my diary so as to recall it later or to aid anybody else with the same dish.&lt;/p&gt;
    &lt;p&gt;Programming is similar to cooking. Your recipe is your algorithms which you decide after you understand the problem. Each step is a sub problem which leads to the desired output. Since most of the code is read more than written&lt;sup&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; , thus documenting the code properly is very important. Comments also help while debugging the code.&lt;/p&gt;
    &lt;p&gt;Not everybody would enjoy programming. In the similar vein, not everybody has interest in gardening. But everything in life is beautiful. That&apos;s why people are passionate about it. Otherwise life one earth would have been very boring.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://www.gnu.org/fun/jokes/eternal-flame.html&quot; target=&quot;_blank&quot;&gt;Eternal Flame&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;https://www.biblegateway.com/passage/?search=Genesis+1&quot; target=&quot;_blank&quot;&gt;Genesis&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://blogs.msdn.com/b/oldnewthing/archive/2007/04/06/2036150.aspx&quot; target=&quot;_blank&quot;&gt;The Old New Thing&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2015-08-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/people-programming</link>
<guid isPermaLink="true">https://randomwits.com/blog/people-programming</guid>
</item>
<item>
  <title>Protect Your Privacy</title>
  <description>&lt;p&gt;&quot;If you&apos;ve got nothing to hide, you&apos;ve got nothing to fear&quot;. This is the most common retort used by governments to espouse Mass surveillance. They do it in the pretext of security. But even if you&apos;re not a fugitive, you have the right to protect your privacy.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;&quot;If you&apos;ve got nothing to hide, you&apos;ve got nothing to fear&quot;. This is the most common retort used by governments to espouse Mass surveillance&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. They do it in the pretext of security. But even if you&apos;re not a fugitive, you have the right to protect your privacy.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/privacy.jpg&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;why-should-you-care-&quot;&gt;Why should you care ?&lt;/h4&gt;
    &lt;p&gt;Privacy is not all about hiding bad things. Surveillance, for example, can inhibit such lawful activities as free speech, free association, and other First Amendment rights essential for democracy.&lt;/p&gt;
    &lt;p&gt;Edward Snowden leaked the largest infamous clandestine mass surveillance by the NSA and GCHQ called PRISM (surveillance program)&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. The prism program taps into the system of technolgoy giants like Apple, Google, Microsoft, Facebook, etc. Since many of the world&apos;s leading technology companies are based in the U.S. , anybody who uses Google or Skype can have their privacy violated through prism.&lt;/p&gt;
    &lt;h4 id=&quot;what-all-can-you-do&quot;&gt;What all can you do&lt;/h4&gt;
    &lt;h5 id=&quot;use-encrypted-google&quot;&gt;Use Encrypted Google&lt;/h5&gt;
    &lt;p&gt;When you click search items, your search history is sent to the site you searched on (in the HTTP referrer header). In addition, when you visit any site, your computer automatically sends information about it to that site (including your User agent and IP address). This information can often be used to identify you directly.&lt;/p&gt;
    &lt;p&gt;Try using &lt;a href=&quot;https://encrypted.google.com&quot; target=&quot;_blank&quot;&gt;Encrypted Google (HTTPS)&lt;/a&gt;. It doesn&apos;t usually send your search terms to sites&lt;/p&gt;
    &lt;h5 id=&quot;if-possible-try-another-search-engine&quot;&gt;If possible, try another search engine&lt;/h5&gt;
    &lt;p&gt;Sometimes even Encrypted Google may not be completely anonymous. Google is vulnerable to Subpoena. Since Google is a ubiquitous giant in searching, it&apos;s difficult to fathom any other alternative search engine.&lt;/p&gt;
    &lt;p&gt;However you can use Google results as well as keep your anonymity.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/start_page.png&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;https://startpage.com/&quot; target=&quot;_blank&quot;&gt;Startpage Web Search&lt;/a&gt; fetches results from the Google search engine. This is done without saving the users&apos; IP addresses or giving any personal user information to Google&apos;s servers.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/ddg.png&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;a href=&quot;https://duckduckgo.com/&quot; target=&quot;_blank&quot;&gt;Duckduckgo.com&lt;/a&gt; is a Metasearch engine that emphasizes protecting searchers&apos; privacy and avoiding the &lt;a href=&quot;http://en.wikipedia.org/wiki/Filter_bubble&quot; target=&quot;_blank&quot;&gt;filter bubble&lt;/a&gt; of personalized search results .&lt;/p&gt;
    &lt;p&gt;One cool feature I like about DuckDuckGo is !bang syntax that lets you do many interesting things. You can also search Google anonymously by prepending !g to your search term.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/ddg_search.png&quot; /&gt;&lt;/p&gt;
    &lt;h5 id=&quot;use-encryption&quot;&gt;Use Encryption&lt;/h5&gt;
    &lt;p&gt;Most movies depicts encryption as quixotic tool used by computer geeks trying to counter espionage. However it could be used by common people to protect their privacy from unscrupulous marketers and identity thieves.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/tor_bundle.jpg&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Tor Browser Bundle could be easily used to communicate anonymously on the Internet.&lt;/p&gt;
    &lt;p&gt;You could also use &lt;a href=&quot;http://en.wikipedia.org/wiki/Pretty_Good_Privacy&quot; target=&quot;_blank&quot;&gt;Pretty Good Privacy&lt;/a&gt;. It was created by Phil Zimmermann. He encouraged widespread use of cryptography. He believed that everybody deserved the right to privacy. It could be used for signing, encrypting, and decrypting texts, e-mails, files, directories, and whole disk partitions and to increase the security of e-mail communications.&lt;/p&gt;
    &lt;p&gt;Though using all these may not give you impregnable security or anonymity, but it certainly will make you less vulnerable to Mass surveillance.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Mass_surveillance&quot; target=&quot;_blank&quot;&gt;Mass Surveillance&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/PRISM_(surveillance_program)&quot; target=&quot;_blank&quot;&gt;PRISM&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2015-03-22T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/protect-privacy</link>
<guid isPermaLink="true">https://randomwits.com/blog/protect-privacy</guid>
</item>
<item>
  <title>Shooting the Messenger</title>
  <description>&lt;style type=&quot;text/css&quot;&gt;
    .myheading{font-family:Georgia, &quot;Times New Roman&quot;, Times, serif;font-size:24px;margin-top:5px;margin-bottom:0;text-align:center;font-weight:400;color:#222}
    .mysubheading{font-family:&quot;Lucida Grande&quot;, Tahoma;font-size:10px;font-weight:lighter;font-variant:normal;text-transform:uppercase;color:#666;margin-top:10px;text-align:center!important;letter-spacing:.3em}
    &lt;/style&gt;
    &lt;p&gt;&quot;India’s Daughter”, a documentary on Gang rape of 2012 has been officially banned. The Indian government went all gun to arrest the release of the documentary in India &amp;amp; abroad. BBC, Google, Youtube have all been sent legal notices to comply with the government’s diktat. Congratulations! We have shown the world that we will silence anything that will make us uncomfortable.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;
    &quot;India’s Daughter”, a documentary on Gang rape of 2012 has been officially banned. The Indian government went all gun to arrest the release of the documentary in India &amp;amp; abroad. BBC, Google, Youtube have all been sent legal notices to comply with the government’s diktat. Congratulations! We have shown the world that we will silence anything that will make us uncomfortable.
    &lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;/img/women.jpg&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;p&gt;Leslee Udwin, the maker of the documentary, has flown out of India citing her security. In an interview to BBC, she said, “But I’m not muzzled. Nor will I be muzzled” &lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. India’s Home Minister, Rajnath Singh, was furious &amp;amp; sought report from Tihar’s jail authorities on how the Nirbhaya&apos;s rape accused had given a controversial interview to BBC &lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. &quot;This is an international conspiracy to defame India. We will see how the film can be stopped abroad too&quot;, said parliamentary affairs minister M. Venkaiah Naidu &lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.
    &lt;/p&gt;
    &lt;p&gt;Kudos to the government for silencing the interviewer. We don’t want another ‘Slumdog millionaire’ to remind us of the filth in our society. We are a competing global power. We just launched a satellite to Mars for God’s sake. Such western propaganda will not work. How dare a western correspondent air something demeaning to our country? Shouldn’t she need to visit Taj Majal and experience incredible India?&lt;/p&gt;
    &lt;p&gt;Pity the nation who champions to be the largest democracy in the world. Pity the nation who needs to silence the dissenting voice. Pity the nation who could easily be ruffled by an uncomfortable truth. Pity the nation where discomforting voices feel threatened. I feel pity and sad.&lt;/p&gt;
    &lt;p&gt;There’s no rocket science to understand why we need to watch the documentary. The blatant lack of remorse and callousness from the rapist as well as defence lawyers reflect something is wrong with our society.&lt;/p&gt;
    &lt;h2 id=&quot;what-was-the-interview-about&quot;&gt;What was the interview about?&lt;/h2&gt;
    &lt;p&gt;&quot;When being raped, she shouldn’t fight back”. “She should just be silent and allow the rape. Then they’d have dropped her off after ‘doing her’ and only hit the boy”, said Mukesh Singh, one of the accused in Delhi Gang Rape. Instead of being apologetic, he had the temerity to question the character of girl when he adds, &quot;A decent girl won&apos;t roam around at 9 o&apos;clock at night.&quot;.&lt;/p&gt;
    &lt;p&gt;He is even undeterred by the stringent tough law against rape. He says, “The death penalty will make things even more dangerous for girls. Now when they rape, they won&apos;t leave the girl like we did. They will kill her. Before, they would rape and say, &apos;Leave her, she won&apos;t tell anyone.&apos; Now when they rape, especially the criminal types, they will just kill the girl. Death.&quot;.&lt;/p&gt;
    &lt;p&gt;Not far behind, joining the bandwagon, were the defence lawyer of the murderers. &quot;In our society, we never allow our girls to come out from the house after 6:30 or 7:30 or 8:30 in the evening with any unknown person,&quot; said one of the lawyers, ML Sharma.&lt;/p&gt;
    &lt;p&gt;&quot;You are talking about man and woman as friends. Sorry, that doesn&apos;t have any place in our society. We have the best culture. In our culture, there is no place for a woman.&quot;&lt;/p&gt;
    &lt;h2 id=&quot;best-culture&quot;&gt;Best Culture?&lt;/h2&gt;
    &lt;p&gt;A woman in northern India has been stripped naked and paraded on a donkey on the orders of village elders after being accused of killing her nephew.&lt;sup id=&quot;fnref:4&quot;&gt;&lt;a href=&quot;#fn:4&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;p&gt;In October, a woman in the eastern state of Jharkhand was stripped and paraded naked before several family members by her in-laws who wanted a big dowry from her.&lt;sup id=&quot;fnref:5&quot;&gt;&lt;a href=&quot;#fn:5&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;p&gt; In July, a 60-year-old woman was beaten, stripped and tied to an electricity pole in a village in the eastern state of Orissa after local people accused her of being a witch.&lt;sup id=&quot;fnref:6&quot;&gt;&lt;a href=&quot;#fn:6&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;p&gt;In January 2012, some upper-caste men in Maharashtra state beat, stripped and paraded naked a low-caste Dalit woman because her son had eloped with an upper-caste girl.&lt;sup id=&quot;fnref:7&quot;&gt;&lt;a href=&quot;#fn:7&quot; rel=&quot;footnote&quot;&gt;7&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h2 id=&quot;mera-bharat-mahan&quot;&gt;Mera Bharat Mahan?&lt;/h2&gt;
    &lt;p&gt;Best culture? Culture who still believes the women should be confined within the four walls. Culture who has more abhorrence for Valentine day than female feticide. Culture who burdens the bride’s father under the garb of extravagant wedding &amp;amp; dowry. Culture where Marital Rape is still acceptable. Culture where women are still wary to travel alone outside. Women are branded witched and paraded naked in villages. Yes sir, we do have a best culture.&lt;/p&gt;
    &lt;h2 id=&quot;and-we-have-more-in-the-herd&quot;&gt;And we have more in the herd&lt;/h2&gt;
    &lt;p&gt;The other lawyer, AP Singh, had said in a previous televised interview: &quot;If my daughter or sister engaged in pre-marital activities and disgraced herself and allowed herself to lose face and character by doing such things, I would most certainly take this sort of sister or daughter to my farmhouse, and in front of my entire family, I would put petrol on her and set her alight.&quot;&lt;/p&gt;
    &lt;p&gt;Such Talibani comments reflects the sad state of affairs of our country. And these men are not exceptions. Even our politicians are party to such comments.&lt;/p&gt;
    &lt;p&gt;In June 2013 in Bhopal, former Rajya Sabha MP and currently vice-president of BJP, Raghunandan Sharma, had said, &quot;Girls should stop wearing skin-tight jeans because they show the body in its natural shape, and that’s not good. Nari ki ek maryada hoti hai.&quot;&lt;/p&gt;
    &lt;p&gt;Manohar Lal Khattar, now the Chief Minister of Haryana, also prescribed a dress code for women. “If a girl is dressed decently, a boy will not look at her in the wrong way. If they want freedom, why don’t they just roam around naked? Freedom has to be limited,” Khattar had said in the run-up to last year’s Lok Sabha polls.&lt;sup id=&quot;fnref:8&quot;&gt;&lt;a href=&quot;#fn:8&quot; rel=&quot;footnote&quot;&gt;8&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;h2 id=&quot;whose-responsible&quot;&gt;Whose responsible?&lt;/h2&gt;
    &lt;p&gt;India is probably the most hypocritical society. At one instance we worship girls as goddess. Paint her in hues and colors and associate her with prosperity. On the other hand we burden the bride’s father with dowry. Callously judge her character every time. As a boy, nobody questions my character when at times I come late at night. Why such double standard? Why can&apos;t I be a slut?&lt;/p&gt;
    &lt;p&gt;The notion that women needs to be protected fuels the male chauvinist mentality. Women are often portrayed as delicate flower always in need of a guardian. Such idea lead to belief that women are tender,feeble &amp;amp; dependent. Our film industry is also responsible for promulgating such beliefs.&lt;/p&gt;
    &lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
    &lt;p&gt;Instead of being furious and decry western conspiracies, we need to take a deep breath. Yes, there are more rapes in United States &amp;amp; United Kingdom&lt;sup id=&quot;fnref:9&quot;&gt;&lt;a href=&quot;#fn:9&quot; rel=&quot;footnote&quot;&gt;9&lt;/a&gt;&lt;/sup&gt;, yet the public places in these countries are far safer than India. Ask any women in India what she goes through whenever she travels in public transport. 
    &lt;/p&gt;
    &lt;p&gt;Girls don&apos;t need protection. They can take care of themselves. What they need is co-operation. Yes our society needs to be shamed. We don’t want the best culture, only a culture where our &quot;second gender&quot; feel safe.&lt;/p&gt;
    &lt;p&gt;Such prevalent mentality is the reason why we need to see more of such documentaries. Please don&apos;t shoot the messenger.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://www.washingtonpost.com/news/morning-mix/wp/2015/03/06/inside-indias-failure-to-silence-a-film-exposing-the-new-delhi-bus-gang-rape/&quot; target=&quot;_blank&quot;&gt;India fails to silence a BBC film exposing the New Delhi bus gang rape&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://indiatoday.intoday.in/story/nirbhaya-gangrape-rajnath-seeks-reply-from-tihar-jail-on-bbc-interview/1/422011.html&quot; target=&quot;_blank&quot;&gt;Nirbhaya gangrape: Furious Rajnath Singh seeks reply from Tihar jail on BBC interview&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://www.outlookindia.com/news/article/BBC-Documentary-Is-a-Conspiracy-to-Defame-India-Naidu/884338&quot; target=&quot;_blank&quot;&gt;BBC Documentary Is a Conspiracy to Defame India: Naidu
    &lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://www.bbc.com/news/world-asia-india-29983752&quot; target=&quot;_blank&quot;&gt;Indian woman paraded naked on donkey&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:4&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://www.hindustantimes.com/ranchi/woman-paraded-naked-filmed-for-not-bringing-dowry/article1-1278192.aspx&quot; target=&quot;_blank&quot;&gt;Woman paraded naked for not bringing dowry&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:5&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://one.trust.org/item/20140728103034-308xw/?source=leadCarousel&quot; target=&quot;_blank&quot;&gt;Indian woman branded witch, stripped and paraded naked&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:6&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:7&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://www.bbc.com/news/world-asia-india-16523849&quot; target=&quot;_blank&quot;&gt;India Dalit woman beaten, paraded naked in Maharashtra&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:7&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:8&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://indianexpress.com/article/cities/delhi/on-rape-outraged-politicians-have-been-outrageous-in-past/&quot; target=&quot;_blank&quot;&gt;On rape, ‘outraged’ politicians have been outrageous in past
    &lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:8&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:9&quot;&gt;
    &lt;p&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Rape_statistics&quot; target=&quot;_blank&quot;&gt;Rape Statistics&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:8&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2015-03-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/shooting-messenger</link>
<guid isPermaLink="true">https://randomwits.com/blog/shooting-messenger</guid>
</item>
<item>
  <title>Digging on the codes of the Past</title>
  <description>&lt;p&gt;Different religion tells us about plethora of beautiful tales about the genesis of humans. We humans, like any other trivial species, descended not from heaven (sigh!) but due to mitosis in single cell organisms.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Different religion tells us about plethora of beautiful tales about the genesis of humans. We humans, like any other trivial species, descended not from heaven (sigh!) but due to mitosis in single cell organisms. And gradually we embraced bipedalism and various arts of survival. Languages replaced tedious gestures as a means of communication. We hunted animals and domesticated them. Such a long odysseys of humans is replete with footprints of the past. In these footprints we try to decipher bits and pieces of lives of our ancestors.&lt;/p&gt;
    &lt;p&gt;While the universe is pretty old (3.7987 billion years and counting), it has been only few million years since the chapter of humans commenced. We had come a long way since. From time in memorial, numerous civilizations thrived and collapsed leaving behind their legacy. The episodes of both glory and horror are conspicuous part of history. Distant from the hurly burly of the present civilization, on the mounds of Mahanjo-Daro and Harrapa, an entirely different civilization spoke another language.&lt;/p&gt;
    &lt;h2 id=&quot;indus-valley-civilization&quot;&gt;Indus Valley Civilization&lt;/h2&gt;
    &lt;p&gt;Indus Valley Civilization is considered as a cradle of early civilization along with Mesopotamia and Pharonic Egypt. It was noted for urban planning, baked brick houses, elaborate drainage systems, water supply systems, and clusters of large non-residential buildings &lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;
    &lt;img style=&quot;float: left; margin: 0px 15px 15px 0px;&quot; src=&quot;/img/seal.jpg&quot; /&gt;
    The excavations have recovered some of the seals used at that time. The seal is in Indus script. There two camps divided on how to interpret this script. First camp believe this is nothing more than &lt;b&gt;semagrams&lt;/b&gt;. In this each letter represents  whole idea. Like the drawing of fish would represent fish. The other camp argues that this hieroglyphs represent &lt;b&gt;phonograms&lt;/b&gt; based on rebus system . In this each letters represents a phoneme (speech sound). Unfortunately Indus script is yet to be deciphered.
    &lt;/p&gt;
    &lt;h2 id=&quot;mlecchita-vikalpa&quot;&gt;Mlecchita Vikalpa&lt;/h2&gt;
    &lt;p&gt;The Indus valley civilization thrived much to the presence of Indus river. The river basin not only provided cultivable land but also sea routes to other ancient civilizations like Sumerian, Mesopotamia, etc.&lt;/p&gt;
    &lt;p&gt;Mleccha were the smiths that use to inscribe text of the mleccha language on the copper. Later mlecchita vikalpa, which means writing in cipher, was developed. It is the earliest use of cryptography. It was first mentioned in ancient Indian manuscript, Kama sutra, written around 4th century AD.&lt;/p&gt;
    &lt;p&gt;Mlecchita Vikalpa is one of the 64 arts recommended by Kama sutra to help women conceal details of their liaisons. It is a monoalphabetic substitution cipher. It means that it uses only one cipher alphabet to encrypt message. The cipher alphabet is randomly generated and each letter of the message is substituted to produce the cipher. Decipherment is simply re-substituting letters of the ciphers with the cipher alphabet.&lt;/p&gt;
    &lt;h2 id=&quot;recreating-the-ancient-cipher&quot;&gt;Recreating the ancient cipher&lt;/h2&gt;
    &lt;p&gt;To encipher a secret message, a random cipher alphabet needs to be generated. Below is a random key.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;UDJLKNCRZEBTMHPFQVWOXAGSIY
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now bifurcate the key&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;UDJLKNCRZEBTM
    HPFQVWOXAGSIY
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Let us suppose the message is &apos;password&apos;. So the first letter of the message i.e. &apos;p&apos; is searched in the cipher alphabet. &apos;p&apos; is found opposite to &apos;D&apos; which is then substituted&lt;/p&gt;
    &lt;p&gt;Similarly all the message is encrypted as &apos;DZBBNCXP&apos;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Note: As convention, message is written in small letters
    where as resultant cipher is written in capital letters.
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;h2 id=&quot;javascript-implementation&quot;&gt;Javascript Implementation&lt;/h2&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/faff62bd0c2eb93b18c74b935b523dcd.js&quot;&gt;&lt;/script&gt;
    &lt;h2 id=&quot;fisher-yates-shuffle&quot;&gt;Fisher Yates shuffle&lt;/h2&gt;
    &lt;p&gt;Each time a new message needs to be sent, a random key is also needed. In order to generate alphabet of random lettters, Fisher Yates algorithms is used. A random permutation of a finite sets is produced. Shuffling is similar to randomly picking numbered tickets out of a hat without replacement until there are none left &lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;p&gt;Below is the implementation in Javascript.&lt;/p&gt;
    &lt;script src=&quot;https://gist.github.com/tushar-sharma/c5fb05f1f0ce5f34df612a2d53c12da8.js&quot;&gt;&lt;/script&gt;
    &lt;h2 id=&quot;demo&quot;&gt;Demo&lt;/h2&gt;
    &lt;form name=&quot;form1&quot; id=&quot;form1&quot; onsubmit=&quot;return false;&quot;&gt;
    &lt;label for=&quot;alphabet&quot;&gt;Key&lt;/label&gt;&lt;br /&gt;
    &lt;input type=&quot;text&quot; name=&quot;alphabet&quot; id=&quot;alphabet&quot; value=&quot;UDJLKNCRZEBTMHPFQVWOXAGSIY&quot; maxlength=&quot;26&quot; size=&quot;40&quot; /&gt; &lt;input type=&quot;submit&quot; value=&quot;Change&quot; onclick=&quot;document.form1.alphabet.value=submitForm(this)&quot; /&gt;&lt;br /&gt;
    &lt;label for=&quot;text&quot;&gt;Plain Text&lt;/label&gt; &lt;br /&gt;
    &lt;textarea name=&quot;cipher1&quot; id=&quot;cipher1&quot; rows=&quot;6&quot; cols=&quot;40&quot;&gt; &lt;/textarea&gt; &lt;br /&gt;
    &lt;label for=&quot;result&quot;&gt;Result&lt;/label&gt; &lt;br /&gt;
    &lt;textarea name=&quot;result1&quot; id=&quot;result1&quot; rows=&quot;6&quot; cols=&quot;40&quot;&gt; &lt;/textarea&gt;&lt;br /&gt;
    &lt;input type=&quot;button&quot; value=&quot;Encrypt/Decrypt&quot; onclick=&quot;return submitForm(this)&quot; /&gt;
    &lt;input type=&quot;submit&quot; value=&quot;Clear Form&quot; onclick=&quot;return submitForm(this)&quot; /&gt;
    &lt;/form&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;cryptanalysis&quot;&gt;Cryptanalysis&lt;/h2&gt;
    &lt;p&gt;This is the demonstration of a simple  monoalphabetic cipher. It is not secure and could be easily broken by frequency analysis &lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Indus_Valley_Civilization&quot; targe=&quot;_blank&quot;&gt;Indus Valley Civilization&lt;/a&gt; &lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Fisher–Yates_shuffle&quot; target=&quot;_blank&quot;&gt;Fisher–Yates shuffle&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:2&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_analysis&quot; target=&quot;_blank&quot;&gt;Frequency Analysis&lt;/a&gt;&lt;/p&gt;
    &lt;a href=&quot;#fnref:3&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.lib.utexas.edu/maps/middle_east_and_asia/pakistan_rel96.jpg&quot; target=&quot;_blank&quot;&gt;Image courtesy&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;/js/crypto.js&quot;&gt;&lt;/script&gt;
  </description>
  <pubDate>2014-05-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/digging-secret-codes-past</link>
<guid isPermaLink="true">https://randomwits.com/blog/digging-secret-codes-past</guid>
</item>
<item>
  <title>Romance with Moon</title>
  <description>&lt;p&gt;Often we meet,&lt;br /&gt;
    Avoiding prying eyes secretly,&lt;br /&gt;
    In between stretches a velvet sky,&lt;br /&gt;
    Only gulf in between us apparently.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2014-03-30-romance-moon.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;
    &lt;!--begin_of_post --&gt;&lt;/p&gt;
    &lt;p&gt;
    &lt;img src=&quot;/img/moon.jpg&quot; alt=&quot;Blue Moon Picture&quot; /&gt; 
    &lt;/p&gt;
    &lt;p&gt;Often we meet,&lt;br /&gt;
    Avoiding prying eyes secretly,&lt;br /&gt;
    In between stretches a velvet sky,&lt;br /&gt;
    Only a gulf in between us apparently.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;High tides doth comes,&lt;br /&gt;
    As she tries approaching me,&lt;br /&gt;
    And sweeps the earth below,&lt;br /&gt;
    Posing as the one, only she could be.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Out of the window I gaze,&lt;br /&gt;
    Shooting stars falls before her grace,&lt;br /&gt;
    While the rest clings to the sky,&lt;br /&gt;
    In a hope that to her they could embrace. &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Of many suitors I am one,&lt;br /&gt;
    Not noteworthy yet I whisper in hope,&lt;br /&gt;
    That by chance she could pay heed,&lt;br /&gt;
    To my melancholy heart that mope. &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;At times I hear her throbbing heart,&lt;br /&gt;
    With waxing and waning of her sight,&lt;br /&gt;
    Into the puddle of fluffy clouds,&lt;br /&gt;
    She plays flute of her moonlight.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;I have seen her new,&lt;br /&gt;
    And also at times when she grows crescent, &lt;br /&gt;
    Often craters mars her luminescent face,&lt;br /&gt;
    Yet her smile always remains pleasant. &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;I have seen the winds steal her pride, &lt;br /&gt;
    Of melody whilst she floats,&lt;br /&gt;
    Around the lonely orbit of life,&lt;br /&gt;
    Like me while the life gloats.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;How similar are we?&lt;br /&gt;
    And miles away she glow,&lt;br /&gt;
    How dissimilar are we?&lt;br /&gt;
    If only we could meet to know.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;What awaits us now,&lt;br /&gt;
    Is only a mystery of time,&lt;br /&gt;
    Will the Fate make us one?&lt;br /&gt;
    Or our love will be a mournful chime? &lt;br /&gt;&lt;/p&gt;
    &lt;!--end_of_post --&gt;
  </description>
  <pubDate>2014-03-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/romance-moon</link>
<guid isPermaLink="true">https://randomwits.com/blog/romance-moon</guid>
</item>
<item>
  <title>Idea of God</title>
  <description>&lt;p&gt;I was lying around on a secluded meadow. Under the open sky I gazed at the clouds scudding by. Suddenly it seemed that I was drifting away. A scathing sound began to wreak the whole place. And the mischievous alarm pulled me out of my dreams.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div id=&quot;player&quot;&gt;
    &lt;div class=&quot;listen&quot;&gt;Listen to this article&lt;/div&gt;
    &lt;div id=&quot;waveform&quot;&gt;
    &lt;img src=&quot;/img/waveform.min.png&quot; /&gt;
    &lt;/div&gt;
    &lt;audio controls=&quot;&quot; class=&quot;audio_controls &quot; preload=&quot;metadata&quot;&gt;
    &lt;source src=&quot;/sounds/2014-02-08-idea-of-god.mp3&quot; type=&quot;audio/mp3&quot; /&gt;
    Your browser does not support the audio element.
    &lt;/audio&gt;  
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;
    &lt;!--begin_of_post --&gt;&lt;/p&gt;
    &lt;p&gt;I was lying around on a secluded meadow. Under the open sky I gazed at the clouds scudding by. Suddenly it seemed that I was drifting away. A scathing sound began to wreak the whole place. And the mischievous alarm pulled me out of my dreams.&lt;/p&gt;
    &lt;p&gt;After few seconds, the world came back to me. I glanced out of the window to catch any trace of light. The day had dawned with the sun steadily climbing up the sky. Few stars probably were lost and still wandered around. I flung open the door of my room and stood before the balcony.&lt;/p&gt;
    &lt;p&gt;Opposite to my building was a roof of another building. Out of nowhere leapt a nomadic cat onto the roof. She wandered around occasionally licking her paws. She caught the sight of me and stood still. Seeing her motionless aroused my curiosity.  As I receded my eyes I saw a sheet of cloth hung on another roof. A moment passed and a gust of wind left the cat still and the cloth fluttered. And another moment later, came a lady who took the cloth away. And the cat also escaped into oblivion.&lt;/p&gt;
    &lt;p&gt;It dawned to me that the roof resembled a portrait. A portrait with different strokes of colors. A moment ago it had a tinge of a cat and the cloth. But soon the brush of life wiped them off. I wondered if Life per se was one giant portrait with each one of us resembling different strokes of colors only to be eventually swept away by the current of time.&lt;/p&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;blockquote&gt;
    &quot;No man ever steps in the same river twice&quot; - Heraclitus.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;
    &lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;paradox-of-choice&quot;&gt;Paradox of Choice&lt;/h2&gt;
    &lt;p&gt;After regaining consciousness and relinquishing my bed, I decided to stroll out in the morn. I quickly slipped into my pyjamas and shoes. The sky had the company of a dwindling moon who looked upset at the ascending sun. Occasionally birds chirped and bade the moon goodbye. The winds descended and raced with me to keep me company.&lt;/p&gt;
    &lt;p&gt;Pavements on Indian roads are designed with nefarious motive. A person walking on them needs to master the art of maneuvering. Sometimes you may encounter among other things cows, stray dogs, two-wheelers and sometimes wandering people. After meandering through myriad streets, I came across a divergence on a street. I stood still and soon sweat started pouring down my face along with some thoughts. I was stuck with a choice however trivial. And I wondered what are my odds that I make a right choice?&lt;/p&gt;
    &lt;p&gt;There is two ways of looking at the universe. One way is to through the lens of determinism. It means that we believe that the universe obeys laws of physics. From the gigantic sun revolving around its axis to the motor car driving in the highway, all of them obey cause and effect. This means you are also sure that memories of your childhood are real.&lt;/p&gt;
    &lt;p&gt;Another way of looking at the universe is through non-determinism. If you penetrate down to the world of atoms, you see the space time fabric becomes completely random. The certainty is sacrificed for randomness. The bizarre world of quantum physics demands to relinquish the idea of causality. This means that a particle can be at two different position at the same time (superposition).&lt;/p&gt;
    &lt;p&gt;This two different models of universe poses a moral dilemma. Are the events of our life completely random? This would give me &apos;free will&apos; but rob me of any intervention from higher power. Or the events in life follow some grand design? This would give me a sense of protectionism but will render my &apos;free will&apos; a mere illusion? Or it could be a middle world where there is &apos;free will&apos; but also allow gods in the stars to intervene.&lt;/p&gt;
    &lt;p&gt;Einstein became disillusioned with the non-deterministic model of the universe. During the dusk of his life, he ceaselessly endeavoured in finding an alternate model. These were his famous words:&lt;/p&gt;
    &lt;blockquote&gt;
    God doesn&apos;t play dice with the world.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;curious-case-of-religion&quot;&gt;Curious case of religion&lt;/h2&gt;
    &lt;p&gt;The course of human evolution was completely turned with the occurrence of two historic events. One was the discovery of fire and the other invention of wheel. The fire gave men the much needed protection. And the wheel allowed him to travel larger distance in finding niche required for survival. Yet the sudden roar of thunder easily ushered the greatest fear. When there was the fear of the unknown, religion came to the rescue. The fundamental question of where we came from, also known as creation myth, is found in all major religions. The absence of rainfall could be easily attributed to the angry gods craving sacrifice. Hence dogmas and ritual gave religious institution authority to control the masses. Also religion made men feel privileged than the rest of the animals.&lt;/p&gt;
    &lt;blockquote&gt;
    God created man in his own image, in the image of God he created him - Genesis.
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;My purpose is not to authenticate or refute any religious belief. I believe religion is a private affair. Philosophers like Spinoza have long argued for the separation of Church and the State, though some countries are still plagued by religious fundamentalism.&lt;/p&gt;
    &lt;p&gt;Most of the religion rely on miracles for indoctrinating people. Indoctrination robs people of questioning authority. Countless innocent people have been prosecuted in the name of religion like Bruno and Galileo.&lt;/p&gt;
    &lt;p&gt;But what is miracle? Is talking to someone over long distance over phone miracle? It&apos;s not since in this century most of us are taught how technology works. But if I could time travel to medieval past and reveal to them an ordinary phone, they might hold me in high reverence. After all, one century&apos;s magic, another century&apos;s science &lt;sup id=&quot;fnref:man&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:man&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;h2 id=&quot;chicken-or-the-egg&quot;&gt;Chicken or the Egg&lt;/h2&gt;
    &lt;p&gt;In the &apos;Allegory of Cave&apos;, Pluto describes gathering of people who have lived all their lives inside cave facing a blank wall. When they see projections of shadows on the wall of things in front of the fire, they give name to them. Then one day a cave men escapes. He is freed and begin to understand the shadows. Man have long tried contemplating his surrounding.&lt;/p&gt;
    &lt;p&gt;Imagine if you were a fish born and raise in aquarium. You would have no idea of the world outside the aquarium. Your awareness would have been restricted within the peripheral of the aquarium. If I were to ask you then, “where did the aquarium came from”, you would have been bewildered.&lt;/p&gt;
    &lt;p&gt;Our situation is quite akin to that of fish. We live in a bigger aquarium of three spacial and a time dimension universe. If I were to ask you, &quot;where did the universe came from&quot;, you could only surmise.&lt;/p&gt;
    &lt;p&gt;Chicken or the egg is the causality dilemma. Both can&apos;t come independent of each other. Similarly it&apos;s difficult to fathom beginning of universe since at the end something must come out of nothing.&lt;/p&gt;
    &lt;p&gt;Most scientist believe that the answer to the chicken and egg paradox lies in quantum fluctuation which states that conservation of energy could be violated if the time is small. Hence something can come out of nothing.&lt;/p&gt;
    &lt;h2 id=&quot;is-god-the-architect&quot;&gt;Is God the Architect?&lt;/h2&gt;
    &lt;p&gt;In earlier times people believed that earth was flat. As per Mesopotamian mythology, earth was considered to be a flat disk floating in the ocean and surrounded by a spherical sky. Aristotle gave the idea that the earth was spherical as the shadow of Earth on the Moon during a lunar eclipse is round.&lt;/p&gt;
    &lt;p&gt;But it was Eratosthenes who calculated the circumference of the earth.  He travelled to Syene  where the sun was directly overhead at the summer solstice. He saw that the sun rays doesn&apos;t cast shadow on a metal bar. But when he travelled to Alexandria, which was north to Syene, the sun rays cast a shadow on the same bar. This could only happen if the earth was not flat.&lt;/p&gt;
    &lt;p&gt;The myth that earth was the center of the universe was based on the system devised by Ptolemy and favoured by Church of Rome. But Copernicus came up with a heliocentric model and stated that sun and not earth was the center of the solar system.&lt;/p&gt;
    &lt;p&gt;Gravity was described in 11th century by Indian mathematician Bhaskaracharya. Later building on the foundation of Kepler and Galileo, Newton formulated laws of gravity. This gave us the insight into the physical model of the universe.&lt;/p&gt;
    &lt;p&gt;When Napoleon was asked to explain why his works on celestial mechanics made no mention of god, he replied&lt;/p&gt;
    &lt;blockquote&gt;
    Your Highness, I have no need of this hypothesis. 
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;h2 id=&quot;we-live-in-curved-space&quot;&gt;We live in curved space?&lt;/h2&gt;
    &lt;p&gt;The physics of sixteen and seventeen century was having honeymoon period. The Euclidean view of the world still remained. That means the sum of the angles of a triangle would always be 180&lt;sup&gt;0&lt;/sup&gt;. But this idea of the geometry of space was about to be shattered by a German scientist working as a patent clerk.&lt;/p&gt;
    &lt;p&gt;Einstein came up with a revolutionary idea of the universe in his theory of General Relativity. The sum of the angles of a triangle no longer adds up to 180&lt;sup&gt;0&lt;/sup&gt;. The universe was reduced to a inextricable fabric of space and time. Imagine the universe as a trampoline. The object with mass bends and curve the fabric of space time. The distortion in the fabric causes the ripples of gravity. Einstein calculated the speed of these ripples equal to that of speed of light. In fact Einstein set the speed of light as a cosmic limit. Nothing can go faster than light (though certain particles like Tachyon have been observe to supercede the speed of light under laboratory conditions).&lt;/p&gt;
    &lt;p&gt; 
    &lt;center&gt;
    &lt;img src=&quot;/img/curve.jpg&quot; alt=&quot;Curved space time picture&quot; /&gt;
    &lt;/center&gt;
    &lt;/p&gt;
    &lt;h2 id=&quot;our-universe-is-expanding&quot;&gt;Our universe is expanding&lt;/h2&gt;
    &lt;p&gt;Doppler proposed that the frequency is higher if the source is moving towards the observer. Similarly the frequency is lower if the source is moving away from the observer. He observed this phenomena in the sound waves. Hubble extended this idea by applying Doppler effect in light waves. He observed that the light from the distant galaxies were shifted towards the red end spectrum. If a star is moving away from us, the whole pattern of spectrum is shifted toward red end of spectrum. Hence he came to the conclusion that universe is expanding.&lt;/p&gt;
    &lt;p&gt;But scientist argued how long the universe will expand. The density of the universe was believed to eventually halt its expansion. But in 1998 observations of type Ia supernovae suggested that universe is not only expanding but accelerating.&lt;/p&gt;
    &lt;p&gt;How could the universe&apos;s expansion accelerate is still an enigma in the scientific community. It&apos;s believed that the known universe accounts for only 4% approximately. Rest of mass have been attributed to dark matter which is a hypothesized matter that accounts for the mass missing in the universe and dark energy which is believed to be accelerating energy.&lt;/p&gt;
    &lt;p&gt;The universe is an open book riddled with mysteries. Men have so far only able to scratch its surface. If we could unravel these mysteries then one day we may be able to read the mind of the creator.&lt;/p&gt;
    &lt;h2 id=&quot;anthropic-principle&quot;&gt;Anthropic Principle&lt;/h2&gt;
    &lt;p&gt;If I ask why does it rain, most of us would feel insulted on being ask such a trivial question. A kid in the five standard could very well explain in the following words, “It rains because the water from different parts of earth evaporate into water vapours. The vapours rise up as they are lighter than air which in turn condense into water which fall as rain”.&lt;/p&gt;
    &lt;p&gt;But if I flip the question and instead ask does it rain so that all the living being on earth could live, most of us would find it difficult to reach conclusion. This is called anthropic principle. Does the physical laws of the universe is compatible with conscious life that observes it? Why does the distance between earth and sun is optimum to sustain life? Why the optimum size of moon helps earth not to wobble? Had the precise values of fundamental physical constants not what they are, the whole universe would simple collapse in itself.&lt;/p&gt;
    &lt;h2 id=&quot;ultimate-truth&quot;&gt;Ultimate truth&lt;/h2&gt;
    &lt;p&gt;Scientist have fantasied of the theory of everything. This is major unsolved problem of physics. When we try to combine the rules of deterministic world with that of non-deterministic, the equation breaks down. The rule of gravity that is obeyed by the gigantic planets has no relevance in the atomic world.&lt;/p&gt;
    &lt;p&gt;I once encountered two pretty girls who I presumed were Christian missionary. They asked me if they believed in Jesus. I replied in affirmative and said, &apos;I believe in Jesus, Krishna or any other Higher Being there is&apos;. &apos;But there can be only path to ultimate truth&apos;, they revolted. This made me recall a reply by Swami Vivekanada on which religion is true.&lt;/p&gt;
    &lt;blockquote&gt;
    As so many rivers, having their source in different mountains, roll down, crooked or straight, and at last come into the ocean --- so, all these various creeds and religions, taking their start from different standpoints and running through crooked or straight courses, at last come unto Thee. 
    &lt;/blockquote&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;After a while I returned from my jogging. The streets had now grown in people and traffic. Cows are considered sacred in India and can roam anywhere. As I was crossing a street, I saw a cow mooing. Afterward the cow disposed her dung on the street. I quietly chuckled, &apos;Where is God? In the dung, cosmos or me. May be idea of the god needs another revision&apos;.&lt;/p&gt;
    &lt;!--end_of_post --&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:man&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;The Man from Earth (2007) &lt;a href=&quot;#fnref:man&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2014-02-08T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/idea-of-god</link>
<guid isPermaLink="true">https://randomwits.com/blog/idea-of-god</guid>
</item>
<item>
  <title>Happiness</title>
  <description>&lt;p&gt;I walked miles on my feet and hope,  &lt;br /&gt;
    against all weather, people and slope, &lt;br /&gt;
    But after some distance I could not keep, &lt;br /&gt;
    enough pace as the way was steep.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;I walked miles on my feet and hope, &lt;br /&gt;
    against all weather, people and slope, &lt;br /&gt;
    But after some distance I could not keep, &lt;br /&gt;
    enough pace as the way was steep. &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;I was already late not by months but years, &lt;br /&gt;
    still I dragged my feet amidst all fears, &lt;br /&gt;
    at night when the moon swept the tides away, &lt;br /&gt;
    I dreamt of my past till sleep made me her prey. &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Where was I up to ? What did I yearn? &lt;br /&gt;
    for there are left enough experiences to earn, &lt;br /&gt;
    I was no genius, king or noble soul, &lt;br /&gt;
    But that never deter me to walk towards my goal. &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Often in way people inquired about my way, &lt;br /&gt;
    &quot;There are better players than me&quot;, all would say, &lt;br /&gt;
    I must but forget since the goal is too high, &lt;br /&gt;
    and I lacked the skills to fly to the sky. &lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;It&apos;s still early to lay to test, &lt;br /&gt;
    my faith before I finally rest, &lt;br /&gt;
    Only God knows if I could ever harvest, &lt;br /&gt;
    the crop of happiness without remorse or pest &lt;br /&gt;&lt;/p&gt;
  </description>
  <pubDate>2013-12-24T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/happiness</link>
<guid isPermaLink="true">https://randomwits.com/blog/happiness</guid>
</item>
<item>
  <title>Why I never close Emacs</title>
  <description>&lt;p&gt;I once complained to my friend of his desktop on his computer. His desktop was a tangled mess of icons. &quot;It&apos;s easier this way.&quot;, he chuckled, &quot;I can quickly find all the softwares I need.&quot;. I showed him my desktop which was spick and span.&quot;Doesn&apos;t it consumes time in finding the softwares you need?&quot;, he asked.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;div&gt;
    &lt;p&gt;
    I once complained to my friend of his desktop on his computer. His desktop was a tangled mess of icons. &quot;It&apos;s easier this way.&quot;, he chuckled, &quot;I can quickly find all the softwares I need.&quot;. I showed him my desktop which was spick and span.&quot;Doesn&apos;t it consumes time in finding the softwares you need?&quot;, he asked. I told him I have all the softwares I need on my desktop. His eyes rolled down my screen until they stumbled upon a solo icon of emacs. &quot;You just use one software?&quot;, he asked.&quot;Mostly, yes&quot;, I said. &quot;What about *editing*, *browsing*, *music*, etc?&quot;, he asked. &quot;I do it all in emacs.&quot;, I quipped. Before he raised his eyebrows, I explained to him why emacs is informally called as a complete operating system and why I never close emacs.
    &lt;/p&gt;
    &lt;/div&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/books.css&quot; /&gt;
    &lt;!-- disclaimer --&gt;
    &lt;div style=&quot;margin: 0 auto&quot; class=&quot;cl disclaimer&quot;&gt;
    &lt;i class=&quot;icon-star&quot;&gt;&lt;/i&gt;
    &lt;span style=&quot;color:black&quot;&gt; &amp;nbsp;&amp;nbsp;This article has been published in &lt;a href=&quot;http://www.linuxforu.com&quot; target=&quot;_blank&quot;&gt;LinuxforYou&lt;/a&gt; magazine,January 2014 issue
    &lt;/span&gt; 
    &lt;/div&gt;
    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; For those who are unfamiliar with emacs, Key abbreviations used :&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;M – x means holding meta key (usually Esc) and x&lt;/li&gt;
    &lt;li&gt;C – Control&lt;/li&gt;
    &lt;li&gt;S – Shift&lt;/li&gt;
    &lt;li&gt;C-x f – means holding both Control and x, release both, and press f&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;&lt;img src=&quot;/img/emacs.png&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;emacs-for-editing&quot;&gt;Emacs for Editing&lt;/h4&gt;
    &lt;p&gt;Emacs is modeless editor which mean that unlike vim, you can start inserting text as soon as you open it. This is one of the reason why it&apos;s popular with newbies. But that doesn&apos;t mean you can&apos;t get your hands dirty with emacs.&lt;/p&gt;
    &lt;p&gt;Most people criticize emacs user for trying to do everything with emacs except editing. So let&apos;s begin with editing for which emacs was initially built.&lt;/p&gt;
    &lt;p&gt;Emacs can handle pretty much any type of file. Just type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ emacs myFile.ext
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Emacs also does syntax highlighting and indentation. It usually follows GNU style of indentation. The best thing about emacs is that you can customize it the way you want. I usually like &lt;a href=&quot;http://en.wikipedia.org/wiki/Indent_style#Allman_style&quot;&gt;Allman&lt;/a&gt; indentation when editing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C&lt;/code&gt; code with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4 spaces&lt;/code&gt;. To change it, add this to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.emacs&lt;/code&gt; file.&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-common-lisp&quot; data-lang=&quot;common-lisp&quot;&gt;    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c-default-style&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;linux&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;c-basic-offset&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
    &lt;h4 id=&quot;emacs-for-backup&quot;&gt;Emacs for Backup&lt;/h4&gt;
    &lt;p&gt;Emacs by default creates a backup file for every file it edits. It&apos;s usually named as the original file followed by tilde like FileName~. Though backup files are life saver, they are difficult to manage if they accumulate on the same folder. To save all your files in one place, let&apos;s say in folder &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.saves&lt;/code&gt;, add this to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.emacs&lt;/code&gt;&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-common-lisp&quot; data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;backup-directory-alist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;~/.saves&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
    &lt;h4 id=&quot;emacs-for-browsing&quot;&gt;Emacs for Browsing&lt;/h4&gt;
    &lt;p&gt;If you are only interested in the content of a website and want to avoid those jarring javascript, emacs is a way to go. It uses an extension &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;w3m.el&lt;/code&gt; which uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;w3m&lt;/code&gt; which itself is a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;text-browser&lt;/code&gt;. Of course there are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Lynx&lt;/code&gt; and other text editors, but integrating w3m with emacs is very fast.&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-common-lisp&quot; data-lang=&quot;common-lisp&quot;&gt; 
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;load-path&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;~/emacs-w3m&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;w3m-load&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;browse-url-browser-function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;w3m-browse-url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;autoload&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;w3m-browse-url&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;w3m&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Ask a WWW browser to show a URL.&quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; optional keyboard short-cut&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\C-xm&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;browse-url-at-point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
    &lt;p&gt;Here&apos;s a snapshot of my website in emacs.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/myblog.png&quot; alt=&quot;myblog&quot; title=&quot;My Blog&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;emacs-for-email&quot;&gt;Emacs for Email&lt;/h4&gt;
    &lt;p&gt;How about integrating emacs to view your email. You could do this by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GNUS&lt;/code&gt;. Add this to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.gnus&lt;/code&gt; file&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-common-lisp&quot; data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gnus-select-method&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;nnimap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;gmail&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;nnimap-address&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;imap.gmail.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;nnimap-server-port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;993&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;nnimap-stream&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ssl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;message-send-mail-function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;smtpmail-send-it&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;smtpmail-starttls-credentials&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;smtp.gmail.com&quot;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;587&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;smtpmail-auth-credentials&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;smtp.gmail.com&quot;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;587&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;user@gmail.com&quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;smtpmail-default-smtp-server&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;smtp.gmail.com&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;smtpmail-smtp-server&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;smtp.gmail.com&quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;smtpmail-smtp-service&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;587&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;gnus-ignored-newsgroups&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\&quot;]\&quot;[#&apos;()]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
    &lt;p&gt;Replace user with you&apos;re gmail username.Also add this to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.authinfo&lt;/code&gt; file&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;machine imap.gmail.com login user@gmail.com password secret port 993
    machine smtp.gmail.com login user@gmail.com password secret port 587
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;The password field is optional. Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x gnus&lt;/code&gt; to start GNUS. To compose email, type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt;. Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c C-c&lt;/code&gt; to send mail.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/gnus.png&quot; alt=&quot;gnus&quot; title=&quot;GNUS&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;emacs-for-photo-editing&quot;&gt;Emacs for Photo Editing&lt;/h4&gt;
    &lt;p&gt;The other task I usually do is look up few photos. Emacs can do more than just viewing the pictures, it has an inbuilt powerful power editor called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Image-Dired&lt;/code&gt;. Simply press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x image-dired&lt;/code&gt; on your emacs.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/image_dired.png&quot; alt=&quot;Image-dired&quot; title=&quot;Image Dired&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;emacs-for-composing-documents&quot;&gt;Emacs for composing Documents&lt;/h4&gt;
    &lt;p&gt;This is one of the feature I find unparalleled to emacs. The official website says about org mode, &quot;Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system&quot;.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/orgMode.png&quot; alt=&quot;orgMode&quot; title=&quot;Org&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;If you love &lt;em&gt;LaTeX&lt;/em&gt;, then there are more reasons to love &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org mode&lt;/code&gt;. You could integrated &lt;em&gt;TeX&lt;/em&gt; support and export your work in &lt;em&gt;PDF&lt;/em&gt;.For this add this to your ~/.emacs file&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-common-lisp&quot; data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-latex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;boundp&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-export-latex-classes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-export-latex-classes&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-export-latex-classes&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;article&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;\\documentclass{article}&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\\section{ %s}&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\\section*{ %s}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
    &lt;h4 id=&quot;emacs-for-secret-writing&quot;&gt;Emacs for Secret Writing&lt;/h4&gt;
    &lt;p&gt;If you happen to maintain a personal diary, you must be paranoid about it&apos;s secrecy. Emacs could be used to store your personal information. It uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GNU GPG&lt;/code&gt; to save the file. Open any file in emacs with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpg&lt;/code&gt; extension.To save it, press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-s&lt;/code&gt; which asks for which type of encryption method to use. Just use the default and press OK. This would prompt for a passphrase for saving.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/secretGPG.png&quot; alt=&quot;secretGPG&quot; title=&quot;GPG&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;emacs-for-playing-music&quot;&gt;Emacs for Playing Music&lt;/h4&gt;
    &lt;p&gt;First install mplayer.&lt;/p&gt;
    &lt;p&gt;In Linux (Ubuntu/Debian) try&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo apt-get install mplayer
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;In Mac try&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ brew install mplayer
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Clone &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;emms&lt;/code&gt;&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; $ git clone git://git.sv.gnu.org/emms.git
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;If it fails try this&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; $ git clone git://git.sv.gnu.org/r/emms.git
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;It will clone the folder emms. Inside the folder, there are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*el&lt;/code&gt; file inside &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lisp&lt;/code&gt;. Copy them all to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.emacs.d/site-lisp/emms&lt;/code&gt;. Find the executable of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mplayer&lt;/code&gt; which is usually in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/bin/&lt;/code&gt;. Then add this to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.emacs&lt;/code&gt;&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-common-lisp&quot; data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;exec-path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;append&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;exec-path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/usr/local/bin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;load-path&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;~/.emacs.d/site-lisp/emms/lisp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;emms-setup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;emms-player-mplayer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emms-standard&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emms-default-players&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;define-emms-simple-player&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mplayer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;regexp-opt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.ogg&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.mp3&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.wav&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.mpg&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.mpeg&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.wmv&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.wma&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;.mov&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.avi&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.divx&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.ogm&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.asf&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.mkv&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;http://&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;mms://&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;.rm&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.rmvb&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.mp4&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.flac&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.vob&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.m4a&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.flv&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.ogv&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.pls&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;mplayer&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;-slave&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;-quiet&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;-really-quiet&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;-fullscreen&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
    &lt;p&gt;Then type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x emms-play-directory&lt;/code&gt; to navigate to music directory and play files.&lt;/p&gt;
    &lt;h4 id=&quot;emacs-for-social-networking&quot;&gt;Emacs for Social Networking&lt;/h4&gt;
    &lt;p&gt;If you cling for user experience, it&apos;s better to use regular browsers for social networking. And it sometimes becomes difficult to replicate all functionality of websites in emacs. Nevertheless, there&apos;s a ways to circumvent some of the limitations and use social networking in emacs.&lt;/p&gt;
    &lt;p&gt;To use facebook, visit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://m.facebook.com&lt;/code&gt;. If you want login information to remain store, add cookie information in emacs.&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-common-lisp&quot; data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;w3m-use-cookies&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
    &lt;p&gt;To use twitter, download &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;twittering-mode.el&lt;/code&gt; and store it somewhere. Add this to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.emacs&lt;/code&gt;&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-common-lisp&quot; data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;load-path&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/PATH/TO/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
    &lt;h4 id=&quot;emacs-for-amusement&quot;&gt;Emacs for Amusement&lt;/h4&gt;
    &lt;p&gt;Last but not least, emacs also has lots of interesting features for amusement.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/doctor.png&quot; alt=&quot;doctor&quot; title=&quot;doctor&quot; /&gt;&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x doctor&lt;/code&gt; to talk to a psychologist.&lt;/li&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x tetris&lt;/code&gt; to play tetris.&lt;/li&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x snake&lt;/code&gt; to play classic snake game.&lt;/li&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x pong&lt;/code&gt; to play ping pong.&lt;/li&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x mpuz&lt;/code&gt; for multiplication puzzle.&lt;/li&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x hanoi&lt;/code&gt; for computer solving towers of hanoi game&lt;/li&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x gomoku&lt;/code&gt; for five-in-a-row against the computer 
    8.Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x dunnet&lt;/code&gt; for text based adventure game.&lt;/li&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x life&lt;/code&gt; to grow your own cell in emacs.&lt;/li&gt;
    &lt;li&gt;Type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x butterfly&lt;/code&gt; if you&apos;re a &lt;a href=&quot;http://xkcd.com/378/&quot;&gt;xkcd&lt;/a&gt; fan.&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;For more visit emac&apos;s &lt;a href=&quot;http://www.emacswiki.org/emacs/CategoryGames&quot;&gt;games&lt;/a&gt;.&lt;/p&gt;
    &lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
    &lt;p&gt;Emacs is not meant to be an &lt;strong&gt;all-in-one&lt;/strong&gt; substitute for all softwares. Of course certain softwares are better at doing specific tasks. Emacs wins over the fact that I rarely needs to close it. One can easily customize and extend emacs using elisp, a dialect of lisp. If you&apos;re convinced of the power of emacs, let me welcome you to the &lt;a href=&quot;http://www.emacswiki.org/emacs/ChurchOfEmacs&quot;&gt;Church of Emacs&lt;/a&gt;. If not, let&apos;s part ways with an old joke, &quot;&lt;em&gt;The Emacs operaating system needs a better editor&lt;/em&gt;&quot;.&lt;/p&gt;
  </description>
  <pubDate>2013-11-06T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/why-i-never-close-emacs</link>
<guid isPermaLink="true">https://randomwits.com/blog/why-i-never-close-emacs</guid>
</item>
<item>
  <title>How ViM Saved My Day</title>
  <description>&lt;p&gt;It was just another day in Gurgaon. The hot scorching sun was parading the city. The inescapable life of riding with the autowalas is the common sight of this concrete jungle. Though I am a FOSS enthusiast, my first job landed me to just another India&apos;s IT company. I vividly remember the countless occasions when ViM saved my day.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;It was just another day in Gurgaon. The hot scorching sun was parading the city. The inescapable life of riding with the autowalas is the common sight of this concrete jungle. Though I am a FOSS enthusiast, my first job landed me to just another India&apos;s IT company. I vividly remember the countless occasions when ViM saved my day.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/vim.png&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;early-days&quot;&gt;Early Days&lt;/h4&gt;
    &lt;p&gt;I mostly received rudimentary tasks in early days of my work. I received one such task just few days after my joining. I was slouching on my chair when I heard this commanding voice.&lt;/p&gt;
    &lt;p&gt;“New joining”.&lt;/p&gt;
    &lt;p&gt;“Yes, sir”,  I replied looking around trying to find the source of the voice.&lt;/p&gt;
    &lt;p&gt;A tall thin man with the air of authority stood glaring over my shoulders.&lt;/p&gt;
    &lt;p&gt;“Come, I have a work for you”, he said and drew me to his cabin.&lt;/p&gt;
    &lt;p&gt;He showed me a csv file. Unfortunately I can&apos;t post the original files but I&apos;ve tried to create resemblance of original file. See the picture 1 below.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/figure1.png&quot; alt=&quot;Picture1&quot; title=&quot;The CSV file&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;He began scrolling down the file. It took him more than two minutes to get to the middle of the file while my eyes remained glued to the screen counting the number of lines. At last when he reached the bottom, deducing my curiosity he said, “It has 2000 lines”.&lt;/p&gt;
    &lt;p&gt;“All you have to do”, he said, “is to pick each line of this CSV file and paste it to another text file with slight alteration”. He showed me another text file which resembled to Picture 2.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/figure2.png&quot; alt=&quot;Picture2&quot; title=&quot;The SQL File&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;“Each line should be similar to the other file”, he said pointing to Picture 2.  Not only did I have to rearrange items of the line but also had to insert some extra text to match Picture 2.&lt;/p&gt;
    &lt;p&gt;“How do you do it here”, I asked hoping if there was a trick.&lt;/p&gt;
    &lt;p&gt;“You have to do it manually”, he continued, “No other way”. Taking cognisance of my crestfallen face he said, “Don&apos;t worry. There&apos;s no hurry. You can take few days as you are new”, he said.&lt;/p&gt;
    &lt;p&gt;With those words he left me with this task. Nothing peeves a programmer more than doing a monotonous repetitive work. But as every cloud has a sliver lining, similarly every problem too has a smarter solution.&lt;/p&gt;
    &lt;h4 id=&quot;hello-vim&quot;&gt;Hello ViM&lt;/h4&gt;
    &lt;p&gt;ViM stands for Vi Improved which is clone based on VI editor. If you&apos;ve never heard of vi, chances are you are still accustomed to the world of WYSIWYG editors like Notepad, etc. Well, those editors are great if you&apos;re daily tasks are to simply edit, copy, paste, search, etc but if you want to get you&apos;re hands dirty, vim is the panacea every programmer wants. Of course few other editors like emacs are equally powerful (or more&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;), but this post is about my romance with ViM (Sorry Emacs).&lt;/p&gt;
    &lt;p&gt;Ideally I would want to lay my hands on some Unix clone to get such task done. But my system was running legacy operating system, I did not have that luxury. Nevertheless most free&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; softwares today easily run on non-Unix operating systems (like Windows). I fired internet explorer (to download firefox :) ) and downloaded a portable version of ViM.&lt;/p&gt;
    &lt;h4 id=&quot;smart-way&quot;&gt;Smart Way&lt;/h4&gt;
    &lt;p&gt;ViM is a modal editor. Unlike other common editors, you can&apos;t start typing text in it straight away. ViM opens in command mode. To switch to insert mode, you have to press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;. If you love typing and rarely use mouse (which most programmers do) then you&apos;ll love ViM. Navigation in ViM is by using classic &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hjkl&lt;/code&gt; keys.&lt;/p&gt;
    &lt;p&gt;Now its time to return to our problem i.e the file in Picture 1. I had to edit to look similar to file in Picture 2. To acomplish this task, I use a nifty feature of ViM called macros. Macros help to record my sequence of steps and play it again and again. In simple words, what I do for one line, I can repeat it for 1999 lines. These were sequence of steps&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Start recording the macro&lt;/li&gt;
    &lt;li&gt;Jump to Fourth element of the file&lt;/li&gt;
    &lt;li&gt;Cut the whole line from this element up to the end&lt;/li&gt;
    &lt;li&gt;Paste in the beginning of file&lt;/li&gt;
    &lt;li&gt;Go to last element&lt;/li&gt;
    &lt;li&gt;Cut the last element&lt;/li&gt;
    &lt;li&gt;Paste it before last two elements&lt;/li&gt;
    &lt;li&gt;Add extra text wherever required&lt;/li&gt;
    &lt;li&gt;Stop the macro&lt;/li&gt;
    &lt;li&gt;Repeat the macro of 1999 lines&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;To translate the above steps in ViM&lt;/p&gt;
    &lt;ol&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qa&lt;/code&gt; to start the macro and save it in register a&lt;/li&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt; to search for comma. Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; 2 times to reach fourth element&lt;/li&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d&lt;/code&gt; to cut the line from fourth element to end&lt;/li&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; to go to beginning of file. Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p&lt;/code&gt; to paste.&lt;/li&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$&lt;/code&gt; to reach last element.&lt;/li&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&apos;&lt;/code&gt; to cut the last element&lt;/li&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?&lt;/code&gt; to reverse search comma and press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt;. Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p&lt;/code&gt; to paste.&lt;/li&gt;
    &lt;li&gt;Copy paste extra text where required. Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; to enter insert mode and to paste  press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SHIFT&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CTRL&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;V&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Enter&lt;/code&gt; to jump off the line and press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;q&lt;/code&gt; to stop the macro&lt;/li&gt;
    &lt;li&gt;Press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1999@a&lt;/code&gt; to repeat macro&lt;/li&gt;
    &lt;/ol&gt;
    &lt;p&gt;Of course you can reduce the number of steps by a more elegant solution. But this alone helped me solve my task. See my resulted file in Picture 3 below.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/figure3.png&quot; alt=&quot;Picture3&quot; title=&quot;The Result&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;even-more-smart-way&quot;&gt;Even More Smart Way&lt;/h4&gt;
    &lt;p&gt;Imagine if you have to repeat this task again and again. It&apos;s cumbersome to write the same macro again and again after you switch off your machine. There&apos;s a way to store macro so that you don&apos;t need to remember them. First copy the value of your macro. To see your macro&apos;s value type&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:anew
    :&quot;ap
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;And copy paste this value of macro in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt; file&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;let @a = &apos;MACRO_VALUE&apos;
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Just replace MACRO_VALUE with the value of your own macro. Here&apos;s value of my own macro&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;0/,^Mnnlv$hd0i ^[p^[0^[lu^[uuuuuuuuuuuuuuu
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;And Voila! Your Macro is saved.&lt;/p&gt;
    &lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
    &lt;p&gt;ViM is a wonderful editor if only you get to know it. The following task took me less than 15 minutes to complete. Of course less than 15 minutes feat dazzled my supervisor but more than the approval it&apos;s the satisfaction that comes from solving problems smartly. So what&apos;s your story? Have ViM ever saved your day?&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;There&apos;s a famous editor war between VI and Emacs &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Free means as if freedom not gratis &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2013-10-18T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/how-vim-saved-my-day</link>
<guid isPermaLink="true">https://randomwits.com/blog/how-vim-saved-my-day</guid>
</item>
<item>
  <title>Why hacking is good</title>
  <description>&lt;p&gt;Once a friend of mine asked if I could Hack. I asked him what he meant by hacking. Bemused at such a lame question he replied, &quot;Don&apos;t you know what hacking is?&quot;. On insisting he reluctantly explained, &quot;breaking into website or stealing passwords of Facebook, etc&quot;. I was crestfallen at the rampant misconception about hacking.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;Once a friend of mine asked if I could Hack. I asked him what he meant by hacking. Bemused at such a lame question he replied, &quot;Don&apos;t you know what hacking is?&quot;. On insisting he reluctantly explained, &quot;breaking into website or stealing passwords of Facebook, etc&quot;. I was crestfallen at the rampant misconception about hacking.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/hacker.jpg&quot; /&gt;&lt;/p&gt;
    &lt;h4 id=&quot;what-people-think-hacking-is&quot;&gt;What people think hacking is&lt;/h4&gt;
    &lt;p&gt;Often we read news of hackers breaking into websites siphoning millions of dollars. Such news not only create pervasive fear of hacking but also glorify such malicious activities. Media portrays hackers as precocious teenagers toying away with their hi-tech gadgets in their basement trying to circumvent securities. Their skills are often calibrated against the damage they can cause. Just google hacking and news of hackers getting convicted of breaching securities grabs the limelight. The most popular method used by such people involves defacing a website for &lt;a href=&quot;http://en.wikipedia.org/wiki/Hacktivism&quot; target=&quot;_blank&quot;&gt;hacktivism&lt;/a&gt; which usually involves &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL_injection&quot; target=&quot;_blank&quot;&gt;SQL injecting&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-site_scripting&quot; target=&quot;_blank&quot;&gt;Cross Site Scripting&lt;/a&gt; (XSS) or &lt;a href=&quot;http://en.wikipedia.org/wiki/Denial-of-service_attack&quot; target=&quot;_blank&quot;&gt;Denial of service&lt;/a&gt; (DoS). None of the above techniques involves any sophisticated technical skills. Even if some of intrusion involved superior technical skills, it would not be hacking as it is against the hacker&apos;s ethics&lt;sup id=&quot;fnref:ethics&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:ethics&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
    &lt;h4 id=&quot;what-hacking-really-is&quot;&gt;What hacking really is&lt;/h4&gt;
    &lt;p&gt;Hacking is learning and building constructing things and nothing else. The concept of hacking emanated from MIT in 1960 where the term &quot;hacking&quot; resonated with creativity. Hacks were anything ingenious which may include any piece of code or even a clever prank. Hacker is used to denote a person who follows a spirit of playful cleverness and loves programming&lt;sup id=&quot;fnref:hacker&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:hacker&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;. True hackers are those rare breed of people who are masterful programmers who believe in freedom to access and share knowledge. As Eric Raymond aptly puts it, &quot;There is a community, a shared culture, of expert programmers and networking wizards that traces its history back through decades to the first time-sharing minicomputers and the earliest ARPAnet experiments. The members of this culture originated the term &apos;hacker&apos;. Hackers built the Internet. Hackers made the Unix operating system what it is today. Hackers run Usenet. Hackers make the World Wide Web work. If you are part of this culture, if you have contributed to it and other people in it know who you are and call you a hacker, you&apos;re a hacker&lt;sup id=&quot;fnref:eric&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:eric&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&quot;.&lt;/p&gt;
    &lt;h4 id=&quot;what-is-the-difference&quot;&gt;What is the difference&lt;/h4&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th align=&quot;center&quot;&gt; &lt;strong&gt;&lt;/strong&gt; &lt;/th&gt;
    &lt;th align=&quot;center&quot;&gt; &lt;strong&gt; Type  &lt;/strong&gt;&lt;/th&gt;
    &lt;th align=&quot;center&quot;&gt; &lt;strong&gt;Name&lt;/strong&gt; &lt;/th&gt;
    &lt;th align=&quot;center&quot;&gt; &lt;strong&gt;Known For&lt;/strong&gt; &lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td align=&quot;center&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Ankit_Fadia&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;height:150px;padding:15px 15px 15px 0px;max-width: 100px;&quot; src=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/5/55/Ankitfadia2.jpg/200px-Ankitfadia2.jpg&quot; /&gt;&lt;/a&gt; &lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;Media Hacker&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;Ankit Fadia&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt; Claimed that after the 9/11 attacks, &quot;American investigating agencies&quot; invited him to decode an encrypted message posted by Al-Qaeda. Thought he got much &lt;a href=&quot;http://www.thehindu.com/sci-tech/inside-account/article48684.ece&quot; target=&quot;_blank&quot;&gt;publicity&lt;/a&gt;, his claims are refuted &lt;a href=&quot;http://forbesindia.com/article/beyond-business/ankit-fadia-revealed/34793/0&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td align=&quot;center&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Richard_Stallman&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;height:150px;padding:15px 15px 15px 0px;max-width: 100px;&quot; src=&quot;http://static.fsf.org/fsforg/img/rms-web.jpg&quot; /&gt;&lt;/a&gt; &lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;True Hacker&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;Richard Stallman&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;Launched GNU Project, founding the Free Software Foundation, developing the GNU Compiler Collection and GNU Emacs, and writing the GNU General Public License &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
    &lt;p&gt;Convictions of computer crimes, which began as early as 1983 with the case of 414&lt;sup id=&quot;fnref:414&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:414&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;, caught the attention of the media. Rampant breach of security created panic among general public and intruders called themselves &apos;hackers&apos;. These bunch of people, who writes malicious code, are nothing but crackers&lt;sup id=&quot;fnref:crackers&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:crackers&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;. Not only did they rob people of their money but also condemned such a beautiful word as &apos;hacker&apos;.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:ethics&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Hacker_ethic&quot; target=&quot;_blank&quot;&gt;Hacker ethic&lt;/a&gt; &lt;a href=&quot;#fnref:ethics&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:hacker&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Hacker_(term)#Programmer_subculture_of_hackers&quot; target=&quot;_blank&quot;&gt;Hacker_(term)&lt;/a&gt; &lt;a href=&quot;#fnref:hacker&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:eric&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.catb.org/esr/faqs/hacker-howto.html#whatis&quot; target=&quot;_blank&quot;&gt;How to be a hacker&lt;/a&gt; &lt;a href=&quot;#fnref:eric&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:414&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/The_414s&quot; target=&quot;_blank&quot;&gt;414&lt;/a&gt; &lt;a href=&quot;#fnref:414&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:crackers&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.catb.org/jargon/html/C/cracker.html&quot; target=&quot;_blank&quot;&gt;Jargon file - Cracker&lt;/a&gt; &lt;a href=&quot;#fnref:crackers&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2013-09-10T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/why-hacking-is-good</link>
<guid isPermaLink="true">https://randomwits.com/blog/why-hacking-is-good</guid>
</item>
<item>
  <title>Sleep</title>
  <description>&lt;p&gt;As I lay on my cosy bed,&lt;br /&gt; 
    a hanging moon did my curtains lit,&lt;br /&gt; 
    under my pillow sank my weary head,&lt;br /&gt; 
    and slumber weaved its sleepy knit.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;As I lay on my cosy bed,&lt;br /&gt; 
    a hanging moon did my curtains lit,&lt;br /&gt; 
    under my pillow sank my weary head,&lt;br /&gt; 
    and slumber weaved its sleepy knit.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;The clock ticked and ticked away,&lt;br /&gt; 
    I climbed mountains and travelled like a bullet,&lt;br /&gt; 
    no laws of physics or Michael Faraday,&lt;br /&gt; 
    only in dreams can everyone shine like a starlet.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;Suddenly the window lost its shine,&lt;br /&gt; 
    the clouds caged away the moonlit night,&lt;br /&gt; 
    no breeze came to play the rhyme,&lt;br /&gt; 
    my dreams were wreaked by this monstrous plight.&lt;br /&gt;&lt;/p&gt;
    &lt;p&gt;As my heart was pumping fast,&lt;br /&gt; 
    adrenaline but then a hand came past,&lt;br /&gt; 
    of my mother caressing my forehead and left,&lt;br /&gt; 
    the dark murky clouds away through the cleft.&lt;/p&gt;
    &lt;!--end_of_post --&gt;
  </description>
  <pubDate>2013-09-07T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/sleep</link>
<guid isPermaLink="true">https://randomwits.com/blog/sleep</guid>
</item>
<item>
  <title>Encrypted Files in Minix 3</title>
  <description>&lt;p&gt;Implemented a new system call in Minix 3 along with the library function that allows it to be called conveniently from a C program. The library interface extends extends file access operations to handle encrypted files.&lt;/p&gt;
    &lt;p&gt;Reading and writing to a file is done through a system call. The first is to access the &quot;master encryption table&quot; file (/etc/encryptTable) that stores the information about every file that is encrypted within Minix and contains three pieces of information: fs_dev, inode_nr and hashed_pw. The first two information uniquely identifies what file is encrypted and can be obtained from the vnode for the file.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/tushar-sharma/encrypted-file-sytem&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;Implemented encrypted files in Minix 3. The cipher used is simple Caesar&apos;s cipher.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Implemented a new system call in Minix 3 along with the library function that allows it to be called conveniently from a C program. The library interface extends extends file access operations to handle encrypted files.&lt;/p&gt;
    &lt;p&gt;Reading and writing to a file is done through a system call. The first is to access the &quot;master encryption table&quot; file (/etc/encryptTable) that stores the information about every file that is encrypted within Minix and contains three pieces of information: fs_dev, inode_nr and hashed_pw. The first two information uniquely identifies what file is encrypted and can be obtained from the vnode for the file.&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/tushar-sharma/encrypted-file-sytem&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
  </description>
  <pubDate>2013-04-16T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/projects/encrypt-files</link>
<guid isPermaLink="true">https://randomwits.com/projects/encrypt-files</guid>
</item>
<item>
  <title>Binary Sempahore</title>
  <description>&lt;p&gt;Implemented binary semaphore in Minix 3. Minix 3 is a micro-kernel operating system.&lt;/p&gt;
    &lt;p&gt;Most of the process pass information among themselves using application IPC. This often result in race condition. To prevent it and provide synchronization, semaphores, first proposed by Dikstras, is used.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/tushar-sharma/dining_philosopher&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;Implemented binary semaphore in Minix 3. Minix 3 is a micro-kernel operating system.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;About&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Most of the process pass information among themselves using application IPC. This often result in race condition. To prevent it and provide synchronization, semaphores, first proposed by Dikstras, is used.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Implemented a new system call in Minix 3 along with the library function that allows it to be called conveniently from a C program. The library interface extends different process to use semaphore.&lt;/p&gt;
    &lt;p&gt;Binary Semaphore is used by processes to access the critical shared resources of the system. To demonstrate the working of semaphore, dining philosopher is implemented.&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/tushar-sharma/dining_philosopher&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot;&gt;&lt;h3&gt;Footnotes&lt;/h3&gt;&lt;hr /&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
    &lt;p&gt;Image courtesy ~ &lt;a href=&quot;https://opensourcewin.wordpress.com/2012/03/16/what-is-minix-linux/&quot; target=&quot;_blank&quot;&gt;OpenSourcewin.Wordpress.com&lt;/a&gt;
    &lt;/p&gt;
    &lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2013-03-28T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/projects/binary-semaphore</link>
<guid isPermaLink="true">https://randomwits.com/projects/binary-semaphore</guid>
</item>
<item>
  <title>Advanced Encryption Standard (AES)</title>
  <description>&lt;p&gt;Advanced Encryption Standard, a symmetric key algorithm, implemented in C++. All the parties use the same key for encryption and decryption. It has superseded DES, another symmetric key algorithms.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.scribd.com/doc/164002353/Study-and-Implementation-of-various-Cryptographic-techniques#page=42&quot;&gt;details&lt;/a&gt; — &lt;a href=&quot;https://github.com/tushar-sharma/aes&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;Advanced Encryption Standard, a symmetric key algorithm, implemented in C++. All the parties use the same key for encryption and decryption. It has superseded DES, another symmetric key algorithms.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;About&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Rijndael was selected by NIST (National Institute of Standards and Technology) as AES. Unlike Rijndael in which block length and key length can be specified to any multiple of 32 bits, AES fixes block length to 128 bits and key length to (128 or 192 or 256) bits.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;The total number of rounds with key of 128 bits is 10. There are four subroutine that are performed in each rounds.&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Byte Substitution Transformation&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Each element of state is non-linearly mapped to corresponding element in the s-bx. &lt;sup id=&quot;fnref:bytesub&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:bytesub&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/sub.png&quot; alt=&quot;Byte_Sub&quot; title=&quot;Byte Sub&quot; /&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Shift Rows&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Rows are cyclically shifted to the left with offset of 0, 1, 2, 3 for rows of 1, 2, 3 and 4 respectively. &lt;sup id=&quot;fnref:sr&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:sr&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/sr.png&quot; alt=&quot;Shift_Rows&quot; title=&quot;Shift Rows&quot; /&gt;&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Mix columns &lt;sup id=&quot;fnref:mc&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:mc&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;Each new column (ro, r1, r2, r3) is generated from old column (a0, a1, a2, a3).&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/mc1.png&quot; alt=&quot;Mc&quot; title=&quot;Mix Column&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Here,
    r0 = {2 . a0} + {3 . a1} + {1 . a2} + {1. a3}
    r1 = {1 . a0} + {2 . a1} + {3 . a2} + {1. a3}
    r2 = {1 . a0} + {1 . a1} + {2 . a2} + {1 . a3}
    r3 = {3 . a0} + {1 . a1} + {1 . a2} + {2 . a3}&lt;/p&gt;
    &lt;ul&gt;
    &lt;li&gt;Add Round Key&lt;/li&gt;
    &lt;/ul&gt;
    &lt;p&gt;For each round, subkey is combined with the state matrix using biwise XOR.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Key Generation&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Initial key is described as a state matrix.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Co&lt;/th&gt;
    &lt;th&gt;C1&lt;/th&gt;
    &lt;th&gt;C2&lt;/th&gt;
    &lt;th&gt;C3&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;a&lt;sub&gt;00&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;a&lt;sub&gt;01&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;a&lt;sub&gt;02&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;a&lt;sub&gt;03&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;b&lt;sub&gt;10&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;b&lt;sub&gt;11&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;b&lt;sub&gt;12&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;b&lt;sub&gt;13&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;c&lt;sub&gt;20&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;c&lt;sub&gt;21&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;c&lt;sub&gt;22&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;c&lt;sub&gt;23&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;d&lt;sub&gt;30&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;d&lt;sub&gt;31&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;d&lt;sub&gt;32&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;d&lt;sub&gt;33&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;The last column is cyclically rotated to move the last block to the top.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;Co&lt;/th&gt;
    &lt;th&gt;C1&lt;/th&gt;
    &lt;th&gt;C2&lt;/th&gt;
    &lt;th&gt;C3&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;a&lt;sub&gt;00&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;a&lt;sub&gt;01&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;a&lt;sub&gt;02&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;d&lt;sub&gt;33&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;b&lt;sub&gt;10&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;b&lt;sub&gt;11&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;b&lt;sub&gt;12&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;a&lt;sub&gt;03&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;c&lt;sub&gt;20&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;c&lt;sub&gt;21&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;c&lt;sub&gt;22&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;b&lt;sub&gt;13&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;d&lt;sub&gt;30&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;d&lt;sub&gt;31&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;d&lt;sub&gt;32&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;c&lt;sub&gt;23&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;The last column is then mapped with the corresponding element of the s-box.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;C3&lt;/th&gt;
    &lt;th&gt; &lt;/th&gt;
    &lt;th&gt;C3&lt;sup&gt;&apos;&lt;/sup&gt;&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;a&lt;sub&gt;00&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;–&amp;gt;&lt;/td&gt;
    &lt;td&gt;a&lt;sub&gt;02&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;b&lt;sub&gt;10&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;–&amp;gt;&lt;/td&gt;
    &lt;td&gt;b&lt;sub&gt;12&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;c&lt;sub&gt;20&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;–&amp;gt;&lt;/td&gt;
    &lt;td&gt;c&lt;sub&gt;22&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;d&lt;sub&gt;30&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;–&amp;gt;&lt;/td&gt;
    &lt;td&gt;d&lt;sub&gt;32&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;New column C&lt;sub&gt;0&lt;/sub&gt; is generated by XORing previous C&lt;sub&gt;0&lt;/sub&gt; with the new column.&lt;/p&gt;
    &lt;table&gt;
    &lt;thead&gt;
    &lt;tr&gt;
    &lt;th&gt;C0&lt;/th&gt;
    &lt;th&gt; &lt;/th&gt;
    &lt;th&gt;C3&lt;sup&gt;&apos;&lt;/sup&gt;&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
    &lt;td&gt;a&lt;sub&gt;00&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;⊕&lt;/td&gt;
    &lt;td&gt;a&lt;sub&gt;02&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;b&lt;sub&gt;10&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;⊕&lt;/td&gt;
    &lt;td&gt;b&lt;sub&gt;12&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;c&lt;sub&gt;20&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;⊕&lt;/td&gt;
    &lt;td&gt;c&lt;sub&gt;22&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;d&lt;sub&gt;30&lt;/sub&gt;&lt;/td&gt;
    &lt;td&gt;⊕&lt;/td&gt;
    &lt;td&gt;d&lt;sub&gt;32&lt;/sub&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;p&gt;Similarly all new coulumns are generated by XORing with pervious columns.&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.scribd.com/doc/164002353/Study-and-Implementation-of-various-Cryptographic-techniques#page=42&quot;&gt;details&lt;/a&gt; — &lt;a href=&quot;https://github.com/tushar-sharma/aes&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:bytesub&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;http://goo.gl/lfkNI &lt;a href=&quot;#fnref:bytesub&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:sr&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;http://goo.gl/j8YGJ &lt;a href=&quot;#fnref:sr&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:mc&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Understanding AES Mix-Columns Transformation Calculation by Kit Choy Xintong &lt;a href=&quot;#fnref:mc&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2012-11-02T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/projects/aes</link>
<guid isPermaLink="true">https://randomwits.com/projects/aes</guid>
</item>
<item>
  <title>Data Encryption Standard (DES)</title>
  <description>&lt;p&gt;Data Encryption Standard, a symmetric key algorithm, implemented in C++. All the parties use the same key for encryption and decryption. Look at the diagram below.&lt;/p&gt;
    &lt;p&gt;Here, m is message which is passed through an encrypted function &lt;i&gt;E&lt;/i&gt; along with key &lt;i&gt;K&lt;/i&gt;. The resultant is a unintelligent gibberish cipher. The cipher is decoded again using the same key to produce plain message.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.scribd.com/doc/164002353/Study-and-Implementation-of-various-Cryptographic-techniques#page=11&quot;&gt;details&lt;/a&gt; — &lt;a href=&quot;https://github.com/tushar-sharma/des&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;Data Encryption Standard, a symmetric key algorithm, implemented in C++. All the parties use the same key for encryption and decryption. Look at the diagram below.&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/sym.png&quot; alt=&quot;Encr&quot; title=&quot;Symmetric Encryption&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Here, m is message which is passed through an encrypted function &lt;i&gt;E&lt;/i&gt; along with key &lt;i&gt;K&lt;/i&gt;. The resultant is a unintelligent gibberish cipher. The cipher is decoded again using the same key to produce plain message.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;About&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;Though DES is not used nowdays in many application, it was the predominant algorithm developed by IBM (and later modified by NSA) for encrypting electronic data. However Triple DES is considered secure and is still used in many application.&lt;/p&gt;
    &lt;p&gt;DES is a Block Cipher. DES works on 64 bits blocks. Hence the plaintext is divided into chunks of 64 bits. Padding is used if the data could not be divided into equal blocks.&lt;/p&gt;
    &lt;p&gt;The key used is of 56 bits length which is extracted from the 64 bit original key (by ignoring every eight bit).&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;After &lt;a href=&quot;http://en.wikipedia.org/wiki/DES_supplementary_material&quot;&gt;initial permutation&lt;/a&gt;, block of 64 bits of plaintext is broken into right and left half of 32 bits each. It is followed by 16 rounds of identical operations called &lt;i&gt;Function f&lt;/i&gt;. In this the data are algorithmically combined with the key.&lt;/p&gt;
    &lt;p&gt;In each round, the key bits are shifted and then 48 bits are selected from 56 bits of key. The right half of data is expanded to 48 bits via an &lt;a href=&quot;http://en.wikipedia.org/wiki/DES_supplementary_material&quot;&gt;expansion permutation&lt;/a&gt;, combined with 48 bits of a shifted and permuted key via an XOR, sent through 8 s-boxes producing 32 new bits and permuted again. The four operation make up Function f. The output of &lt;i&gt;Function f&lt;/i&gt; is then combined with the left half via another XOR operation. The result of these operation becomes the new left half. Mathematically &lt;i&gt;Function f&lt;/i&gt; could be written as&lt;/p&gt;
    &lt;p&gt;&lt;code&gt;&amp;lt;pre&amp;gt;
    L&lt;sub&gt;i&lt;/sub&gt; = R&lt;sub&gt;i - 1&lt;/sub&gt;
    R&lt;sub&gt;i&lt;/sub&gt; = L&lt;sub&gt;i - 1&lt;/sub&gt; &amp;oplus; f(R&lt;sub&gt;i - 1&lt;/sub&gt;, K&lt;sub&gt;i&lt;/sub&gt;)
    &amp;lt;/pre&amp;gt;&lt;/code&gt;&lt;/p&gt;
    &lt;p&gt;After 16&lt;sup&gt;th&lt;/sup&gt; round, right and left halves are joined and a &lt;a href=&quot;http://en.wikipedia.org/wiki/DES_supplementary_material&quot;&gt;final permutation&lt;/a&gt; finishes off the algorithm. To better understand, look at the diagram below. &lt;sup id=&quot;fnref:book&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:book&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
    &lt;p&gt;&lt;img src=&quot;/img/des.jpg&quot; alt=&quot;DES&quot; title=&quot;DES&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;I implemented this project in C++. This was the first encryption standard which I studied and implemented.&lt;/p&gt;
    &lt;hr /&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.scribd.com/doc/164002353/Study-and-Implementation-of-various-Cryptographic-techniques#page=11&quot;&gt;details&lt;/a&gt; — &lt;a href=&quot;https://github.com/tushar-sharma/des&quot;&gt;code&lt;/a&gt;&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:book&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;Network Security: Private Communication in a Public World &lt;a href=&quot;#fnref:book&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2012-08-21T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/projects/des</link>
<guid isPermaLink="true">https://randomwits.com/projects/des</guid>
</item>
<item>
  <title>Huawei Usb Modem in Debian</title>
  <description>&lt;p&gt;The Debian claimed to be the Universal Operating System. Impressed by the stability and the community, I decided to switch to Debian. Earlier I used Fedora which handled all the hassles for me. Unlike Fedora, I had manually configure it to connect to the internet. But I soon realized it was not as difficult as it earlier seemed to be.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;The Debian claimed to be the Universal Operating System. Impressed by the stability and the community, I decided to switch to Debian. Earlier I used Fedora which handled all the hassles for me. Unlike Fedora, I had manually configure it to connect to the internet. But I soon realized it was not as difficult as it earlier seemed to be.&lt;/p&gt;
    &lt;p&gt;I&apos;ll be using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wvdial&lt;/code&gt; to configure the internet. It&apos;s likely that your system will have the package pre installed. Otherwise you can manually download it from &lt;a href=&quot;http://packages.debian.org/squeeze/wvdial&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
    &lt;p&gt;Now connect the modem and run lsusb to see the modem connected to the usb:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ lusub
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;img src=&quot;/img/w4.png&quot; alt=&quot;w4&quot; title=&quot;w4&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Here we see Huawie usb is visible as Huawei Wireless Data Modem. Become a super user by typing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo su&lt;/code&gt;. Now for detecting the modem run:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# wvdial /etc/wvdial.conf 
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;img src=&quot;/img/w1.png&quot; alt=&quot;w1&quot; title=&quot;w1&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;This scans the usb port for modem. In my case the modem was detected in ttyUSB0. Now edit the wvdial.conf file. I am accustomed to use vi editor. But you can use any editor like gedit, nano, etc. Just replace vi with the name of your editor&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# vi /etc/wvdial.conf
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;&lt;img src=&quot;/img/w3.png&quot; alt=&quot;w3&quot; title=&quot;w3&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Remove the semicolons &amp;amp; change the following values:&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Username: internet
    Password: internet
    Phone   : #777
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Also add the following lines to wvdial.conf&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Init3 = AT+CRM=1
    Stupid Mode = 1
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Now run the following command.&lt;/p&gt;
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# wvdial
    &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;p&gt;Bravo! It connects to the internet. Press &lt;b&gt;Ctrl + C&lt;/b&gt; anytime to disconnect.&lt;/p&gt;
  </description>
  <pubDate>2012-07-04T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/huawei-usb-modem-in-debian</link>
<guid isPermaLink="true">https://randomwits.com/blog/huawei-usb-modem-in-debian</guid>
</item>
<item>
  <title>Fear of Walmart</title>
  <description>&lt;p&gt;After a ruckus, the government agreed to roll back the proposed decision to increase FDI in retail sector. This could have paved way for the behemoth giants like Walmart to enter India. Indian Inc. was largely disappointed with the lack of much needed retail reform while the opposition parties including the local shopkeeper rejoiced over the fear of Walmart.&lt;!-- truncate_here --&gt;&lt;/p&gt;
    &lt;p&gt;After a ruckus, the government agreed to roll back the proposed decision to increase FDI in retail sector. This could have paved way for the behemoth giants like Walmart to enter India. Indian Inc. was largely disappointed with the lack of much needed retail reform while the opposition parties including the local shopkeeper rejoiced over the fear of Walmart.&lt;/p&gt;
    &lt;p&gt;My lack of education in economics convinced me of my inability to form an opinion on this matter. But as a concerned citizen , I tried to understand the repercussion of such an important law debated in the parliament. My first hurdle was to demystify FDI ( Foreign Direct Investment). FDI is way to control the investment of a foreign company. The investment may include purchase of land, building factories, employing people, etc. Usually FDI is restricted in countries to protect domestic companies against the might of the multi-national companies. But relaxing FDI organizes the sector, drives the economy, increases employment, etc. India liberalized most of its sectors after 1991 which also witnessed the boom of Indian IT sector. Currently FDI in retail sector is restricted below 51% forbidding companies like Walmart to pounce upon the Indian market.&lt;/p&gt;
    &lt;p&gt;Indian acts like [APMC]&lt;sup id=&quot;fnref:apmc&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:apmc&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; have long forced farmers to only sell their products to the government mundis( market). Despite million starving in poverty, food grains across nation rots in the government godown(warehouse) thanks to the poor PDS. Unlike China, infrastructure in India is still poor. PDS( Public Distribution System) in India is also unorganized and less robust. Such shortcoming combined with other factors have left Indian farmers under the pangs of poverty. The rising inflation has forced RBI(Reserve Bank Of India) to continue to hike repo rates. This slowed the GDP( Gross Domestic Product) and devaluation of Indian ruppee against the dollar.&lt;/p&gt;
    &lt;p&gt;Does the much hyped Walmart would be a panacea for Indian consumers against the inflation? Entry of Walmart would usher the much needed reform in the retail sector. Food prices would fall as the Walmart would directly purchase food from the farmers thereby eliminating the middleman. India is perhaps the only developing country where Walmart is yet ink its presence. In contrast China has allowed 100% FDI in retail sector. Yet diluting FDI would be a arduous task for the central government walking a fine line between convincing the opposition and the local shopkeepers with a large chunk of the vote bank.&lt;/p&gt;
    &lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
    &lt;ol&gt;
    &lt;li id=&quot;fn:apmc&quot; role=&quot;doc-endnote&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Agricultural_Produce_Market_Committee&quot;&gt;APMC&lt;/a&gt; &lt;a href=&quot;#fnref:apmc&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/div&gt;
  </description>
  <pubDate>2012-03-30T00:00:00+00:00</pubDate>
  <link>https://randomwits.com/blog/fear-of-walmart</link>
<guid isPermaLink="true">https://randomwits.com/blog/fear-of-walmart</guid>
</item>
</channel>
</rss>