devxlogo

Tip Bank

Using the GRANT Command

The SQL GRANT command is used to grant access privileges to database objects and role authorizations. For example, the following statement grants the user username the right to SELECT tabname:

Use an XMLReporter for Report Customizable Errors in StAX Applications

To customize error reports in StAX applications (except fatal errors), you can configure an XMLReporter like this: XMLInputFactory XMLif=null; //get an XMLInputFactory objectXMLif=XMLInputFactory.newInstance();//setting an XMLReporterXMLif.setXMLReporter(new XMLReporter() { public void report(String

Using StAX to Clone an XML Document

To clone an XML document at runtime, use the StAX XMLEventReader and XMLEventWriter classes like this: //AirWings_order.xml – the original XML in this example//AirWings_order_clone.xml – the clone of AirWings_order.xmlimport javax.xml.stream.*;import

Override a Child Class’ Parent Method

C# seems to fail in an advanced use of polymorphism, as demonstrated by the following code: class AReturn {}class BReturn : AReturn {}class A{ public virtual AReturn GetReturn() {…}}class B{

Load an Image Using the JAI API

This tip shows you how to use the JAI API to load an image named myimage.jpg in just three lines of code: ParameterBlock parameterBlock=new ParameterBlock();parameterBlock.add(“myimage.jpg”);myimage=JAI.create(“fileload”,parameterBlock);…