Author: Raj

  • CSS Flip Animation for Font Awesome Icons

    CSS Flip Animation for Font Awesome Icons

    This flip animation will be a perfect use-case for enable/disable UI actions. We’ll be using rotateY transform function to achieve this flip animation. Here is a simple HTML page with a few font awesome icons in both enabled and disabled states (we’ll be adding CSS for these states later) and jquery included for click actions.…

  • Shrinking indices in Elasticsearch

    The Problem Today, we started receiving the following error from our production Elasticsearch cluster when a new index was about to be created: The error description was obvious that we would breach the shard limit of 1,000 when creating a new index. Confirming the number from the error message using _cat/shards endpoint, we see that…

  • Static Websites with AWS CloudFront and S3

    Why CloudFront & S3 is better for hosting static sites? AWS CloudFront is a CDN that can be used to serve static HTML sites backed by S3 storage. S3 storage is very cheap. Combined with CloudFront, you can make your sites serve in low latency speeds. Deploy to S3 and start CloudFront cache invalidation Why…

  • MojoFailureException: Fix Maven’s Compilation Failure:

    Today, I faced a compilation failure in Bitbucket pipelines for a simple Java project. The project compiles successfully in the local machine. The stack trace of the failure was not useful at all: The stack trace doesn’t report any file names or lines numbers. This means the compilation error is not with the source code…

  • IntelliJ – Connect to MySQL running in Vagrant

    IntelliJ – Connect to MySQL running in Vagrant

    The Database feature of IntelliJ/PHPStorm is very powerful compared to the MySQL CLI. It allows your edit your data from the UI easily without writing any MySQL commands. Here is how you can connect your MySQL server running in a vagrant machine to the IntelliJ’s database feature and improve your productivity during development. Create a…

  • React – Render String with HTML tags as HTML

    There are often times when you have a string with some HTML tags such as strong that you want to render as HTML on the DOM. Most solutions online recommend using dangerouslySetInnerHTML but that is dangerous as the name suggests. The proper way to render HTML from string is to use FormattedMessage from the formatjs…

  • Debug slow PHP applications using IntelliJ or PHPStorm

    It is frustrating when your PHP application is really slow and you do not know which part of your code is taking up too much time. Google considers 2 seconds as the optimal loading time for a fast loading website. Enabling PHP XDebug Profiler PHP’s Xdebug extension can be used to profile your web requests…

  • 5 Reasons MySQL Foreign Key constraints fail to create

    Finding out why Foreign key creation fail When MySQL is unable to create a Foreign Key, it throws out this generic error message: ERROR 1215 (HY000): Cannot add foreign key constraint – The most useful error message ever. Fortunately, MySQL has this useful command that can give the actual reason about why it could not…

  • jQuery DataTable: Sorting dynamic data

    jQuery DataTable is a powerful library to super charge your HTML tables. By default DataTable can sort your data based on the content of the cells. But if you are loading your table data dynamically and want to apply a custom sorting based on the DOM data, you can use DataTable’s custom sorting code: data-sort…

  • Avoiding Wildcard imports in Java/Kotlin with IntelliJ

    What is a wildcard import or a star import? When you want to import multiple classes from the same package like this: Java has an option to combine them into a single line using wildcard imports: Is it bad? Performance-wise, no. Using a wildcard import doesn’t actually import all the classes in the package. When…