Andrew Moores

Greenhorn
+ Follow
since May 28, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andrew Moores

Elwal

The javac program is a commandline utility. Double clicking it will not work. I haven't read the book you are using but I'm sure it will show examples of how to compile from the command line (I assume you are familair with the commandline?). It should also walk you through setting your PATH and CLASSPATH variables. There are lots of good starter tutorials on how to do this if you careto google for them.

Let me know if you're still having a problem.

Andrew
15 years ago
Hi Scott

I enjoyed your article and will be spending some time following the links to get some more background. I have a few comments that I would like to hear your opinion on.

Code and fix is often the way maintenance programmers have to work when they have to fix something or introduce a "simple" new feature and get it into production yesterday. This works well in an unbelievable number of cases but no-one who cares about what their doing wants to work this way for long.

Taking a toolkit approach is how I like to work as well. Some clients I've had don't include use cases in their required artifacts lists, but I use them for my own benefit on the way to delivering the requirement artifact in the format required by the client.

Its strange that when we're building software we'll look to re-use code; search out design patterns and new algorithms; and pick up third party APIs to help build better software but rarely do organisations allow this approach to their development methodologies. If you�re following DSDM you can not start creating use case diagrams! But if they are useful to you at that point then why not?

I try to find the best techniques to fit the people involved as you advocate. But I'm also happy to combine things from various methodologies if they work as I need them to. One example is uses cases. Use cases are a great way to document requirements but they can be put together in a very "flexible" manner (i.e. they are difficult to structure). I find that designing the structure (i.e. the template and guidelines) of a use case based on how the stakeholders are describing the requirements to me always works best. For instance if a stakeholder can only make a requirement clear with the aid of a diagram that is peculiar to him I'll always include that in a use case. Obviously an explanation of what it means and how to read it is needed but it keeps everyone who is working from the use case in touch with the domain experts way of thinking.

An organisation needs to pick a methodology that suits a project type. But I would say they also need to be flexible and bring in elements from other methodology�s and devise their own artifacts if required. However, there are benefits to be gained from sticking to a methodology with some rigour as it can allow junior employees to be used well and if you suffer from high staff turnover (lots of contractors or off-shoring) a fixed and predictable methodology is easier to get into than a bespoke methodology.

As you say its always about finding the sweet spot. Listen to a particular methodology�s evangelists and then take the best bits back to the real world to use.

Andrew
I assume the servlet is running successfully in Tomcat. If so, to debug it from eclipse you need to make some changes to the tomcat start-up script along the following lines:

set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=6666 (You can change this number if you don't like it!)
catalina jpda start

Then, from eclipse create a new debug configuration for a remote Java application and specify the port as defined above.

When you run in debug mode Eclipse will connect to the VM used by Tomcat. Take a look at the Tomcat docs as they explain this better than I can here, but this should help you to get going.

Andrew
15 years ago
Denise

It sounds like you might want to forward the request or redirect to another page. It's not completely clear to me what you are trying to do though. Can you expand on "the response comes back in the same url"? If I understand correctly, you have written a jsp that invokes some legacy code by sending an http request for a url? Do you send this request to a web server that executes some CGI? When the request is fullfilled an http response is sent back, presumably, containing the results you need to process.

Maybe a couple of code snipets would clarify the situation.

Andrew
15 years ago
JSP
Ryan

Like I said it depends on how your web host supports Tomcat, they should be able to give you a guide on how to get a web app going.

The way you have got your JSP working could be better. If you want to build on this example produce a web app including servlets, etc you'll need to get a web.xml file and understand how it works.

Regards
Andrew
15 years ago
JSP
Ryan

Try creating a WEB-INF sub-directory and mive the web.xml file from you local set-up on the server. If everything works well on your local PC then you need help from the web host. Did you use Tomcat on your local PC to test the JSP?

Regards
Andrew
15 years ago
JSP
Ryan

My advice would be to initially get things working on your local PC before trying to get it working with a web host. Get the relevant download from the Tomcat site and install it on your PC. This will allow you to play around with the config. The way that web hosts provide Tomcat as a service differs, some don't allow you access to the server.xml file and some do. They may want you to upload your web applications as a war file that will be automatically deployed. Either way they should supply you with detailed instructions on how to do this. Who is your hosting company? Do you have any documentation regarding Tomcat from them? It may be that you html directory has been mapped as web app in server.xml and that you need to create a WEB-INF sub-directory here. You'll still need a web.xml file in WEB-INF.

It will help you if you have something that you know works before you attempt to get it working with a third party. Installing Tomcat under Windows is a breeze. Once installed you can look at the conf directory and see the server.xml file, it has comments regarding the structure and you should read them through. You will also see a directory called webapps, this is where the web applications live by default. Have a look in the jsp-examples sub-directory and you'll see how things should be organized and some good examples.

Let me know how you get on.

Andrew
15 years ago
JSP
Ryan

You didn't mentioned the web server you are using to access the JSP. It sounds like you aren't accessing your JSP via a suitable servlet container such as Tomcat. If you're using Tomcat you need to have a web.xml file in the WEB-INF directory and you'll need to modify the Tomcat server.xml file if you want to locate your JSPs outside of the standard Tomcat directories as you are attempting to do.

Give me some more info about your set-up and I'll help you get it working.

Regards
Andrew
15 years ago
JSP
I think the issue lies with the println method. When you use println with a String type reference variable println figures out that it should actually call the toString() method to get the string of characters. So if you have a variable String x = null, System.out.println("x is " + x) will compile and will run, printing 'x is null'.

However if you make the parameter a call to a method then this functionality is lost. So, System.out.println("X is " + x.toString()) will give NullPointerException.

When you call the method the result will be the value null, and the value null will be passed to println. However if you place a reference variable in the argument list then a copy of the reference variable (from which its type can be determined) is passed instead. From the value null println can have no way of knowing if the null has come from an object of type String or some other object type and so it decides that it must self destruct and give a NPE.

--Andrew
Using you https connection will allow data to be encrypted while it is sent. It will not give you assurance that the data is valid or that it comes from a trusted person. On the server you will not be able to associate the data to a known source by any means other than the user name and password, provided after the https connection has been established (presumably you will use http authentication for this).

I think the solution for MIDP1 that you are looking for is something like the following:

1. Generate an asymmetric key pair on the server.
2. Include this public key in the phone software (the same key will be used by all phones).
3. When you establish connections from the phone create a new symmetric key on the phone and RSA encrypt it using the servers public key.
4. The server can then decrypt the symetric key using its private key and this key can then be used to encrypt data in both directions.

You then need to work out a sequence for sending the username and password from the phone to the server, the server responds with the questions and the answers follow after that.

The key will only be good for the life of the connection.

There are a number of drawbacks with this solution but it may suffice for what you are attempting.

Let me know if you need more information.

--Andrew
15 years ago
Svend, I'm no expert on MIDP but I have built an application that transfers sensitive data over the Internet.

A connection using https is not 100% secure (nothing is 100% secure). Using ssl the following happens: your data is encrypted, then sent over the internet, then decrypted and stored locally on the recipient. (This is a very simple view). The data is 'safe' during transmission but may not be safe on the source or recipient machine. If someone snoops your data during transmission they may not be able to read it straight away but over time they may be able to crack it. Your hope is that by the time someone cracks your encryption the data is useless or that it is of little value when measured against the cost of the effort of cracking the code.

The second question you ask needs some clarifying (I assume that MIDP1 precludes the use of https (ssl)):

Why do you need a unique key?
Your plan to allow a Java app to be downloaded to the phone and then used to connect back to your server and send data in an encrypted form?
Anyone will be able to download this application as it will be available on a web site?
You need to gain confidence that the person connecting to your server is really who they say they are and then to encrypt their data when transmitted?
15 years ago
You don't need to install Apache to get started with Tomcat.

Apache is a web server and Tomcat is Java Servlet container. This means Apache simply sends back an http messages containing files (html pages, jpgs, etc.) or runs simple scripts and sends the output from these scripts back in the http message.

Tomcat can perform the same functions but in addition it will also run Java programs (known as Servlets) and process JSPs. JSPs are files containing JSP tags, or instructions, that Tomcat will execute in order to produce a plain html file that can be sent to the users browser for viewing. Tomcat gives you Java in your html pages and the ability to run Java programs.

However, Tomcat can also serve all the different types fo files that Apache serves.

When you install and run Tomcat you access the home page using something like http://localhost:8080/. This indicates to your browser that server you want to talk to is listening on port 8080. Apache usually listens on port 80 which is the default port for http. When you get to the Tomcat homepage you can read the Tomcat documentation.

When you're comfortable with Tomcat and have explored JSP and written some servlets you might want to try using Tomcat in tandem with Apache. The optimal set-up is to use Apache to process all the standard web components (plain html files, image files, etc) and to forward requests for JSPs and Java Servlets on to Tomcat. There a lots of advantages to this set-up. Let me know if you need some help getting Tomcat and Apache working as it took me a while to figure it out the first time.

This is a brief description and the truth and Apache and Tomcat is much deeper than I've described here but hopefully this have given you enough information to dive and try Tomcat!

--Andrew
15 years ago