Monthly Archives: October 2018

Want to replace WhiteSpace from array of String

Questions: private static final String SQL_INSERT = “INSERT INTO ${table}(${keys}) VALUES(${values})”; private static final String SQL_CREATE = “CREATE TABLE ${table}(${keys} VARCHAR(20) NOT NULL)”; private static final String TABLE_REGEX = “\\$\\{table\\}”; private static final String KEYS_REGEX = “\\$\\{keys\\}”; private static final String VALUES_REGEX = “\\$\\{values\\}”; String[] headerRow = csvReader.readNext();//getting(Machine Name , Value) String[] stripedHeaderRow = StringUtils.stripAll(headerRow);… Read More »

Referencing a bufferedImage on a jLabel within a .jar file

Questions: I created a .jar file from Eclipse for a project. Before the .jar creation, I was reading in images like this: jLabel = new JLabel(new ImageIcon(“src/someImage.png”)); But now, for the .jar, I’m using: BufferedImage img = ImageIO.read(getClass().getResourceAsStream(“someImage.png”)); jLabel = new JLabel(new ImageIcon(img)); Which works fine, however further in the code, I need to pick… Read More »

Which book i should prefer for Java Instrumentation? [on hold]

Questions: I want to learn Java Instrumentation.I want to know basic idea about how i can modify the byte code at run time.As well as the basic idea related to Java agent. So can any one please give suggestion which book i prefer or any video Thanks. Answers:

What is PECS (Producer Extends Consumer Super)?

Questions: I came across PECS (short for Producer extends and Consumer super) while reading up on generics. Can someone explain to me how to use PECS to resolve confusion between extends and super? Answers:

Server listenning at port with endpoint

Questions: I have created a server using sockets in Java and it is ready to receive HTTP requests and emit HTTP response. The server is on a port of my PC, but I want to listen only into an “endpoint”, I mean, I want to mount the server i.e. on localhost:60802/json. Is this possible? My… Read More »

How to connect Azure database through Java and with “AD- Universal with MFA support” authentication

Questions: I have to connect to Azure DB with Authentication “AD- Universal with MFA support” using JDBC. I got my connection string from azure portal but getting below error:com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ‘*******’ Java code found is for “AD- Integrated” and “AD- Password” authentication only. Did a lot of research but no technical Java… Read More »