Francis Shillitoe

Greenhorn
+ Follow
since Aug 30, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Francis Shillitoe

egrep (grep -E in linux) is extended grep where additional regular expression metacharacters have been added like +, ?, | and ()

fgrep (grep -F in linux) is fixed or fast grep and behaves as grep but does not recognise any regular expression metacharacters as being special.

Francis
18 years ago
Hi Muthya,

You can hot deploy by packaging your application as a war or an ear and using the ant wldeploy target:

http://e-docs.bea.com/wls/docs81/programming/environment.html#1096955

regards,

Francis
18 years ago
The web.xml file in a web app is the place to define role mappings between roles and URLs to protect. See the <security-constraint> tag.

Francis
19 years ago
UTF-8 is not Unicode, it is a way of encoding unicode. See:

http://www.cl.cam.ac.uk/%7Emgk25/unicode.html#unicode

for a good explanation of the differences.

If you are finding that on one system your program is working correctly and outputting chinese characters, and on another it is not (maybe it is printing empty squares or question marks), this is almost certainly a font issue. You need to have a unicode font installed (such as the Microsoft Arial Unicode font available on an MS Office CD), to see the full range of characters in a UTF-8 encoded file.

All these sorts of issues are covered under the subject of Intenationalization (I18N). This is a good site on the subject:

http://www.joconner.com/javai18n/

regards,

Francis
19 years ago
As you read and understand the code as you go, javadoc it, to make it easier for the next person. You can use UML class diagrams to show the class abstractions you describe. UML sequence diagrams are also very useful to show various runtime scenarios. There are tools which can automatically reverse engineer code into models such as TogetherJ and Ration Rose XDE.

Francis
19 years ago
Strings in java are always stored in unicode UCS-2 (also know as UTF-16). When you ask how can you determine the encoding of a String, I assume you mean some series of bytes in a file. Unfortunatley, there is no way to determine this from the bytes alone, you have to know the character encoding used to encode the characters into bytes. To get non-ascii characters into a String in a java source file you can use \u. Character sets are simply mappings between a number and a character (e.g. Unicode). Character encoding are mappings between this number and a sequence of bytes (e.g. UTF-8, UTF-16).

String myString = "\u0048\u0065\u006C\u006C\u006F World";
System.out.println(myString);
byte[] myBytes = null;

try
{
myBytes = myString.getBytes("UTF-8");
} catch (UnsupportedEncodingException e)
{
e.printStackTrace();
System.exit(-1);
}

for (int i=0; i < myBytes.length; i++) {
System.out.println(myBytes[i]);
}


Francis
19 years ago
Here's some suggestions, in pseudo-code.

The BankDatabase class represents an OO view of the file.
The find, update, insert commands result in file read/writes.

class BankDatabase {
-path:File

BankDatabase(File path):void
+findCustomer(id:int): CustomerRecord
+updateCustomer(record:CustomerRecord):void
+insertCustomer(record:CustomerRecord):void
}

The CustomerRecord class contains your getters and setters

class CustomerRecord {
+getName():String
+setName(name:String):void
+getID():int
+setID(id:int):void
...
}


The BankApplication class is your application entry point. From here, you can either create a GUI or CLI (command line interface) and enter an event loop to wait for user input.

class BankApplication {
+main(args:String[]):void
}


hope this gives you some ideas,

Francis
19 years ago

Originally posted by M Beck:
i thought ISO 8859-1 was an 8-bit proper superset of ASCII. wouldn't that make any eight-bit sequence potentially valid ISO 8859-1? are there any codes outright disallowed by this standard?



I agree. Any 8-bit sequence is potentially ISO 8859-1. This is why web sites set an encoding value in the http response so the browser knows which character set to display the response in. Unless your input stream contains some pre-determined marker to indicate it is ISO 8859-1 or you trust the source you are not going to know the encoding.

Francis
19 years ago
I would think that you would use different controller classes. It wouldn't make much sense to shoe horn Swing/AWT events into a controller based on servlets. Servlets are used for dealing with HTTP requests. Although HttpServlet is a subclass of GenericServlet, I've never seen anyone implement non-HTTP servlets by subclassing straight from GenericServlet rather than from HttpServlet. Of course, you can use the same business logic layer for serving your Swing or HTTP controllers. You may even find ways to factor out various controller functions into handler objects that can be used by both the Swing and HTTP controllers.

Francis
Rational XDE can generate sequence diagrams from code. Basically, you use a record function in the tool, which links into the JVM of the running application. Then you run through a scenario in your application and XDE models it as a sequence diagram. You'll just want to run through a few key scenarios to describe the essence of your application. Genrating too many sequence diagrams won't necessarily aid others understanding of your application.

Francis
As part of my SCEA studying, I've put together a one page quick reference chart to design patterns:

http://www.shillitoe.com/DesignPatternsInJavaQuickReference.pdf

It prints out nicely to A4 or A3 (landscape).

Hope you find it useful. Any feedback would be appreciated.

Francis
Enable URL re-writing on the app server, and this should add a jsessionid to your URLs, thus enabling a session to be maintained on the server.

Francis
19 years ago
JSP
Make sure you set the response header to UTF-8 and that a suitable font (either one of the extended latin ones or a unicode font) is installed on the OS on the client. If the client is MS Window, I find installing the Arial Unicode MS font from an MS Office CD solves most of these problems.

Francis
19 years ago
You can escape a single quote in Sybase by using two single quotes together. So try replacing your ' with ''

Francis
The choice to use EJBs or not shouldn't really be based on your team's SQL knowledge. The decision to use EJBs should be based on whether the following services are required:

- Transaction support
- Management of multiple instances (pooling)
- Persistence support
- Security support
- Multithreading support
- Synchronisation

The excellent book "Mastering Enterpise Jave Beans" can be downloaded FREE from:

http://www.theserverside.com/books/wiley/masteringEJB/index.tss

Francis