Posts
Oracle to Mysql Migration
ifnull <=> nvl
Oracle: select nvl(null,1) from dual;
Mysql: select ifnull(null,1) from dual;
dual is optional in mysql. Oracle needs a ‘from expression’ for all the queries. Dual table is just a dummy to serve that syntax
desc dual; Name Null Type ------------------------------ -------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- DUMMY VARCHAR2(1) fetching rownum in oracle and mysql
Oracle: select rownum, $column from $table (rownum is a pseudocolumn in oracle)
Mysql: select row_number() over() as row_num, $column from $table SET @rownum:=0; SELECT @rownum:=@rownum+1 AS rownum, $column FROM $table (for older mysql versions)
read morePosts
What is ELK stack
What is ELK stack? Instead of writing about what exactly ELK is, let me state the need and use cases for it.
Log aggregation and efficient searching
In a very naive scenario you have one server and lots of log messages generated by your application and system which are crucial to look at once something goes wrong. Now there are basically two problems with it: Manually digging through a log file is really an anachronism.
read morePosts
On Domain And DNS
This github page
This blog is a github page based on jekyll now and the URL as per github convention is sudipbhandari126.github.io (It’s username.github.io) unless you set up a custom domain.
As of Jan 2020, I have a custom domain setup for this at www.sudipbhandari.wtf. I had some insights into internet domains, dns and domain resolution while doing this activity.
How are domains organized?
All the internet domains are organized in a hierarchical fashion.
read morePosts
On Code Readability
Almost everyone starts off coding in a very imperative fashion. You figure out the rules, syntax of the language and you figure out the logical solution to the problem and start off coding. As you start doing so you discover some idiosyncracies of the language and you start focusing on making the code more and more ‘concise’. If unchecked this can lead to obfuscation where you just increase the cognitive load of the program.
read morePosts
How git stores changes
Git stores snapshots of the directory content at the moment. (Contrast older VCS systems which just capture the changelog) If files haven’t changed it just points to the previous version.
We can check the content of the commit blob. It’s stored in .git/objects. It’s stored as a compressed zlib file.
~/projects/my-project/.git/objects/1a(my-branch) » pigz -d < 58989906551da9cd7f2395c640e0b90667aa27 commit 677tree f1c83252e98f54138359308ef247193bf4e0bef4 parent 1747b1d081167971b9612ad75862943e8a9f344c author Mister Author <mister-author@host.com> 1567673031 +0000 committer Mister Author <mister-author@host.
read morePosts
Curious Case of super huge syslog
The Problem:
Insufficient memory left on /root partition.
On inspection I found that it was happening because /var/log was growing till 35 GB (I have a root partition of 50 GB).
On further inspection I found that /var/log/syslog was huge
Following was the repeating line (error log that would quickly fill up my disk space)
Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.gnome.Shell.desktop[1399]: Error: /bin/java not found Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.gnome.Shell.desktop[1399]: Error: /bin/java not found Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.
read morePosts
Infrastructre as Code (IaC)
How it came to be? Traditionally setting up infrastructure for the code to run (think: servers, network configurations, etc) has been a manual task.
People started using SOP (Standard Operating Procedure) in order to mitigate errors and risk (by listing down all the actionable items) but it’s still error-prone.
Enter, Infrastructure as code.
This is an attempt to abstract the tangible aspects of software (hardware it runs on, configurations and network it uses, etc).
read morePosts
Good Object Modelling
OOP is all about Encapsulation Yes, that’s right. Object Oriented Programming aims to encapsulate properties and methods into a consolidated object so that’s operations can be carried out on the object. The whole aim was to move from procedural functions which were not easy to reason about and prove correctness. But this principle often gets violated and people write procedural code using objects. Classic Example is:
class Rectangle { private Long length; private Long breadth; //gettters //setters //constructors } And caller calculates area by:
read morePosts
Slack WebHook, A use case
Linux Terminal Controlled Slack WebHook This is a simple use case of slack webhooks. Slack webhooks can be configured to send messages when some events occur, i.e. we trigger the hook and the hook sends the message to slack channel configured.
I have set up a workspace (for my own personal experimentations) and created a webhook which is a fairly simple process. Web Hook can be called via HTTP POST call with required message.
read morePosts
21 Lessons (Book Review)
21 lessons for the 21st Century (Book Review) 21 Lessons for the 21st Century by Yuval Noah Harari My rating: 5 of 5 stars We live in an extremely complicated world. It’s so difficult to make sense even of the tiniest realm of our lives. Religious dogma, political gambles, economic disparity, an ever-increasing gap between poor and rich, promises and dangers of new technologies like Machine learning and artificial intelligence form the most confusing crossroad in all of the recorded human histories so far.
read more