Search This Blog

Wednesday, July 31, 2013

Windows 7 good to know

Screenshots or snapshots with onboard tool

With Windows 7 you don't need external tools like snagit, gimp, etc. Just use the SnippingTool, which ships with Windows 7!


Send to clipboard as path or name

Well who hasn't used the windows 95 powertoys? One of the need features was "Send to Clipboard as..." which has copied the currently selected file or folder and copied the name or path of it to the clipboard. 
With windows 7 just hold shift key while right clicking the selected files and you will find a new entry within the context menu "Copy as Path". 

Tuesday, July 16, 2013

Pretty print a SOAP Message

Here's a code snip for pretty printing a SOAP message 

import java.io.ByteArrayOutputStream;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;


    private static final Logger LOG = Logger.getLogger(PrettyPrint.class);
 

    /**
     * Pretty print the XML SOAP message
     *
     * @param source the source payload of a SOAP response or request
     * @return the pretty format of the SOAP message
     */

    private String getPrettyPrintSoapSource(Source source) {
        try {
            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer t = tf.newTransformer();
            t.setOutputProperty(OutputKeys.INDENT, "yes");
            t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");

            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            StreamResult result = new StreamResult(bos);
            t.transform(source, result);
            return bos.toString();
        } catch (Exception e) {
            LOG.error("Error while pretty printing SOAP source", e);
            return "Error while pretty printing SOAP source";
        }
    }