{
    "componentChunkName": "component---src-templates-index-template-js",
    "path": "/page/20",
    "result": {"data":{"site":{"siteMetadata":{"title":"Viksit Gaur Online","description":"Viksit's home on the WWW. Estd 1997 :)","url":"https://www.viksit.org"}},"allMarkdownRemark":{"nodes":[{"id":"0a85fd8f-43a4-51c4-9ada-e4d6ba6f0d50","html":"<p>I found this gem of a snippet today, and I rather agree with what it says!</p>\n<blockquote>\n<p>“How solemn and beautiful is the thought that the earliest pioneer of civilization, the van-leader of civilization, is never the steamboat, never the railroad, never the newspaper, never the Sabbath-school, never the missionary — but always whiskey! Such is the case. Look history over; you will see.</p>\n<p>The missionary comes after the whiskey — I mean he arrives after the whiskey has arrived; next comes the poor immigrant, with ax and hoe and rifle; next, the trader; next, the miscellaneous rush; next, the gambler, the desperado, the highwayman, and all their kindred in sin of both sexes; and next, the smart chap who has bought up an old grant that covers all the land; this brings the lawyer tribe; the vigilance committee brings the undertaker. All these interests bring the newspaper; the newspaper starts up politics and a railroad; all hands turn to and build a church and a jail — and behold! civilization is established forever in the land.</p>\n<p>But whiskey, you see, was the van-leader in this beneficent work. It always is. It was like a foreigner — and excusable in a foreigner — to be ignorant of this great truth, and wander off into astronomy to borrow a symbol. But if he had been conversant with the facts, he would have said: Westward the Jug of Empire takes its way. ”</p>\n</blockquote>\n<p>--</p>\n<p><em>If you have any questions or thoughts, don't hesitate to reach out. You can find me as <a href=\"http://twitter.com/viksit\">@viksit</a> on Twitter.</em></p>","excerpt":"I found this gem of a snippet today, and I rather agree with what it says! “How solemn and beautiful is the thought that the earliest pioneer of civilization, the van-leader of civilization, is never the steamboat, never the railroad, never the…","frontmatter":{"title":"Mark Twain on Whiskey and Civilization","date":"March 04, 2011","slug":"/blog/mark-twain-on-whiskey-and-civilization","tags":null}},{"id":"8bf58579-3920-5446-8054-0dca6dda2c74","html":"<p>A simple and effective way to read properties files in Clojure, since they transform into Clojure maps!</p>\n<deckgo-highlight-code   >\n          <code slot=\"code\">\n(into {} (doto (java.util.Properties.)\n         (.load (-&gt; (Thread/currentThread)\n         (.getContextClassLoader)\n         (.getResourceAsStream &quot;log4j.properties&quot;)))))</code>\n        </deckgo-highlight-code>\n<p>Next, to actually read this in, using atoms to swap the values like this seems to work,</p>\n<deckgo-highlight-code   >\n          <code slot=\"code\">\n(def *args* \n  (atom {:a 10, :b 20})) \n\n(defn -main  \n  (swap! *args* assoc :a (read) :b (read)))</code>\n        </deckgo-highlight-code>\n<p>--</p>\n<p><em>If you have any questions or thoughts, don't hesitate to reach out. You can find me as <a href=\"http://twitter.com/viksit\">@viksit</a> on Twitter.</em></p>","excerpt":"A simple and effective way to read properties files in Clojure, since they transform into Clojure maps! Next, to actually read this in, using atoms to swap the values like this seems to work, -- If you have any questions or thoughts, don't hesitate…","frontmatter":{"title":"Reading Java properties file in Clojure","date":"December 08, 2010","slug":"/blog/reading-java-properties-file-in-clojure","tags":null}},{"id":"685ec83c-ea9f-5981-9c92-3d7b386028f9","html":"<p>From this Wired article (<a href=\"http://www.fastsum.com/support/md5-checksum-utility-faq/md5-hash.php\">http://www.fastsum.com/support/md5-checksum-utility-faq/md5-hash.php</a>), it looks like there’s a number that is part of the cyber command’s logo – <strong>9ec4c12949a4f31474f299058ce2b22a</strong>. Well, its 32 characters long, and looks like a hash. Sure enough, a quick python check later of the organization’s mission statement with md5 results in,</p>\n<deckgo-highlight-code   >\n          <code slot=\"code\">\nimport hashlib\n&gt;&gt;&gt; hashlib.md5(&quot;USCYBERCOM plans, coordinates, integrates, synchronizes and conducts activities to: direct the operations and defense of specified Department of Defense information networks and; prepare to, and when directed, conduct full spectrum military cyberspace operations in order to enable actions in all domains, ensure US/Allied freedom of action in cyberspace and deny the same to our adversaries.&quot;).hexdigest()\n&#39;9ec4c12949a4f31474f299058ce2b22a&#39;</code>\n        </deckgo-highlight-code>\n<p>Voila!</p>\n<p>--</p>\n<p><em>If you have any questions or thoughts, don't hesitate to reach out. You can find me as <a href=\"http://twitter.com/viksit\">@viksit</a> on Twitter.</em></p>","excerpt":"From this Wired article (http://www.fastsum.com/support/md5-checksum-utility-faq/md5-hash.php), it looks like there’s a number that is part of the cyber command’s logo – 9ec4c12949a4f31474f299058ce2b22a. Well, its 32 characters long, and looks like a…","frontmatter":{"title":"Decoding the US Military's Cyber Command Logo code","date":"July 08, 2010","slug":"/blog/decoding-the-us-militarys-cyber-command-logo-code","tags":null}},{"id":"073a4238-23eb-5f71-9c06-575555464d62","html":"<p>In my last post, I was playing around with methods to serialize Clojure data structures, especially a complex record that contains a number of other records and refs. Chas Emerick and others mentioned in the comments there, that putting a ref inside a record is probably a bad idea – and I agree in principle. But this brings me to a dilemma.</p>\n<p>Lets assume I have a complex record that contains a number of \"sub\" records that need to be modified during a program's execution time. One scenario this could happen in is a record called \"Table\", that contains a \"Row\" which is updated (Think database tables and rows). Now this can be implemented in two ways,</p>\n<ul>\n<li><strong>Mutable data structures</strong> – In this case, I would put each row inside a table as a ref, and when the need to update happens, just fine the row ID and use a dosync – alter to do any modifications needed.\n<ul>\n<li>The advantage is that all data is being written to in place, and would be rather efficient.</li>\n<li>The <strong>disadvantage</strong> however, is that when serializing such a record full of refs, I would have to build a function that would traverse the entire data structure and then serialize each ref by dereferencing it and then writing to a file. Similarly, I'd have to reconstruct the data structure when de-serializing from a file.</li>\n</ul>\n</li>\n</ul>\n<deckgo-highlight-code   >\n          <code slot=\"code\"> \n{:filename &quot;tab1name&quot;,\n :tuples\n #&lt;ref :field=&quot;&quot; :tupdesc=&quot;&quot; nil=&quot;&quot;&gt;},\n      :tup #&lt;ref :name=&quot;&quot;&gt;}\n     {:recordid nil,\n      :tupdesc\n      {:x\n       #&lt;ref :field=&quot;&quot;&gt;},\n      :tup #&lt;ref :name=&quot;&quot;&gt;}}&gt;,\n :tupledesc\n {:x\n  #&lt;ref :field=&quot;&quot;&gt;}}\n\n\t&lt;/ref&gt;&lt;/ref&gt;&lt;/ref&gt;&lt;/ref&gt;&lt;/ref&gt;</code>\n        </deckgo-highlight-code>\n<ul>\n<li><strong>Immutable data structures</strong> – This case involves putting a ref around the entire table data structure, implying that all data within the table would remain immutable. In order to update any row within the table, any function would return a new copy of the table data structure with the only change being the modification. This could then overwrite the existing in-memory data structure, and then be propagated to the disk as and when changes are committed.\n<ul>\n<li>The advantage here is that having just one ref makes it very simple to serialize – simply de-ref the table, and then write the entire thing to a binary file.</li>\n<li>The <strong>disadvantage</strong> here is that each row change would make it necessary to return a new \"table\", and writing just the \"diff\" of the data to disk would be hard to do.</li>\n</ul>\n</li>\n</ul>\n<deckgo-highlight-code   >\n          <code slot=\"code\"> \n#&lt;ref :field=&quot;&quot; :name=&quot;&quot; :tup=&quot;&quot; :tupdesc=&quot;&quot; :tupledesc=&quot;&quot; :tuples=&quot;&quot; nil=&quot;&quot;&gt;\n\n&lt;p&gt;\nSo at this point, which method would you recommend?&lt;/p&gt;\n&lt;p&gt;&lt;/p&gt;\n&lt;/ref&gt;</code>\n        </deckgo-highlight-code>\n<p>--</p>\n<p><em>If you have any questions or thoughts, don't hesitate to reach out. You can find me as <a href=\"http://twitter.com/viksit\">@viksit</a> on Twitter.</em></p>","excerpt":"In my last post, I was playing around with methods to serialize Clojure data structures, especially a complex record that contains a number of other records and refs. Chas Emerick and others mentioned in the comments there, that putting a ref inside…","frontmatter":{"title":"Mutable vs Immutable datastructures - Serialization vs Performance","date":"June 20, 2010","slug":"/blog/mutable-vs-immutable-datastructures-serialization-vs-performance","tags":null}},{"id":"a052b4f6-9189-55b1-8ec1-d55e2bd161e0","html":"<p>I’ve been trying to figure out how best to serialize data structures in Clojure, and discovered a couple of methods to do so. (Main reference thanks to a thread on the Clojure Google Group (<a href=\"http://groups.google.com/group/clojure/browse_thread/thread/29a94dd74b8beaaa/a05b126b192195e9\">http://groups.google.com/group/clojure/browse_thread/thread/29a94dd74b8beaaa/a05b126b192195e9</a>) )</p>\n<deckgo-highlight-code   >\n          <code slot=\"code\">\n(def box {:a 1 :b 2})\n\n(defn serialize \n  (with-open \n    (.writeObject outp o)))\n\n(defn deserialize \n  (with-open \n    (.readObject inp)))\n\n(serialize box &quot;/tmp/ob1.dat&quot;)\n(deserialize &quot;/tmp/ob1.dat&quot;)</code>\n        </deckgo-highlight-code>\n<p>This works well for any Clojure data structure that is serializable. However, my objective is slightly more intricate – I’d like to serialize records that are actually refs. I see a few options for this,</p>\n<p>– Either use a method that puts a record into a ref, rather than a ref into a record and then use the serializable, top level map<br>\n– Write my own serializer to print this to a file using clojure+read<br>\n– Use Java serialization functions directly.</p>\n<p>Thoughts?</p>\n<p>--</p>\n<p><em>If you have any questions or thoughts, don't hesitate to reach out. You can find me as <a href=\"http://twitter.com/viksit\">@viksit</a> on Twitter.</em></p>","excerpt":"I’ve been trying to figure out how best to serialize data structures in Clojure, and discovered a couple of methods to do so. (Main reference thanks to a thread on the Clojure Google Group (http://groups.google.com/group/clojure/browse_thread/thread…","frontmatter":{"title":"Serializing Clojure Datastructures","date":"June 19, 2010","slug":"/blog/serializing-clojure-datastructures","tags":null}}]}},"pageContext":{"limit":5,"skip":95,"numPages":27,"currentPage":20}},
    "staticQueryHashes": ["4202924991","512065377"]}