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";
}
}
All these little things in life They all create this haze There's too many things to get done And I'm running out of days (3Doors Down)
Dieses Blog durchsuchen
Dienstag, 16. Juli 2013
Mittwoch, 10. April 2013
No spaces in Misson Control Mac OSX 10.8.3
I like misson control (aka Exposé) in Mac OSX and the spaces functionality, which allows you to control multiple desktops in Mac OSX. Sincce 10.8.3 I noticed sometimes that the spaces just won't show up anymore in Misson Control. To me it seems to be a problem with the Dock as well. The Dock doesn't display correctly. So open up a terminal and enter
killall Dock
after that your spaces within Mission Control will be back and the Dock will restart.
killall Dock
after that your spaces within Mission Control will be back and the Dock will restart.
Donnerstag, 4. April 2013
How to export a google docs document with comment to pdf
If you export a document with google docs to pdf you will loose all your comments. Heres a way to export the doc with comment
- Export google docs document to .odt open office file
- Open document in OO
- Go to export as PDF and select the "export comments" option
- Export to PDF with comment
Mittwoch, 26. September 2012
Show Hidden Files in MACOSX
to display hidden Files in Macosx Finder enter the following cmds in your console:
defaults write com.apple.Finder AppleShowAllFiles TRUE
defaults write com.apple.Finder AppleShowAllFiles TRUE
killall Finder
Mittwoch, 29. August 2012
Js Modules with Titanium Appcelerator Framework
Here are the two ways you could currently use JS modules within the Titanium Mobile Framework from appcelerator:
// an internal variable, which is only accesible within the module
var internalMsg = "Only visible within the module";
// an exported function, which this module offers
1. Function Module
Assume you have a FunctionModule.js with the following content:// an internal variable, which is only accesible within the module
var internalMsg = "Only visible within the module";
// an exported function, which this module offers
exports.hello = function(msg) {
alert('your message: ' + msg + ' internal message: ' + internalMsg);
}
you could use you module like this:
// call the exported function
// no access from the outside to the internal variable
alert('interal var from module: ' + fmo.internalMsg)
you could use you module like this:
you could use you module like this:
// reference the module
var fmo = require('/ui/common/FunctionModule');// call the exported function
fmo.hello('External Message');
// no access from the outside to the internal variable
alert('interal var from module: ' + fmo.internalMsg)
2. Object Module
Assume you have a ObjectModule.js with the following content:
// constructor of your object
function Sample(name) {
this.name = name;
}
// function, which alerts the current name
Sample.prototype.showName = function() {
alert('Name: ' + this.name);
}
// function, which sets the name
Sample.prototype.setName = function(name) {
this.name = name;
}
// you just export your Object and override the methods as prototypes
module.exports = Sample;
you could use you module like this:
// reference the module
var SampleModule = require('/ui/common/ObjectModule');
// Create a sample Object
var sam = new SampleModule('Fred');
// call a Method
sam.showName();
// change the internal name
sam.setName('Hugo');
sam.showName();
Dienstag, 21. August 2012
Avoid the git username password prompt
Coming from cvs and svn I tend to clone git repos with https, which work but ask for the username password every time you connect.
To avoid the prompt you should use the ssh url an be done with it. If you already use a repo and want to switch to ssh follow the following steps
1. git remote show origin
Password for 'https://username@bitbucket.org':
* remote origin
Fetch URL: https://username@bitbucket.org/username/reponame.git
Push URL: https://username@bitbucket.org/username/reponame.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
2. git remote set-url origin git@bitbucket.org:username/reponame.git
3. git remote show origin
* remote origin
Fetch URL: git@bitbucket.org:username/reponame.git
Push URL: git@bitbucket.org:username/reponame.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
You can easily get the URL for your repo from your Github, bitbucket or wherever you are hosting your repo. If you get a response i.e. like this
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
then you might forgot to put your ssh key on the github repo server.
To avoid the prompt you should use the ssh url an be done with it. If you already use a repo and want to switch to ssh follow the following steps
1. git remote show origin
Password for 'https://username@bitbucket.org':
* remote origin
Fetch URL: https://username@bitbucket.org/username/reponame.git
Push URL: https://username@bitbucket.org/username/reponame.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
2. git remote set-url origin git@bitbucket.org:username/reponame.git
3. git remote show origin
* remote origin
Fetch URL: git@bitbucket.org:username/reponame.git
Push URL: git@bitbucket.org:username/reponame.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
You can easily get the URL for your repo from your Github, bitbucket or wherever you are hosting your repo. If you get a response i.e. like this
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
then you might forgot to put your ssh key on the github repo server.
Dienstag, 17. Juli 2012
Timeout für das Umschalten auf die Voicemail einstellen
Wie stelle ich die Dauer für das Umschalten auf die Voicemail (IPhone) bei T-Mobil/Telekom ein?
**61*3311*11*XX#
eingeben. Wobei unter XX die Dauer eingestellt werden kann 5, 10, 15, 20, 25 oder 30 Sekunden.
**61*3311*11*20#
schaltet z.B. die Voicemail nach 20 Sekunden klingeln lassen ein.
Abonnieren
Posts (Atom)



