<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>grokking hard</title><link>https://grokhard.com/</link><description>Recent content on grokking hard</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 11 Jun 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://grokhard.com/index.xml" rel="self" type="application/rss+xml"/><item><title>I finally found a good use case of Java Local Class</title><link>https://grokhard.com/posts/2023-06-11-i-finally-found-a-good-use-case-of-java-local-class/</link><pubDate>Sun, 11 Jun 2023 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2023-06-11-i-finally-found-a-good-use-case-of-java-local-class/</guid><description>A Basic Problem Today I needed to come up with a method to mask some certain string (as Apache&amp;rsquo;s Common Lang&amp;rsquo;s StringUtils did not support it yet).
The masking logic is simple though:
If the length is smaller than 2, mask everything. If the length is up to 5, show first and last characters. If the length is up to 12, show the first two and last two characters. Otherwise, show the first four and last four characters.</description></item><item><title>Trying out NetworkPolicy on Kubernetes running on Docker for macOS</title><link>https://grokhard.com/posts/2023-01-16-trying-out-networkpolicy-on-kubernetes-running-on-docker-for-macos/</link><pubDate>Mon, 16 Jan 2023 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2023-01-16-trying-out-networkpolicy-on-kubernetes-running-on-docker-for-macos/</guid><description>A problem I was tempting to try out NetworkPolicy on Kubernetes as a secure way to protect traffic in and out the namespaces but never managed to actuall do it.
Today a friend of mine who was pursuing &amp;ldquo;Certified Kubernetes Application Developer&amp;rdquo; asked me a problem related to it. He was using a small set of exercises to practice Kubernetes. The problem statement was:
Create an nginx deployment of 2 replicas, expose it via a ClusterIP service on port 80.</description></item><item><title>Convert checksum between Hex and Base64 using CLI</title><link>https://grokhard.com/posts/2022-12-02-convert-checksum-between-hex-and-base64-using-cli/</link><pubDate>Fri, 02 Dec 2022 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2022-12-02-convert-checksum-between-hex-and-base64-using-cli/</guid><description>Checksums produced by SHA1, SHA2 are usually in hex format. However, there also come in base64. I just discovered a way to convert between the two.</description></item><item><title>Download File and Verify Checksum in Bash</title><link>https://grokhard.com/posts/2022-01-07-download-file-and-verify-checksum-in-bash/</link><pubDate>Fri, 07 Jan 2022 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2022-01-07-download-file-and-verify-checksum-in-bash/</guid><description>I had a need to download a gzip tarball file (.tgz), verify its checksum and extract one particular file in it. All in one go using Bash. By using Bash&amp;rsquo;s process substitution and tee, such a task could be achieved in a one-liner.
I had this need when I built a Docker image for Retype, a static site generator from Markdown files. Retype was not a pure Node.JS package. The NPM package was just a CLI wrapper for the actual binary built using .</description></item><item><title>MongoDB failed to lock file on OpenShift using NFS file system</title><link>https://grokhard.com/posts/2021-09-27-mongodb-failed-to-lock-file-on-openshift-using-nfs-file-system/</link><pubDate>Mon, 27 Sep 2021 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2021-09-27-mongodb-failed-to-lock-file-on-openshift-using-nfs-file-system/</guid><description>This page documented the investigation of an issue: MongoDB Pod failed to lock &lt;code>mongod.lock&lt;/code> on OpenShift/OKDv4.
The problem was because NFSv3 was used to mount between OKDv4 Worker Nodes to the NFS server. MongoDB used internally &lt;code>flock/fcntl&lt;/code> to lock the &lt;code>mongod.lock&lt;/code> file descriptor. In a network file system like NFSv3, locking support was required from both server and client, otherwise, a &amp;ldquo;No locks available&amp;rdquo; would be the outcome. NFSv4, on the other hand, came with built-in support for locking as specified in the protocol. Changing to mount using only NFSv4 solved the problem, but there were more than just that.</description></item><item><title>The Collector's Fallacy  - Zettelkasten Method</title><link>https://grokhard.com/posts/2021-06-16-the-collectors-fallacy-zettelkasten-method/</link><pubDate>Wed, 16 Jun 2021 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2021-06-16-the-collectors-fallacy-zettelkasten-method/</guid><description>On researching taking notes, speciffically the Zekkelkasten method, I learned The Collector&amp;rsquo;s Fallacy.
In its essenses:
Saving links, copying or just reading a material does not mean that you have consumed the knowledge. You may have increased the knowlege for a short time, but it will fade away very soon after that. By taking notes, or making a Zettel, to summarize again what you understood, you then actually can reaffirm the newly acquired knowledge.</description></item><item><title>Goes back quicker in Terminal</title><link>https://grokhard.com/posts/2021-03-08-goes-back-quicker-in-terminal/</link><pubDate>Mon, 08 Mar 2021 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2021-03-08-goes-back-quicker-in-terminal/</guid><description>I made a shell alias to easily cd back to multiple levels of parent directories</description></item><item><title>Less well-known uses of curl</title><link>https://grokhard.com/posts/2020-10-13-less-well-known-uses-of-curl/</link><pubDate>Tue, 13 Oct 2020 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2020-10-13-less-well-known-uses-of-curl/</guid><description>When it comes to make HTTP calls, I always use &lt;code>curl&lt;/code> as it is a ubiquitous tool for the job. Today, I discover that I can use &lt;code>curl&lt;/code> for some other tasks.</description></item><item><title>Convert Git to Git LFS</title><link>https://grokhard.com/posts/2020-09-16-convert-git-to-git-lfs/</link><pubDate>Wed, 16 Sep 2020 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2020-09-16-convert-git-to-git-lfs/</guid><description>There are some Git repositories in the company contain mostly binary files (Words, Excel, PDFs, etc). As Git is not designed to track binary files effectively, eventually the repository ends up pretty large (over 2GB) and will become a PITA on git clone.
In order to effectively solves this, switching a regular Git to Git LFS. This post aims to show you how to do it.
Prerequisites Remote Git Server MUST support Git LFS (GitHub, GitLab and BitBucket all supports LFS) git (&amp;gt;=2.</description></item><item><title>TIF - Powerful SSH #1</title><link>https://grokhard.com/posts/2020-04-01-powerful-ssh-1/</link><pubDate>Wed, 01 Apr 2020 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2020-04-01-powerful-ssh-1/</guid><description>Recently, I discovered that SSH have some wonderful features and usages that I didn&amp;rsquo;t know before.
Faster copying directories with rsync via SSH When it comes to copying files back and forth to a remote server, I usually go for scp.
1 $&amp;gt; scp hello.txt remote_user@server.example.com:/tmp/ scp even supports to copy a whole directory:
1 $&amp;gt; scp -r files/ remote_user@server.example.com:/tmp Not until recently, a colleague of mine, Alex, taught me that using rsync happens to be faster than scp when it comes to syncing directories between local and remote server.</description></item><item><title>grokhard.com and others</title><link>https://grokhard.com/posts/2020-02-15-grokhard-com-and-others/</link><pubDate>Sat, 15 Feb 2020 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2020-02-15-grokhard-com-and-others/</guid><description>So this year, 2020, I decided to retire the domain &amp;ldquo;genzerhawker.me&amp;rdquo;. I hardly used it through the years and I didn&amp;rsquo;t write a lot on the blog.
But it was not the end. I bought the domain grokhard.com from GoDaddy and map it with my Wordpress.com blog. An investment in building my brand.
The domain costs me $19 for 2 years. I also had to subscribe to Wordpress Personal plan at the cost of $48/year.</description></item><item><title>Sending Messages to Yourself on Skype</title><link>https://grokhard.com/posts/2018-01-31-sending-messages-to-yourself-on-skype/</link><pubDate>Wed, 31 Jan 2018 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2018-01-31-sending-messages-to-yourself-on-skype/</guid><description>I always like a simple feature in Slack that you can chat with yourself to store notes, links, files or your own reminders. Despite that fact that I use it most of the time, this feature doesn&amp;rsquo;t exist in Skype, and I really hate it.
Turns out there is a simple trick to do it that I happened to discover yesterday:
On Skype, create a new group chat with only you in there.</description></item><item><title>Today I Found: Bill Gates's message for college grads if they want to change the world.</title><link>https://grokhard.com/posts/2017-05-25-today-i-found-bill-gatess-message-for-college-grads-if-they-want-to-change-the-world/</link><pubDate>Thu, 25 May 2017 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2017-05-25-today-i-found-bill-gatess-message-for-college-grads-if-they-want-to-change-the-world/</guid><description>In his letter, Bill Gates wrote that he was lucky because he started his venture at the right time, when the digital revolution was just underway, and the young people at that time had had a great opportunity to shape it.
Today, college graduates have also the same chance with these fields:
If I were starting out today and looking for the same kind of opportunity to make a big impact in the world, I would consider three fields.</description></item><item><title>Today I Found: Soft-Coding &amp;amp; #1 Deadly Sin of Programmers</title><link>https://grokhard.com/posts/2017-05-17-today-i-found-soft-coding-1-deadly-sin-of-programmers/</link><pubDate>Wed, 17 May 2017 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2017-05-17-today-i-found-soft-coding-1-deadly-sin-of-programmers/</guid><description>A question on StackOverflow, What is Soft-Coding (anti-pattern), introduced me to the term soft coding (a pun to hard coding).
Below is a quoted code snippet of the accepted answer:
1 2 3 4 5 6 7 SpecialFileClass file = new SpecialFileClass(200); // hard coded SpecialFileClass file = new SpecialFileClass(DBConfig .Start() .GetConnection() .LookupValue(&amp;#34;MaxBufferSizeOfSpecialFile&amp;#34;) .GetValue()); Too much of anything is not good. The above is not an exception. Too much of flexibility leads to over-engineering.</description></item><item><title>Friends are like genes?</title><link>https://grokhard.com/posts/2017-04-30-friends-are-like-genes/</link><pubDate>Sun, 30 Apr 2017 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2017-04-30-friends-are-like-genes/</guid><description>When I read the book &amp;ldquo;The Magic of Thinking BIG&amp;rdquo;, chapter 7 &amp;ldquo;Manage your environment: Go First Class&amp;rdquo;, a thought emerged into my head: friends are like genes.
When a baby was born, it is a product of genetic combinations of both the parents&amp;rsquo;. The differences between the parents&amp;rsquo; genes will produce a brand new one. If, for example, the parents are siblings or close relatives (just for the sake of demonstration), and their children also continue to mate and give births, their children are very likely to have high risk of gene disorders.</description></item><item><title>Interesting Reads in Morning 28.9</title><link>https://grokhard.com/posts/2016-09-27-morning-28-9/</link><pubDate>Wed, 28 Sep 2016 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2016-09-27-morning-28-9/</guid><description>A few links that I found after reading around on the Internet on a 28-Sept morning</description></item><item><title>How to iterate over a Collection in Java?</title><link>https://grokhard.com/posts/2016-05-26-how-to-iterate-over-a-collection-in-java/</link><pubDate>Thu, 26 May 2016 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2016-05-26-how-to-iterate-over-a-collection-in-java/</guid><description>Several ways to iterate over a Java &lt;code>Collection&lt;/code> in Java 8</description></item><item><title>Passion</title><link>https://grokhard.com/posts/2015-11-05-passion/</link><pubDate>Thu, 05 Nov 2015 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2015-11-05-passion/</guid><description>My girlfriend shared me an interesting video tonight. It recorded a situation happened in a hospital in which the nurse and the doctor were trying to save a new born baby. The little one seemed to stop breathing. What moved me was how persistent the nurse and the doctor were to save the baby. The nurse, an old lady, tried to warm up the baby&amp;rsquo;s body by putting on oil, then slapped him in order to make him cry.</description></item><item><title>Big Data and its application?</title><link>https://grokhard.com/posts/2014-06-15-big-data-and-its-application/</link><pubDate>Sun, 15 Jun 2014 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2014-06-15-big-data-and-its-application/</guid><description>I &amp;amp; my girlfriend was coming back to our hometown, Bien Hoa city. As usual, every time I was in motion, I always have some really deep thought.
When she &amp;amp; I was discussing about how we could invest money by buying gold and then selling again to make some profit, a thought came to me that we can develop a algorithm that can analyze the up &amp;amp; down of gold market and predict when should buy and when we should sell gold to make the best profit.</description></item><item><title>Knowing Your Code's Structure</title><link>https://grokhard.com/posts/2014-05-30-knowing-your-codes-structure/</link><pubDate>Fri, 30 May 2014 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2014-05-30-knowing-your-codes-structure/</guid><description>I haven&amp;rsquo;t paid much attention to how the classes in my projects communicate with each other. Looking at the package structure, they all look good and well-organized. Then one day, I came across the article Your Code Structure and it made me to seriously think about re-validate my source code.
In the article, Edmund Kirwan used his tool, named Spoiklin Soice, to analyze the modules of JUnit from the early version to the latest one.</description></item><item><title>Prepare to Getting Real</title><link>https://grokhard.com/posts/2014-05-26-prepare-to-getting-real/</link><pubDate>Mon, 26 May 2014 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2014-05-26-prepare-to-getting-real/</guid><description>I&amp;rsquo;m bored tonight. So I go to my bookmark bar to see whether there is something I can read. Bingo! I came across the @freebook folder and click on Getting Real. This is a free version of 37signal&amp;rsquo;s book, Getting Real where it talk about how to quickly and efficiently start up a new software product which solve the problem from the begining. Start small, focus and efficient. I will continue to read it tomorrow.</description></item><item><title>Agile toolkits</title><link>https://grokhard.com/posts/2013-12-10-agile-toolkits/</link><pubDate>Tue, 10 Dec 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-12-10-agile-toolkits/</guid><description>My current company is using Scrum to develop softwares. To me, it is a set of practices and tools which enhances communication, collaboration, trusts, etc between members of a team. What people are still debating is that, which one, Scrum or Lean is better. I said, why not both? To me, the term Agile has been broaderned to bear many meanings. It points to a lot of processes. But under the hood.</description></item><item><title>Why there is no SoftHashMap?</title><link>https://grokhard.com/posts/2013-12-09-why-there-is-not-softhashmap/</link><pubDate>Mon, 09 Dec 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-12-09-why-there-is-not-softhashmap/</guid><description>The above question bumped into me when I was developing a simple cache using java.util.Map. In the search for the answer, I came across a thread on JavaRanch that had the same question as mine. And there was an answer which had widen my knowledge in soft/weark references in Java.
I quoted the answer here in case the link is inaccessible.
In the few cases, where I used weak references (or soft references), I used the classes, (and queues) directly.</description></item><item><title>My father is a ...</title><link>https://grokhard.com/posts/2013-09-22-my-father-is-a/</link><pubDate>Sun, 22 Sep 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-09-22-my-father-is-a/</guid><description>I found this on an anwer on Quora: http://www.quora.com/Writing/What-should-everyone-know-about-writing.
My father is a writer. A good one. His name is Marc Norman.
He wrote Shakespeare In Love and a hundred other scripts and novels and has two oscars on his mantle.
He told me this about writing&amp;hellip;
It&amp;rsquo;s a full time job. To be successful you must be disciplined. You do it from nine to five, five days a week. Focus on your work for forty hours and put it away at night and on the weekends.</description></item><item><title>SQL isn't dead. JooQ is a new fresh thing</title><link>https://grokhard.com/posts/2013-09-07-sql-isnt-dead-jooq-is-a-new-fresh-thing/</link><pubDate>Sat, 07 Sep 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-09-07-sql-isnt-dead-jooq-is-a-new-fresh-thing/</guid><description>After working with 3 layers, DAO, JPA and Hibernate and stuff, I think writing native SQL code is going to disappear. However, til today, I just found a new framework that support you to write SQL command by Java code. Their fluent API is so good that it seems identical with real SQL command.
Check out JOOQ - Java Object Oriented Querying;
http://www.jooq.org/
P.s: Guess what! It&amp;rsquo;s type-safe.</description></item><item><title>Little things matter</title><link>https://grokhard.com/posts/2013-06-19-little-things-matter/</link><pubDate>Wed, 19 Jun 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-06-19-little-things-matter/</guid><description>Today, I&amp;rsquo;ve read a entry in Quora that actually Made Me Thing (MMT). It was a survey &amp;ldquo;What is the nicest thing anyone has ever done to you?&amp;rdquo; and there was a man writing that some woman had helped him back when he was travelling in Swizertland and making his way to his home in Rome. The woman had spent over 2 hours to sit with him, hopping trains in order to make sure he got home safe.</description></item><item><title>bookmarking + mind mapping</title><link>https://grokhard.com/posts/2013-06-16-bookmarking-mind-mapping/</link><pubDate>Sun, 16 Jun 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-06-16-bookmarking-mind-mapping/</guid><description>Recently, I&amp;rsquo;ve been using an interesting and useful free online service, GetPocket which helps me to bookmark articles, papers, webpages, etc to read it later. The service even extracts the content and displays it in elegant format. It even allows me to tag, search, add favorite, etc. In short, it&amp;rsquo;s cool.
I&amp;rsquo;ve been bookmarking a lot of good articles and links that I&amp;rsquo;m interested and plan to read them on my free time.</description></item><item><title>Bugs lie in uncertain code</title><link>https://grokhard.com/posts/2013-05-31-bugs-lie-in-uncertain-code/</link><pubDate>Fri, 31 May 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-05-31-bugs-lie-in-uncertain-code/</guid><description>Today after having lunch, I went around articles queue in order to read one or two.While reading the Architecture-Breaking Bugs, a lot of articles I had read before came back to my mind.
The content of article was about flaws in the architecture which the engineers often overlooked then later on they turned out disasters. There was a link to another article which told the story of Airline 5 and how it crashed because only 1 bug at 1 line of code.</description></item><item><title>The Humble Dialog Box and Ivy Rich Dialogs</title><link>https://grokhard.com/posts/2013-05-12-the-humble-dialog-box-and-ivy-rich-dialogs/</link><pubDate>Sun, 12 May 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-05-12-the-humble-dialog-box-and-ivy-rich-dialogs/</guid><description>Today I&amp;rsquo;ve read The Humble Dialog Box of Micheal Feather and it is very interesting. The idea of the article, in Model-View-Controller (MVC) pattern, is to develop in test-first manner the Model in the beginning. All actions, all interactions should be developed and tested against the mockable interface of the View. By doing this, all the logic are encapsulted in the Model (smart object) and the View provides methods for the Model to update.</description></item><item><title>Greatness!</title><link>https://grokhard.com/posts/2013-04-06-greatness/</link><pubDate>Sat, 06 Apr 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-04-06-greatness/</guid><description>Today, when I was riding around the city with my girlfriend as usual, I suddenly realized an important thing and then I asked her:
Kiddie, do you remember a genius who was very poor when he was a child? He had to gather fireflies to make a lamp in order to read books [1]? And another musical genius who had volunteered to serve for free in a theater in order to practice his skills?</description></item><item><title>Homeless Constants</title><link>https://grokhard.com/posts/2013-01-12-homeless-constants/</link><pubDate>Sat, 12 Jan 2013 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2013-01-12-homeless-constants/</guid><description>Today, one of my colleague came to me and asked: &amp;ldquo;Hey, do we have a place to put a general constant?&amp;rdquo;. &amp;ldquo;What?&amp;rdquo; - I said. &amp;ldquo;A class, you know, to put all constants that do not particularly belong to anywhere, something general&amp;rdquo; - He replied. Then I looked at him and said: &amp;ldquo;Dude, we got nothing such as general constants&amp;rdquo;.
The sad truth is, in our current project, we got a class named GeneralConstants just for putting all those constants in it.</description></item><item><title>Thoughts when reading How to Win Friends and Influence People</title><link>https://grokhard.com/posts/2012-06-26-thoughts-when-reading-how-to-win-friends-and-influence-people/</link><pubDate>Tue, 26 Jun 2012 00:00:00 +0000</pubDate><guid>https://grokhard.com/posts/2012-06-26-thoughts-when-reading-how-to-win-friends-and-influence-people/</guid><description>After reading section &amp;ldquo;Twelve Ways to Win People to Your Way of Thinking&amp;rdquo;, I recalled that I&amp;rsquo;ve applied the principle &amp;ldquo;Start with questions to which the other person will answer yes&amp;rdquo; months ago with one of my colleagues.
At that time, my team was working on a project with another team, they started first and later we joined. At first, the way we created &amp;amp; updated the database actually sucked. The first time when I looked at the sql files, I had no idea how to run those.</description></item><item><title>About</title><link>https://grokhard.com/about/</link><pubDate>Sat, 23 Jun 2012 00:00:00 +0000</pubDate><guid>https://grokhard.com/about/</guid><description>My name is Genzer Hawker (not my real name obviously).
I&amp;rsquo;m a software developer living in Vietnam. This blog is a place where I publish my thoughts and some technical stuff that I think may be helpful for other fellow developers.
Like most software developers, I do have a GitHub profile (not so many repos though) and I tweet at handle @genzerhawker.
And of course, every developer has a StackOverflow account.</description></item></channel></rss>