Vishrant

1

votes
2

answer
352

views

Comparing objects and its member variable

Suppose I have two objects of same class for example: public class Example { String name; String rollNo; String address; String phoneNo; String city; } Example obj1 = new Example(); obj1.name = 'Name'; obj1.rollNo = '10'; obj1.address = 'Address'; obj1.phoneNo = 'Phone Number'; obj1.city = 'City'; E...
Vishrant
1

votes
0

answer
41

views

Kubernetes blocking exec into pods?

For security purpose, I want to disable exec into pods, is there a kubernetes property that I can use, one why I thought was to disable user login on OS level.
Vishrant
1

votes
2

answer
1.9k

views

move multiple images from one canvas to other canvas

There is an example given at http://www.rgraph.net/blog/2013/january/an-example-of-html5-canvas-drag-n-drop.html I am not able to add multiple images into canvas 1 and move those added images to canvas 2. Also I should be able to drag(move the added image within canvas 2) those added images in secon...
Vishrant
1

votes
2

answer
3.5k

views

how to display image which is outside server directory in strtus

This question is continuation to my previous question Accessing External Files Into Our Web Application, actually I am uploading file using struts tag But now I wanted to show the uploaded images from that location but I am getting src location as http://localhost:9443/D:/resources/images/img1.jpg...
Vishrant
1

votes
2

answer
197

views

Boxing of null value is allowed then why unboxing is not allowed?

I was reading jls §5.1.7 and it says that there are 9 types of boxing, 9th one being Boxing From the null type to the null type Then I read that Unboxing Conversion of null throws a NullPointerException. Ok that is obvious. Then why boxing of null does not throws a NullPointerExceptionand what is t...
Vishrant
1

votes
1

answer
938

views

What does “System library (added to the boot class path)” means in Eclipse?

What is the meaning of 'System library (added to the boot class path)' when we create user library in Eclipse.
Vishrant
1

votes
2

answer
84

views

CSS is removed after server response

I want to implement some thing like here in my menu. Code: About MHG Workout Programs Fitness Tips Contact Us Read Our Blog $('a.menu').click(function(){ $('a.menu').removeClass('active'); $(this).addClass('active'); }); I have tags in my page but on clicking these tags request goes to se...
Vishrant
1

votes
2

answer
4.4k

views

How to set variable values to specific cell or element in BIRT

I have declared variable in beforeFactory of BIRT Report. For example: This variable I am incrementing in table row render like: Now when all the rows are rendered I want to set above variable to specific cell/ element. I tried document.getElementName('numberOfMobilityFilesProcessed').text = numbe...
Vishrant
1

votes
1

answer
198

views

Getting JDBC drivers compatibility issue. java.sql.SQLException: ORA-06413: Connection not open

I am getting below exception with Oracle JDBC ojdbc14_g.jar drivers: java.sql.SQLException: ORA-06413: Connection not open. My Oracle version is: My machine and server details are: I am able to connect to production DB from my development environment, but after installing application in production s...
Vishrant
1

votes
1

answer
368

views

Does loading thousands of class in JVM impact performance on method execution

I have created a Bean lets say com.session.implementation.MathOperationBean and in that MathOperationBean lets say there are method add. Now in my current company it is required to create one more such Bean file (its a long story so can not explain here why one more Bean is required) lets call that...
Vishrant
1

votes
1

answer
943

views

Bower: Error: EPERM: operation not permitted

After running bower install no libraries are getting downloaded and I am getting Error: EPERM: operation not permitted. I tried this on windows.
Vishrant
1

votes
2

answer
462

views

GraphQL with RESTful returning empty response

I am connecting GraphQL with REST endpoints, I confirmed that whenever I am calling http://localhost:3001/graphql it is hitting REST endpoint and it is returning JSON response to GraphQL server, but I am getting an empty response from GraphQL server to GUI as follows: { 'data': { 'merchant': { 'id':...
Vishrant
1

votes
1

answer
0

views

Error: requirements.lock is out of sync with requirements.yaml

I have following dependency in requirement.yaml file: dependencies: - name: redis version: 0.1.2 repository: http://helm-charts.repo:8800/ requirements.lock: dependencies: - name: redis repository: http://helm-charts.repo:8800/ version: 0.1.2 digest: sha256: generated: helm dependency build is gi...
Vishrant
1

votes
2

answer
1.7k

views

How to set generic parameter to Query object of Hibernate?

I have created a generic method which will take hibernate named query, a HashMap object which contain parameter name values for that named query in the following manner: The method signature is: public static ArrayList getData(String hibernateQueryName, HashMap queryNameValue) throws Exception; No...
Vishrant
1

votes
1

answer
208

views

Why blocksize in HDFS is consistent in all the DataNode?

In continuation to question: data block size in HDFS, why 64MB? I know that blocksize in HDFS is consistent/same in all the Data Node (size depends on configuration) in a distribution. My question is: Why this blocksize is kept consistent in all the NameNode? I am asking this questions because, let...
Vishrant
1

votes
1

answer
144

views

AutoWiring with constructor, how IOC will select constructor among multiple constructor [duplicate]

This question already has an answer here: Dependency injection with autowire=“constructor” when multiple constructors are present? 2 answers I have three beans: Movie, Director, Hero Movie bean: public class Movie { private Director director; private String name; private Hero hero; public Movi...
Vishrant
1

votes
1

answer
412

views

Kubernetes security context runAsUser

I have multiple containers and want to run all the containers as a non-root user, I know adding securityContext will help me, but do I need to add securityContext in all the containers or adding it in specs level will help? spec: template: metadata: Test image spec: securityContext: runAsUser: 1000...
Vishrant
1

votes
3

answer
62

views

What will be the output and why ArrayList/ any Collection behave like this?

Say below is my bean class: public class Employee { private String name = null; public String getName() { return name; } public void setName(String name) { this.name = name; } } This is my main class: import java.util.ArrayList; public class MainClass { public static void main(String[] args) { Emplo...
Vishrant
2

votes
0

answer
613

views

How to add users in keycloak using RESTFul API with POSTMAN?

I want to use keycloak as a broker server for Identity and Access Management and I don't want to use login screen provided in keycloak as I have different clients like Android, IOS and web application using the same backend server. I wan't to know if it is possible to create user, accept terms and c...
Vishrant
17

votes
3

answer
1k

views

How to restrict that subclass cannot be generic?

Compile time error: The generic class may not subclass java.lang.Throwable public class TestGenericClass extends Exception { /*Above line will give compile error, the generic class TestGenericClass may not subclass java.lang.Throwable*/ public TestGenericClass(String msg) { super(msg); } } Above co...
Vishrant
1

votes
5

answer
1.8k

views

Declaration of wrapper classes

This question is in continuation to a question How can a string be initialized using ' '? I would like to raise your attentation that even Integer, Double, Character, Float, Boolean wrapper class can also be declared in the same way String is declared like: String s = 'Test string' Integer i = 10; /...
Vishrant
5

votes
1

answer
236

views

Example 8.1.2-1 Of Java Language Specification(Mutually Recursive Type Variable Bounds)

I was reading jls 8 and I got stuck on Example 8.1.2-1, Mutually Recursive Type Variable Bounds I searched stackoverflow, and found a question what is a mutually recursive type? but this was not in terms of Java. Example 8.1.2-1. Mutually Recursive Type Variable Bounds interface ConvertibleTo { T co...
Vishrant
1

votes
4

answer
91

views

How to get month according to day of year

I have input like 34 which means its 3rd day of February, but how to determine programatically in Java by taking day of year and getting month name or month month value like 0 for January is there any API in Java that handles this. I searched in Calendar class but did not found any.
Vishrant
1

votes
1

answer
127

views

equals() method of Object class

I was reading JLS, The Class Object and according to it The method equals defines a notion of object equality, which is based on value, not reference, comparison. but when I opened the Declaration of equals method of Object class, which is: public boolean equals (Object o) { return this == o; } Bu...
Vishrant
20

votes
7

answer
5.6k

views

Why Java does not allow null while declaring primitive data types [duplicate]

This question already has an answer here: Why can't primitive data types be “null” in Java? 8 answers This is in continuation to my previous question and accroding to answers of this question Declaration of wrapper classes Java wraps primitive data type to wrapper classes then why char c = null...
Vishrant
1

votes
1

answer
557

views

Native implementation of Process.waitFor method

I have used a method waitFor of Process class, to execute some UNIX command. The command is executing successfully but it is returning 2, that according to convention means abnormal termination. I googled and found that it depends on 'source code of the program that is outputting this exit code'. S...
Vishrant
1

votes
5

answer
200

views

Why Expression `(true) ? null: null` is treated as char[]

System.out.println((true) ? null: null); Question: Why I have got The method println(char[]) is ambiguous for the type PrintStream and why it is not computed, and null is passed as parameter to println method or in other way, Why expression (true) ? null: null is treated as char[]. Edit: IDE Used Ec...
Vishrant
1

votes
2

answer
501

views

Syntax Error: Import statement with multiple semi-colon

This might be a weird question, but a valid one. I know below statement does not have compilation error: ArrayList list = new ArrayList();;; //(with three `;` semi-colon) Okay now I have written below import statement: import java.util.ArrayList;;; (with three `;` semi-colon) But I got below compila...
Vishrant
2

votes
4

answer
80

views

What is heap write traffic and why it is required in ArrayList?

I was just curious to know what does heap write traffic means and why it was required in ArrayList implementation? Snippet of ArrayList implementation, see the line with the comment @Override @SuppressWarnings('unchecked') public void forEachRemaining(Consumer
Vishrant
6

votes
5

answer
1.2k

views

Effect of “finally” block on return values from “try” block [duplicate]

This question already has an answer here: Why does changing the returned variable in a finally block not change the return value? 7 answers I was reading this question and I got the following code snippet: public void testFinally(){ System.out.println(setOne().toString()); } protected StringBuilder...
Vishrant
3

votes
3

answer
1.1k

views

Does Garbage Collector ignores Exception

I was reading that Any Exception thrown by finalize method is ignored by GC thread and it will not be propagated further but what is the reason for ignoring Exception by GC. Also finalization of that object terminates, does that means, that object always remains in memory?
Vishrant
2

votes
2

answer
238

views

Compile time error: ambiguous on calling overloaded method. Why?

For the code below, why do I get this compile time error: The method overloadedMethod(IOException) is ambiguous for the type Test. public class Test { public static void main(String[] args) { Test test = new Test(); test.overloadedMethod(null); } void overloadedMethod(IOException e) { System.out.pri...
Vishrant
4

votes
3

answer
249

views

Java Reflection: wait() method repeat thrice. Why?

I was trying to get method names using Reflection, I have written below two classes: package com.test; public class Test { private void method1() { } } . package com.test; import java.lang.reflect.Method; public class Test2 { public static void main(String[] args) throws SecurityException, ClassNotF...
Vishrant
33

votes
4

answer
3k

views

Does Garbage Collector run on Enum type?

According to jls § 8.9.2 Enum Body Declarations It is a compile-time error for an enum declaration to declare a finalizer. An instance of an enum type may never be finalized. As finalizer executes just before Garbage Collector runs, if finalizer is not present does that means enum type always remai...
Vishrant
2

votes
4

answer
8.2k

views

Java Case Sensitivity: Class file collision: A resource exists with a different case

I am in Windows OS, working in eclipse IDE, I have following two scenario: 1. I have created below class, this is in Employee.java class (E is in uppercase): public class Employee { public static void main(String[] args) { employee emp = new employee(); emp.test(); } } //here e is in lowercase class...
Vishrant
4

votes
3

answer
5.6k

views

Why close method of java.lang.AutoCloseable throws Exception, but close method of java.io.Closeable throws IOException?

I was reading this link for try-with-resources and it says: The close method of the Closeable interface throws exceptions of type IOException while the close method of the AutoCloseable interface throws exceptions of type Exception. But why? The close method of AutoCloseable could have also thrown I...
Vishrant
1

votes
3

answer
826

views

Float and Double NaN (Not-a-Number) value

I was reading JLS8 4.2.3 there I found concept for Float NaN and Double NaN. When I opened the source code of Float and Double class, and tried following code: 1st condition: if (Float.NaN == Float.intBitsToFloat(0x7fc00000)) System.out.println('Both are equal'); } 2nd condition: if (Float.NaN ==...
Vishrant
1

votes
2

answer
156

views

Algorithm: List all prime number using Sieve of Eratosthenes

I have implemented Sieve of Eratosthenes for finding the list of prime number from 1 to n. My code is working fine for inputs from 1 to 10,000 but I am getting following for values >100,000: Exception in thread 'main' java.lang.ArrayIndexOutOfBoundsException: -2146737495 at SieveOfEratosthenes.main(...
Vishrant
1

votes
2

answer
185

views

Is stdin/ stdout/ stderr or cin/ cout/ cerr process safe?

I'm not talking about thread safe, by process safe I mean, for every process by default OS opens three file descriptors when it starts a new process i.e. stdin, stdout and stderr, but as we know everything in UNIX is file, so I am assuming that these are the actual physical files which is shared wit...
Vishrant
2

votes
2

answer
517

views

In Java 8 does Interface breaks the concept of encapsulation?

Till Java1.7, happily I used interfaces for implementing OOPs concept encapsulation. Means if I want to hide implementation from the end user then I will only share Interface with them and they can call my API using that interface, lets for example EJBs. Well above was valid till Java 1.7 now in Jav...
Vishrant

View additional