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
Category: Programming
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
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
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
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
JDBC programming inputs
While doing jdbc programming, following API interface would be very useful to program generic manner for all jdbc supported databases. Interface DatabaseMetaData exposes many methods which we’ll use for jdbc programming. For more info on this, you can refer toContinue reading… JDBC programming inputs
Introduction to basic ODBC programming
Sample program to write basic odbc program to connect/ query/ disconnect with unicode data. //— BEGIN PROGRAM SOURCE #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <sqlext.h> int DBP_SQLSERVER = 1; int DBP_DB2 = 0; int DBP_POSTGRES = 0; #define ENVContinue reading… Introduction to basic ODBC programming