Here are few things I learnt while coding in java: Increment an occurrence in map for(char current : input.toCharArray()){ count.put(current, count.getOrDefault(current, 0) + 1); } Let’s say you want to decrement the occurrence and when occurrence becomes zero, remove entry.Continue reading… Core Java: Programming code snippets frequently used
Core Java: ConcurrentModificationException while removing items from LinkedHashMap
I came across ConcurrentModificationException while editing LinkedHashMap which internally maintains order of the tuple. Below is my code to edit the map. It looks fine to me and no compilation errors too. But, during runtime I faced ConcurrentModificationException even thoughContinue reading… Core Java: ConcurrentModificationException while removing items from LinkedHashMap
Gas Station Problem
Difficulty: Medium Asked in: Amazon, Google Understanding The Problem Problem Description There are N gas stations along a circular route, where the amount of gas at station i is arr[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i toContinue reading… Gas Station Problem
HTTP methods (verbs)
REST endpoints become very popular in SaaS applications in recent times. We need to understand what http method used for what operation in general. The important HTTP methods are as follows: GET method requests data from the resource and should notContinue reading… HTTP methods (verbs)
Concurrency Vs Parallelism
Concurrency is when two or more tasks can start, run, and complete in overlapping time periods. It doesn’t necessarily mean they’ll ever both be running at the same instant. For example, multitasking on a single-core machine. Parallelism is when tasks literallyContinue reading… Concurrency Vs Parallelism
Core Java: Type Erasure
Part of polymorphism, we have method overloading is one form where methods can have same name with different parameter types. One such example would be below:- following are my method signatures – void mymethod(List<String> a, List<Integer> b); void mymethod(List<Integer> c,Continue reading… Core Java: Type Erasure
MySQL error – has exceeded the ‘max_questions’ resource in database
I had a similar issue on my WordPress site. It was hosted on a shared host. The host limits the connections per user to 25000 every hour. I see two possible solutions for this to get fixed. First Solution:- TheContinue reading… MySQL error – has exceeded the ‘max_questions’ resource in database
ORA-01194: file 1 needs more recovery to be consistent
Solution that worked for me. SQL> shutdown immediate ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 530288640 bytes Fixed Size 2131120 bytes Variable Size 310381392 bytes Database Buffers Continue reading… ORA-01194: file 1 needs more recovery to be consistent
Hanging issue in MI redmi Note 4
I’ve been facing some lagging & hanging issues in my new redmi note 4 device. After searching for the solution, i came across below trick which worked for me. Follow below steps to solve lagging and hang problems in XiaomiContinue reading… Hanging issue in MI redmi Note 4
java URL using relative path
I have a URL: URL url=new URL(“http://www.abc.com/aa/bb/cc/file.html”); and a relative path: String relativePath=”../file2.html”; //maybe is “/file3.html” I want to get http://www.abc.com/aa/bb/file2.html using variable url and relativePath How to do it? This is very frequent requirement you see if you are dealing with webservices development. OneContinue reading… java URL using relative path