peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

All your dreams come true when you click on the component and check the Properties tab (normally on the right).
If by any chance you do not see this panel then from main menu select Window >> Properties or Ctrl+Shift+7

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Tutorial for drag&drop "developers" Designing a Swing GUI in NetBeans IDE

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Is this solved or not? If it is solved why didn't you stated so or perhaps provided solution?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Interesting idea and maybe handy if you work in specific area. However it wouldn't be useful in my case as in the company we do everything from GUI, web, mobile with various frameworks or technologies. You can say everyday something new and also we may "never again enter the same river".

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@James
You would saved hell of typing if you just pointed to Swing Hacks - Size Your Columns to Suit Your JTable's Contents ;)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I'm sorry but this is not "drop your assignment we will sort it for you service".

Clear problem description of problem is missing...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

hi karthik ,
This is rashmi i have seen ur post regarding sms web application .I m also looking for the same sort of application if u have completed ur project can u guide me how to do this. Its really urgent ,Hope to see a reply from u soon .Thanks

You better read whole thread and not just last reply. Also what is urgent to you it does not affect us...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You are suppose to replace with reference to what ever connection pool you use.

So what connection you use and what steps you used to add it to your project?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Just order one of them, they are written by same author. I posted both of them as some people like to go for top-notch of latest in technology and other are happy to reach for previous now cheaper version. You can have preview of Beginning J2ME from Google Books , for Kicking Butt there is no preview but you can download some of the book code samples.

As for online resources Sun website has list for mobile development here and maybe mobile development with NetBeans (but try to stay away from visual development as this will make you dependent on tool, plus some of the tutorials are made for older version so may posses some troubles to get them running)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

hello peter
i just tried with the above statement to set value inside the textbox,
but wats happening is the value is been displayed outside the textbox.can u help me?

thanks in advance

Maybe I can help if you post your code...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Hi there

Much much would you charge for a 'Content Management System' if I was using an open source application?

I was thinking of charging a service fee of $20/month just for the CMS. Do anyone have a different opinion?

Many thanks in advance
CHEERS :)

Yes I do have different opinion. This whole question about how much to charge does not take in concern the geographical location of your business so is absolutely misleading. As person living and working in London I would have to charge much more then somebody working from Wales or Scotland (at this point we are still in UK), however I couldn't ask the same price also if I was in Slovakia, any part of Africa or Asia.
So full research in what type of services and price plans of my competition in business would be better start then question to global community...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

We do not have special mobile section and as JME(J2ME) is just cut-down version of JSE you should post it here.
Also I would recommend to avoid roseindia as they have outdated examples, bad programming habits, plus other things I personally dislike about the site. If you want to learn get either Beginning J2ME: From Novice to Professional or Kicking Butt with MIDP and MSA: Creating Great Mobile Applications which provide excellent and structured way to learn Java mobile development

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

My favourite forum rule: We only give homework help to those who show effort

So start doing something...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

5- I went to ENV vars. There was no classpath. So i created one and added its value as C:\jakarta-tomacat-4.1.31\common\lib\servlet.jar

Classpath should to be starting with dot, semi-column and then with location of the library; and each new library should be separated from previous library by semi-column .;C:\jakarta-tomacat-4.1.31\common\lib\servlet.jar

7- I tried going to the directory where my java file was and then tried javac and still i failed.

It wouldn't compile as classpath is set wrongly

8- I started NetBeans and checked plugins. To my luck, and surprise, i found tomacat plugin which I installed alongside another plugin called WebSomething. It says that this plugin will be installed as well since its dependant on it.

If you install you better to note what it is for future references

9- I went to TOOLS then OPTIONS then MISCLANEOUS and pressed ADD JAR/ZIP next CLASSPATH and put this C:\jakarta-tomacat-4.1.31\common\lib\servlet.jar

Doing the same as you did only thing I can see is option to add Classpath for Ant which will not help you again

10- I started a new prj and created a java file with the same name as the one in the site. I copied hte code too. Red lines appeared on almost every line of code. Like import javax.servlet.http.*; was underlined and the tip said package javax.servlet does not exist

To add project depended libraries you need to right click on the project and select Properties (alternatively File >> Project Properties). On the newly opened pop-up window from …

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Java forum section has thread at the top called Starting "Java" [Java tutorials / resources / faq] where you will find everything you need for start

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You need to first have look at Java to get basic knowledge and after that you should progress to "extensions" to it like JSP

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

So in which section of your code you are having problem?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You would do good thing if you start splitting this thousand lines long "simple" application into separate classes and packages...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Step 4: Do connection to database from servlet and not from Java Server Page

Optional Step: If you care to learn something you better to check out post on the top of the JSP section which gives example with description how to tackle this problem for start

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

This is hardly a description of the the problems so do not expect people to help you with this homework if you do not care describe problem properly...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You should AJAX for this sort of thing dynamic interaction and JSP just as container to hold/present content...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You failed to specify what language or technology you are using...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

hello, i need help on the format for rss feed in aptana studio to link to java servlet coded in eclipse.

thanks!!!

Very bad problem description.
Explain in better manner and maybe somebody can help you...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Quick sample of mapping

<servlet>
       <servlet-name>LoginServlet</servlet-name>
       <servlet-class>LoginServlet</servlet-class>
</servlet>

<servlet-mapping>
       <servlet-name>LoginServlet</servlet-name>
       <url-pattern>/controller/login</url-pattern>
</servlet-mapping>
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Well you can either delete IE Browsing History (Tools >> Delete Browsing History and here leave ticked Temporary Internet Files and Cookies) or use Firefox as you do not have problem to access it through this browser

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

What browser you using?
Did you try to open the site under different internet browser (Firefox, Chrome, IE, Safari)?
You can clean cache of the browser and see if that works (Firefox == Tools=> Clear Recent History => click on the arrow next to Details to see option list, leave only cache ticked, select time period for which you want to do delete and press OK)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Which VB?
VB 4/5/6 or VB.NET

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Maybe, but first you need to specify what you want to use (plain HTML, PHP, ASP/ASP.NET/JSP etc.)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Any IDE (IntelliJ IDEA, Eclipse, NetBeans) with either WTK 2.5.2, Java ME SDK 3.0 or any custom WTK from mobile manufacturers (Sony Ericsson, Nokia ...)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You did not added menu bar to your frame setJMenuBar(JMenuBar menubar)

majestic0110 commented: Beat me to it! :) +5
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Problem solved with use of Commons IO API, time for more XML n00bing

private void readFileAsString(String filePath) throws
java.io.IOException {
        StringBuffer fileData = new StringBuffer(1000);
        BufferedReader reader = new BufferedReader(new
FileReader(filePath));
        char[] buf = new char[1024];
        int numRead = 0;
        while ((numRead = reader.read(buf)) != -1) {
            String readData = String.valueOf(buf, 0, numRead);
            fileData.append(readData);
            buf = new char[1024];
        }
        reader.close();
        System.out.println(fileData.toString());
    }

PS: String in method parameter received need to be obviously replaced by InputStream, you got the idea hope...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I need to read XML document submitted to doPost() method ( I do not want to upload it, just read in and pass for further processing). Here is a general code that I use for now to see if file been received.

public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        ServletInputStream sis = null;
        try {
            sis = request.getInputStream();
        }
        catch (IllegalStateException e) {
            e.printStackTrace();
        }
        if (sis != null) {
            print(sis);
            sis.close();
        }
    }

    private void print(ServletInputStream sis){
        java.io.BufferedReader br = null;
        try{
            br = new java.io.BufferedReader(new java.io.InputStreamReader(sis));

            StringBuilder sb = new StringBuilder();
            String line = null;

            while ((line = br.readLine()) != null) {
                sb.append(line + "\n");
            }

            br.close();
            System.out.println(sb.toString());
        }
        catch(IOException e){
            e.printStackTrace();
        }
    }

To test this I use curl utility to pass file to url as

curl URL --data-binary @FILENAME -H 'Content-type: application/atom+xml;type=entry'

However content of the file is not printed, only new line is added which means process get to this sb.append(line + "\n"); command.

Any advice is welcome.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Difficult to say what is problem as we do not know what the first page look like

PS: Database connectivity should be handled by servlet not by page it self.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Difficult to say what is problem as we do not know what the first page look like

PS: Database connectivity should be handled by servlet not by page it self.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Please do not hijack other people threads. As for your query here is answer or be more specific which part of deployment you have problems with...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@nazd28 please full sentence English. It part of the rules of this forum, take this as unofficial warning.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Please take time to check where you posting. You posted in JSP that is Java Server Pages and that is not same as JavaScript. Post moved

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Thanx ~s.o.s~, great example!

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Would be possible to get some show-case example as neither me or rizza_f grow up to the challenge yet...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I need help on hacking accounts in a wireless area network.

Then you chosen wrong forum because we do not do illegal stuff...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

hello
i saw your question so you have a cpu schuduling program in java

Your question was already moved to Java section so why you reopening this old thread?
I'm closing this thread and I suggest that you take in serious consideration this thread "We only give homework help to those who show effort" or nobody will pay attention to lazy student/employee trying to cheat his way.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Thank you Peter!

P.S. BTW, your JSP tutorial helped me a lot! :)

It is not 100% bullet-proof solution, but it was intended as kick-off example as we been little tired of continues request "how do I connect JSP to database" or similar. Glad you found it useful.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Don't update or subtract values. Use aggregate sql functions.
For example,
1. Calculate the sum of quantity of a specific product in your purchase
table.
2. Calculate the sum of quantity of a specific product in your sales table.
3. Current stock = Sum of qty of purchase - Sum of qty of sales.

Can you provide clearer explanation as I do understand that aggregate functions are

  • AVG() - Returns the average value
  • COUNT() - Returns the number of rows
  • FIRST() - Returns the first value
  • LAST() - Returns the last value
  • MAX() - Returns the largest value
  • MIN() - Returns the smallest value
  • SUM() - Returns the sum

and in my understanding these are used for calculation and not changing existing value in the table.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I had finally time to look at the above book and looks like web.xml file needs to be changed to something like this (I had no chance to test it so I have no idea if it will actually work. Also in my tutorial here is direct request for DB driver where in this case config file is using connection pool)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
	<servlet>
		<servlet-name>LoginServlet</servlet-name>
       	<servlet-class>LoginServlet</servlet-class>
       
       <init-param>
		    <param-name>dbUserName</param-name>
		    <param-value>root</param-value>
	    </init-param>
	  	<init-param>
		    <param-name>dbPassword</param-name>
		    <param-value>p14m10m</param-value>
	    </init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>LoginServlet</servlet-name>
       <url-pattern>/login</url-pattern>		
	</servlet-mapping>
	
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	
	<resource-ref>
		<!-- 
		Contains the JNDI name of the data source 
		NOT SURE IF THE NAME IS NEED IT AS IN BOOK EXAMPLE 
		IT WAS USED FOR REFERENCE CALL FROM JSP THROUGH JSTL 
		-->
		<res-ref-name>jdbc/mysqlpool</res-ref-name>
		<!--
		Contains the fully qualified name of the resource to be obtained via JNDI;
		 for data sources, this will always be javax.sql.DataSource. 
		 -->		
		<res-type>javax.sql.DataSource</res-type>
		<!-- 
		Element should have a value of Container when using the <resource-ref> 
		element to define a data source as a resource. This allows the application server 
		to use the credentials set up in the connection pool corresponding 
		to the data source to log into the database. 
		-->
		<res-auth>Container</res-auth>
	</resource-ref>
</web-app>

If this doesn't work you will need to try GlassFish forum (as I do not see point in waiting here as nobody else so far replied :( )

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

1. Post num 10 is something what you may want to have look at

2. create empty index.html (*.jsp) with meta tag for redirect in one second that will call upon your servlet. <meta http-equiv="refresh" content="1; url=next_page.html">

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Few things for start

  1. I split your single file of nearly 600 lines into multiple files as they should be organized
  2. in Java Microedition there is no String method as equalsIgnoreCase() please follow JME API more closely or you can write such method for your self, it is not difficult.
  3. Provided URL for connection is not working so you better set it up before you do anything else (few tips in configuration of your server and PHP can be found here on Sony Ericsson, I never try it so I cannot comment. However my preference would be to use Java enabled server so I can talk to servlet directly then messing around with some other web implementations). Because of the issue with URL not being set up I couldn't test this application any futher

MIDlet - MyProject.java

package myProject;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

import myProject.screens.LoginScreen;

public class MyProject extends MIDlet{

    public String ti;
    public String entrydate;
    public String result;

    private Display display;


    public MyProject() {

        /* Calendar logincalenda = Calendar.getInstance();
        logincalenda.setTime(new Date());

        int monthc = logincalenda.get(Calendar.MONTH) + 1;
        int datec = logincalenda.get(Calendar.DATE);
        int yearc = logincalenda.get(Calendar.YEAR);

        String entryDate = "" + yearc + "-" + monthc + "-" + datec;
        curdate.setString(entryDate);

        int h = logincalenda.get(Calendar.HOUR_OF_DAY);
        int m = logincalenda.get(Calendar.MINUTE);
        int s = logincalenda.get(Calendar.SECOND);
        String thetime = (h < 10 ? "0" : "") + h + "." + (m < 10 ? "0" : "") + m + "." + (s < 10 …
majestic0110 commented: Making it count ! +5
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

In similar fashion as you query database to see what is available in stock you can link your customer purchase order action(on any website seen as button to "Confirm" after you provided delivery address and payment details) to a method in servlet to take data stored in order form to construct UPDATE query. Query will decrement you stock by certain amount, this would need to be done with sub-queries (query inside query) plus in same time you should also create new entry for new purchase order in different set of tables.
If you are more experienced with database you can even set up procedure for this sort of task.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Read following rule and act on it...