Java

99K

Solutions

33K

Contributors

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi Experts,

String concatenation and Stringbuider which one is the faster.
what is the better appraoch to use while framing queries.

String concatenation will create one object or multiple?(I guess it will create one object).

example:

String concatenation:
=================
String query = select * from testsample where testsample_id='"+id+"'
                          +" and name='"+name+"'
                          +" and deleteflag ='"+N+"'

StringBuilder :
===========
StringBuilder sb = new StringBuilder();
sb.append("select * from testsample where testsample_id='"+id+"'");
   .append("and name='"+name+'"");
   .append("and deleteflag ='"+N+'"");

Open in new window

0
Rowby Goren Makes an Impact on Screen and Online
LVL 19
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Temp receptionists work at Dental Office for 1 day.
Maybe there is a training program for temps.
Receptionists make $18 hour.
Temp receptionists make $23 hour but dont work every day.

Does this exist in the IT field?
Does this exist in the software field?
Software Developer Taking a day off from work and looking at new code that the temp wrote but the temp worked 8 hours and didnt have enough time to write comments and we had to revert all the temps work.
0
want to fetch 2 columns data from jsp into vector suppose id and name .
after that want to display on same jsp 1 checkbox added in front of each row
while checking the checkbox  send id as checkbox parameter to servlet.
0
when i m generating .xlsx file it's genrating perfectly but every time some header name is missing .
suppose 20 column is there in a xlsx file some time 1or 2 or 3 header name was missing .
data are coming but only header name is missing there please let me know what is the issue.
0
I have written tests in Java to validate data from database based on some event took place in an application, As soon as that event happens it updates and adds few records in database.

Ex:

Table Name: RecordsStatus

Column Name: Status -> Flag 0 or 1

If this is 1 we have to run an ETL Job and have to verify some other tables that are updated based on ETL job, so there are 3 stages here that are to be tested

Some Action happens in an Application (No need to Test this)

Flag is updated in database table
Run ETL Job
Verify data that is updated
The entire process has to be in one single test as the unique id has to be used in all the 3 stages for validating the data.

I am thinking to write a listener in Java that checks for Flag from "RecordStatus" table based on which the ETL job has to run

Is this a good approach?, please suggest if there are any better approaches

Are there any open source tools to do similar testing
0
Hi Team,

I need to download and install Jad plugin for eclipse with java 1.7 version. I have configured the eclipse to access the jad.exe and net.sf.jadclipse_3.3.0.jar.

I have gone to eclipse --> windows --> java -->  Jadeclipse --> and configured the settings.

But still I get the below error. Any help is really appreciated.
0
I have 1 server with a bunch of micro services that ingest data from gps tracking units

Each micro service maintains it own cache to stop expensive round trips to the database
This works really well, and performance is good

Now we want to horizontally scale and load balance the data
However, in our tests we see the car report to one server, then on next TCP session it jumps to a different server where the cache is not the same
When we do things like software odometer, this really screws up and things go out of sync

The obvious thing is to move to some sort of distributed cache, but considering we are processing 60,000 records a second, having a distributed cache will obviously be slower due to the networking aspect, each record may hit the cache 6 times
I've been looking at redis which looks quick, but again, the networking aspect seems to be the bottle neck.

I was thinking of having some sort of syncing mechanism which distributes to all the servers, but i'm not sure if this would just be way too complicated or if this type of issue has been addressed before with some sort of framework

I'm open to ideas here on option and areas to investigate
Our stack is mainly .net core console apps/services with some java apps
0
error clicking a link in java application
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name:   Apache Tomcat/9.0.20
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          May 3 2019 22:26:00 UTC
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.20.0
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Java\jdk1.8.0_111\jre
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_111-b14
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         C:\Users\Desmond\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Nov 04, 2019 8:28:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         C:\Program Files\Apache Software Foundation\Tomcat 9.0

Open in new window

0
We have JAVA application connect with third party provider. They provided certificates in .P7B format. We have installed those certificates in Java key store cacerts. Afterthat we restarted the application and when try to connect with third party URL, we are getting following error "Received fatal alert: handshake_failure".

We enabled the debugger and when we seen in the logs is is showing following error "Invalidated:  [Session-1, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256]" .  Could anyone help on this. When i hit the third party URL from my Ubuntu box it is showing their cipher name as "ECDHE-RSA-AES256-GCM-SHA384:256"
vendor.png
image--1-.png
0
Hi i have a button name generate in .jsp page , while user click on that button multiple .xls file have been geenrated but i don't want to save those files
to server i want to just download all files in zip format while clicking on generat button.
0
OWASP: Threats Fundamentals
LVL 19
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

Hello,
I'am trying to use a Raspberry Compute Module. I'am using the pi4j and I try to use trigger a function when a GPIO pin state change.
I'm using the pi4j examples. I'am using the GPIO_12. When I start te program I can read the pin state and I see when the state change by pooling the GPIO Pin but there is no event triggered when the pin change the state.
I try different examples, one coming form a book. I can read the GPIO state but I have no event trigger.

here's the code.

private  GpioController gpio = GpioFactory.getInstance();
private  GpioPinDigitalInput kbdInt = gpio.provisionDigitalInputPin(RaspiPin.GPIO_12, PinPullResistance.PULL_DOWN);
kbdInt.setShutdownOptions(true);
kbdInt.addListener(new GpioPinListenerDigital() {
                  @Override
                  public void handleGpioPinDigitalStateChangeEvent( final GpioPinDigitalStateChangeEvent aEvent) {
                        
                        System.out.println("State change");

                  }
            });


Thanks a lot for your help
0
Hi, I have a question related with java. I got a list of object  (imges) from a service call ( coRepo.findCoImg(a, b, c)),   then I need append the list of object's getSvc() value into a byte[] type.  getSvc() will return a byte[] type. How can I do it?  Below is the code.

Thanks in advance.


public byte[] getSvc() {
            return svc;
      }

public byte[] getCovImges(
                    Database db, Int a, Int b, Int c) {

              List<CoDTO> imges;
            
              imges= coRepo.findCoImg(a, b, c);
        
              int size = imges.size();
                   
              byte[] imgNew = {};
              for (int i =0; i<imges.size(); i++) {
                    imgNew = imgNew + imgNew .get(i).getSvc();  // this line don't work
              }
              
            //  return  imges.get(0).getSvc();   // This line will only return the first item in the list, I need return the whole list's getSvc()  value
             return imges;   //this is not working
            }
0
how to get the GMT time zone return format as timestamp

static final String DATEFORMAT = "dd-MM-yyyy HH:mm:ss";
0
how to check .xls file is based on xml or word file because in both extension is .xls . i have a xml file having extension .xls how to check the format because if i check extension its always come like .xls .
0
Hi,

I am looking for a good design solution in Java for the implementation i need to do, i wanted to avoid usage of too many if else or switch statements

Based on the type of file i have to move the file to specific shared folder, for example if the file is a zip file i have to move to "zipped" location or if it is non zip file then a different location and so on

With the filename and extension i will be able to know what type of file it is, and there is a chance that more types can be added in the future hence i wanted to avoid if-else or switch statements

for example if the file name is IN_MAH_MUM-_20190306162024X_CANCER.xml, this is not a zip file and it contains "CANCER" word in it hence it will go to "CANCERFILES" folder

so basically here i am looking for mapping between file types and folder locations in an efficient way

Below is just an example

Types of Files

1)Zipped
     Move to "Zipped" folder
2)Unzipped
      1)Medical
             a)CancerFiles
                    Move to "CancerFiles" folder
             b)CardioFiles
             c)OrthoFiles
        2)Non Medical
             a) FinancialFiles
             b) OccupationFiles
0
With Oracle changing it's position on licensing our company needs to scan all of perhaps 5000 server images to see where we've got java deployed.

As you may know, Oracle is going to require payment for specific versions and flavors (jre vs. jdk) of Oracle.

We have a tool for this with our Linux systems (only about 500 of the above), but we don't have a good solution for Windows (the rest), which are Windows 2000, 2003, 2008, 2012 and a couple 2016.  Luckily we're mostly 2008 and 2012.  Regardless, we have a way to run a command against all of these, but we need to know what to run to check.  Our infrastructure vendor was able to run "java -version", which got us versions, but not flavors.  Is there a run to determine the flavor with a command?

Thanks
0
hi am having the following error
mvn clean
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for guru.springframework:pet-clinic-web:jar:0.0.5
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.junit.jupiter:junit-jupiter-api:jar -> version (?) vs
5.5.0-RC1 @ guru.springframework:pet-clinic-web:[unknown-version], C:\spring5Clinic\pet-clinic-web\pom.xml, line 97, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.mockito:mockito-junit-jupiter:jar -> version 2.22.0 vs
 (?) @ guru.springframework:pet-clinic-web:[unknown-version], C:\spring5Clinic\pet-clinic-web\pom.xml, line 107, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] tdm-pet-clinic                                                     [pom]
[INFO] pet-clinic-data                                                    [jar]
[INFO] pet-clinic-web                                                     [jar]
[INFO]
[INFO] ----------------< guru.springframework:tdm-pet-clinic >-----------------
[INFO] Building
0
i have a file .XLS extension but save as XMl spreadsheet 2003 , want to read the file and convert it into .XLS Extension with java code my code is below -

public class ExcelImport {

public boolean readStream(InputStream stream) throws InvalidFormatException {
    boolean success;

    try {
        byte[] bytes = getBytes(stream);
        InputStream wrappedStream = new ByteArrayInputStream(bytes);

        Workbook workbook = WorkbookFactory.create(wrappedStream);
        //XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(wrappedStream.toString()));
        for (int i = 0; i <workbook.getNumberOfSheets(); i++) {
            Sheet sheet = workbook.getSheetAt(i);
            for (Row row : sheet) {
                IterateThroughRow(row);
            }
        }
        success = true;
    } catch (FileNotFoundException e) {
        success = false;
        e.printStackTrace();
    } catch (IOException e) {
        success = false;
        e.printStackTrace();
    }
    return success;
}

private void IterateThroughRow(Row row) {
    Iterator<Cell> cellIterator = row.cellIterator();

    while (cellIterator.hasNext()) {
        Cell cell = cellIterator.next();

        switch (cell.getCellType()) {
            //do something with the content...
            case Cell.CELL_TYPE_STRING:
                cell.getStringCellValue();
                break;
            case Cell.CELL_TYPE_NUMERIC:
                cell.getNumericCellValue();
                break;
 

Open in new window

0
I want to develop an application with objection detection technology using Python and integrate this into android application (android native- java code).
please help me out
0
OWASP Proactive Controls
LVL 19
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

hi am geting this error
mvn compile
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for guru.springframework:pet-clinic-web:jar:0.0.5
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.junit.jupiter:junit-jupiter-api:jar -> version (?) vs
5.5.0-RC1 @ guru.springframework:pet-clinic-web:[unknown-version], C:\spring5Clinic\pet-clinic-web\pom.xml, line 97, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.mockito:mockito-junit-jupiter:jar -> version 2.22.0 vs
 (?) @ guru.springframework:pet-clinic-web:[unknown-version], C:\spring5Clinic\pet-clinic-web\pom.xml, line 107, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] tdm-pet-clinic                                                     [pom]
[INFO] pet-clinic-data                                                    [jar]
[INFO] pet-clinic-web                                                     [jar]
[INFO]
[INFO] ----------------< guru.springframework:tdm-pet-clinic >-----------------
[INFO] Building tdm-pet-clinic
0
hi when creating new spring boot application in eclipse what must i choose
enterprise application or Dynamic web project i also what to add angular in this project and later use hirbinate
0
hi where do i add this
 @Bean
    DataSource dataSource() throws SQLException {
        OracleDataSource dataSource = new OracleDataSource();
        dataSource.setUser(username);
        dataSource.setPassword(password);
        dataSource.setURL(url);
        dataSource.setImplicitCachingEnabled(true);
        dataSource.setFastConnectionFailoverEnabled(true);
        return dataSource;
    }

Open in new window

mavenerror3.jpg
0
Hello,
Any suggestions for an open-source Education ERP system under MIT or Apache license?
0
How to import python libraries in java.
0
hi am not geting the preview
preview
0

Java

99K

Solutions

33K

Contributors

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.