peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

This seems to be ingoing issue with Nokia Suite messing JAR file associations, try to correct it with help of this article

PS: Sorry to OP About moving this thread around, but at the beginning it look like that you have issue with your mobile application JARs, hence why it was moved to Mobile Development. However now it is clear that it is standard Java question so I'm moving it back to Java. My apologies once again

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Simple, when you call method to interact with database provide parameters with it instead of trying to get direct access.
Example, this is very simplified JAVA!!!
Before change

public boolean login(){
PreparedStatement preparedStatement = null;
	try{
		String strQuery = 
		"SELECT * FROM user WHERE uid=? AND password=? AND";
				
		preparedStatement = conn.prepareStatement(strQuery);
		preparedStatement.setString(1,usernameTextField.getText());
		preparedStatement.setString(2,passwordTextField.getText());

would become

public boolean login(String username, String password){
PreparedStatement preparedStatement = null;
	try{
		String strQuery = 
		"SELECT * FROM user WHERE uid=? AND password=? AND";
				
		preparedStatement = conn.prepareStatement(strQuery);
		preparedStatement.setString(1,username);
		preparedStatement.setString(2,password);

and you will call it from your user interface presumable on button click as

public void actionPerformed(){
    DataManager manager = new DataManager(); //Your database class
    manager.login(usernameTextField.getText(), passwordTextField.getText());
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Without actual code it is hard to determine what is wrong but common mistake can be something along this

<jsp:setProperty name="logdetails" property="Username" value="<%=request.getParameter("Username")%>" />

that should be written as

<jsp:setProperty name="logdetails" property="Username" value='<%=request.getParameter("Username")%>' />
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Look back step how you setup GlassFish to be your application server and change it to Tomcat, also make sure that your application produces WAR file that you can then deploy on your remote server

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Its already there, default constructor. Do you know what is default constructor? If you do not them you better to go read your course notes

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Your first mistake, shape is not layout bur drawable resource and I'm sure your IDe indicated so much if you check closely.

Here is simple example
res/drawable/form_border_green.xml

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
    <stroke android:color="#00ff00" android:width="2dp"/>
    <padding android:left="15dp" android:top="15dp"
             android:right="15dp" android:bottom="15dp" />
    <corners android:radius="30dp" />
</shape>

res/layout/main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
        >
    <RelativeLayout
            android:background="@drawable/form_border_green"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_marginBottom="40dp"
            >
        <EditText
                android:id="@+id/email"
                android:minWidth="250dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:hint="Email address"
                android:inputType="textEmailAddress"
                android:layout_marginBottom="5dp"
                android:layout_centerHorizontal="true"
                />
        <EditText
                android:id="@+id/field_password"
                android:minWidth="250dp"
                android:layout_width="250dp"
                android:layout_height="wrap_content"
                android:layout_below="@id/email"
                android:hint="Password"
                android:inputType="textPassword"
                android:layout_marginBottom="5dp"
                android:layout_centerHorizontal="true"
                />
        <CheckBox
                android:id="@+id/checkbox_save"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Save password"
                android:textColor="#FFFFFF"
                android:layout_below="@id/field_password"
                android:layout_centerHorizontal="true"
                />
        <Button
                android:layout_width="125dp"
                android:layout_height="45dp"
                android:id="@+id/button_login"
                android:text="Login"
                android:layout_below="@id/checkbox_save"
                android:layout_centerHorizontal="true"
                />
    </RelativeLayout>
</RelativeLayout>

FormBorderActivity.java

package com.peter.formborder;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class FormBorderActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Something like this should work

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <stroke android:width="4dp" android:color="#00FF00" /> 
    <solid android:color="#00ff00" /> 
    <padding android:left="7dp" android:top="7dp" 
            android:right="7dp" android:bottom="7dp" /> 
    <corners android:radius="4dp" /> 
</shape>
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

As forum rules clearly state - Do provide evidence of having done some work yourself if posting questions from school or work assignments

Above request is just "hey I have idea of project, do it for me" which doesn't work

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Ohhh come on do not start IDE wars! Each of IDE is good and it is just up to personal preferences which you like most

PS: IntelliJ IDEA FTW ;)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@cOrRuPtG3n3t!x slap on the hand IntelliJ, Eclipse or NetBeans would work on any operating system so dividing them for Windows and Unix use only is pointless.

@waqasaslammmeo try any of above mentioned IDEs they are industry accepte and used solution, however do not expect them to provide drag&drop approach of development like in .NET. And as stultuske mentioned, maybe good idea to start with simple text editor and command line to get accustomed of "Java ways"

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Have look at zxing project (includes also examples)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes exactly StringBuilder is better way then what you showed in VB which is also possible in Java/Android

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Can it be done similar to VB.NET? Or is it completely different?
>> I wouldn't know never used VB. For the rest it just a variable, how you handle it and interact with it is up to you. To build it you can consider StringBuilder instead of some concatenation often see from beginners

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

iText library watermark example, so you did not search properly

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You know now days you hardly find device running bellow 2.3. Beside when you write your application you should always include minimum required level so when user try to install it he/she is warned. Second level of defence is to on application start up check if you have access to all resources that you need. If something missing just pop-up message "Sorry can't use app missing XYZ"

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

As stultuske already mentioned you should check if server running.
If Tomcat installed as service it will start every time you start your pc (if not modified). If you extracted zip, you need to execute startup.bat from your "bin" directory inside of tomcat directory (can be speed up if you create CATALINA_HOME system variable)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Given the way you presented your problem and did not provided any code what you expect? We do not see what you doing so any possible avenue is point to official documentation and hoping that conversation will start. However given your "fast" reply ratio I see no point for you to moan. If you came back saying well this is my problem, here I'm getting stuck somebody would have replied.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

As far I know from 2.3.0 or similar version PDF viewer is available on most of devices since they want to be direct competitors for Kindle and other e-book readers

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You just made over kill. There is easier way to work with PDFs then open+conver+display in application. See this simple example

PS: I bet that you are one of these people that rather see movie of the book then reading it, like Lord of the Rings. Movies been great but book is even greater ;)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

How do I change a pdf file to an app?
>>You need to provider better problem description then this.

PS: My personal opinion, no youtube video can beat good old fashion book

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If you looking to create backup sql file then use mysqldump

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Sorry to ask but what are you actually trying to achieve? Reading text file from JAR is simple, but you will just do it on the same machine where JAR is used as the file is mostly just some part of configuration or commentary since you cannot update it without extracting JAR and packing it back again...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@rushikesh jadha

1) Both post merged - forum rule Keep It Organized Do not post the same question multiple times
2) Next time you create thread you better give it a proper name not "java help". We are in Java section and people posting here do need help - forum rule Keep It Clear Do use clear and relevant titles for new threads
3) You are expected to show effort and not just beg for answers. Just simple search on Google would gave you ton of resources "Java MySQL tutorial" - forum rule Keep It Organized Do provide evidence of having done some work yourself if posting questions from school or work assignments

Next time you fail to do any of above I will merciless delete your thread!

stultuske commented: sometimes a wake up call is the right thing to do +14
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

It is hard to discuss this sort of thing without prior knowledge of code. Have look on stackoverflow for similar question

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Wouldn't adding windows focus listener sort this(addWindowsFocusListener)?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

bump
>>You are rude! This is not 24/7 give my codes forum, but voluntary work of people that are willing to help when they have time.

1) First thing first, slap your self for doing database connection from JSP and not from servlet
2) You are handling your connections in bad way. Do NOT create new connection in existing connection and then to try to close it as part of same try block

Therefore move database code to servlet.
Split code in number of methods that you will call once certain conditions rises. Start first with methods to get connection and close connection and then create these 3 methods that will handle different queries. Once you done with that we can talk further

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

As far as I'm aware that is the approach of any PDF library that you cannot overwrite currently opened document. What you have to do is open document, make changes, save in new document, remove original and rename new one.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I still get some spikes when iterating through lists with over 2000 entries
>> That will be too much even for desktop, clearly you did not thought your logic throughout. Anyway at the moment I'm reading Android Application Testing Guide. Maybe that can help you in the area of performance

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You on Windows or Unix system? Are you sure you on Indigo and not something older?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

~!~ For website development which is best asp.net , php , j2ee ~!~

PHP is better than asp.net & j2ee

waLkiNg-aLoNe

And you know it because you failed miserably to learn Java and .NET. If you have something to say you better give full explanation and not biased opinion.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Since you say you know C# (which has very similar syntax to Java) you will do fine. Just need to be more proactive with Android API, little different from MSDN

rotemorb commented: The guy was very helpful :) +1
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I would say go with Beginning Android 4 as Beginning Android 4 for games is for these that have some knowledge of Android already. I'm at the moment reading Android Pro 3, but it is little bumpy ride as authors seems to give to much theory and code is coming in small doses. You can always get code from book on APress site

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Passing out object from form is not good idea. You should not allowed objects that are not associated directly interfere. Better (not perfect solution) would be this

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class MyEventC extends JFrame implements ActionListener {

    private JTextField text;

    public MyEventC() {
        setLayout(new BorderLayout(5, 10));

        JPanel topSide = new JPanel();
        topSide.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 3));
        JLabel one = new JLabel("Current value");
        text = new JTextField("0", 10);
        topSide.add(one);
        topSide.add(text);
        text.addActionListener(this);

        add(topSide, "North");

        JPanel southSide = new JPanel();
        southSide.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 3));
        JButton btn1 = new JButton("+");
        JButton btn2 = new JButton("-");
        JButton resetButton = new JButton("Reset");
        JButton btn4 = new JButton("Quit");

        southSide.add(btn1);
        southSide.add(btn2);
        southSide.add(resetButton);
        southSide.add(btn4);
        add(southSide, BorderLayout.SOUTH);

        //text.addActionListener();

        btn1.addActionListener(this);
        btn2.addActionListener(this);
        resetButton.addActionListener(new ResetListener(this));
        btn4.addActionListener(this);


    }

    public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand() == "+") {
            int num1 = Integer.parseInt(text.getText());
            num1++;
            String result = num1 + "";
            text.setText(result);
            System.out.println(num1 + "");
        } else if (e.getActionCommand() == "-") {
            int num1 = Integer.parseInt(text.getText());
            num1--;
            String result = num1 + "";
            text.setText(result);
            System.out.println(num1 + "");
        }


        else if (e.getActionCommand() == "Quit") {

            System.exit(0);
        }
    }

    public static void main(String[] args) {
        MyEventC event = new MyEventC();

        event.setTitle("Part 4 Using separte class for Reset Button");
        event.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        event.setSize(400, 150);
        event.setVisible(true);

    }

    public void resetForm() {
        text.setText("0");
    }
}
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ResetListener implements ActionListener {
    private MyEventC myEventC;
    public ResetListener(MyEventC myEventC) {
        this.myEventC = myEventC;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if ("Reset".equals(e.getActionCommand())) {
            myEventC.resetForm();
        }

    }
}

PS: It is about time that you start giving …

DavidKroukamp commented: That is neater +7
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

in description I just have this:

Modify your solution from Part 1 to implement the action listener for the Reset button in a separate class name ResetListener

That is what you failed to add to your post, otherwise I wouldn't have asked.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

" I need to create separate class justo fro reste button"
>> That is very loose description. Can yo be more specific? If I take your request literal then I would expected to see ResetButton class extending JButton(setting all parameters like title, size, colour) with ActionListener specifically only for this button

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I was correct in regards of schema locations, you need to update web.xml and replace

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	 version="2.4">

with

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
version="2.5">

Given that you did project development in IDE instead of command line build as I did in original tutorial project folder structure is slightly different. Mainly the contenten of "classes" folder is moved to 'src" (you can see in attached file).

However as hard as I tried I couldn't get rid of error about <jsp:useBean id="students" type="ArrayList<beans.UserBean>" scope="session" /> . Page imports are fine, UsrBean is found I guess since there is no error on the line above this that retrieve userBean object from session.

Can some Eclipse user have look and check attached project folder to see if he/she will be wiser why Eclipse is moaning so much?

PS: Cascading style sheets and image is missing from there, but that is not important at the moment.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Not working is not much of issue description, don't you think?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@JamesCherrill agree on code in post and I move it there ;)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

For first I expect schema update values will fix, when tutorial was written Sun Microsystems was in charge of Java now is Oracle so that will need to change.
I will have look and post back

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You will need to find library that is able to handle ActiveX objects, nevertheless sometimes it is not good idea to transfer everything as it is. Try to think over what is that component used for and see if you really need it. Refactoring (or in this case rebuild) is an opportunity to re-evaluate structure of existing code, necessity of functions some blocks of code, code clearness and generally project functionality and being able to easy to test it with JUnit etc

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Not aware of one, all the tooling "boom" came with arrival of 1.5 that made so many things easier...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Is your project folder structure as per tutorial? If so please put your ZIP file and attach to next reply I will try to have look at it (you need to click "Use Advanced Editor" and bellow text editing area will be Manage Attachment options to attach ZIP of the project)
Also please let me know what IDE you use.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

No you can't. Alert is just string for title, or String for title and alert text, Image alertImage, AlertType alertType.
Just create separate form and and ask for phone number there.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

To be fair I do not know, I never tried such thing. What you need to find out is if the devices that you wish to control have some SDK (software development kit) or some interface/service you can connect to and communicate with them. Also try to search for some people who may done something like that

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@borgyborg forum rule Keep It Organized say that you are to provide evidence of having done some work yourself if posting questions from school or work assignments. That doesn't mean that you post a code where you want to add something add someone will do rest for you.

We are NOT 24/7 coding forum for lazy individuals!

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Tell your teacher that what he is doing is wrong and he is giving you bad habit. Any IDE has an option to add library(JAR) to project. Here is how-to for Eclipse.
Other ways you may learn later includes dependencies management with Ant, Maven, Ivy or other tools.
In any case you should never mess with Java installation directory, beside giving system path to it.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

The usual driver for MySQL is com.mysql.jdbc.Driver . Driver you use is usable but little out of date

The org.gjt.mm.mysql.Driver class name is also usable to remain backward-compatible with MM.MySQL

Secondly, did you checked that DB is running? (In command line type mysql, or use one of the many GUIs to check if you can connect with DB)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Did you provided import for ArrayList and the bean?

<%@ page import="java.util.ArrayList"%>
<%@ page import="beans.UserBean"%>
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Try it again, if upload fails let me know will try something else

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Hmmm I was hoping that line will have some file name or something that may got wrong for whatever reason.
The last thing we can do is for you to put your project in ZIP file and post it if you want to (You need to "Use Advanced Editor" to be able access Attachment Manager that is located below post editing area) and then I can have look what is wrong