Just a method to extract Sub - XML from XML using XPath in Java
public String extractResponseData(String responseXML) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException, TransformerException {
XPathExpression expr = XPathFactory.newInstance().newXPath().compile("//responsedata/*");
InputSource inputSource = new InputSource(new ByteArrayInputStream(responseXML.getBytes()));
NodeList nodeList = (NodeList) expr.evaluate(inputSource, XPathConstants.NODESET);
StringWriter sw = new StringWriter();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.transform(new DOMSource(nodeList.item(0)), new StreamResult(sw));
return sw.toString();
}
Install multiple Firefox versions
In windows, to install multiple firefox versions do the following steps:
0. close all the firefox windows.
1. Install various versions of firefox in your system INTO DIFFERENT DIRECTORIES.
2. run the following command and create one profile for each version.
c:\Program Files\Mozilla Firefox\firefox.exe -profilemanager
3. Run the fireforx with -p
eg:
"C:\Program Files\Mozilla Firefox 3.5\firefox.exe" -p ff3_5
"C:\Program Files\Mozilla Firefox\firefox.exe" -p ff4_0
Now, you can open both the firefox versions at once.
0. close all the firefox windows.
1. Install various versions of firefox in your system INTO DIFFERENT DIRECTORIES.
2. run the following command and create one profile for each version.
c:\Program Files\Mozilla Firefox\firefox.exe -profilemanager
3. Run the fireforx with -p
eg:
"C:\Program Files\Mozilla Firefox 3.5\firefox.exe" -p ff3_5
"C:\Program Files\Mozilla Firefox\firefox.exe" -p ff4_0
Now, you can open both the firefox versions at once.
Accessing files through FTP using browser in linux
The following will work with Ubuntu Linux, use appropriate commands for other distros.
One way of accessing log files and other files from server, is to setup an FTP server so that it can serve log files and other files. The user should be able to access the server’s log files using a browser by accessing a url [eg: ftp://abcd.com]
NOTE: make sure the port 20 is opened or setup Apache to do appropriate proxying.
1. download and setup an ftp server, in this example we use vsftpd
2. after the setup is complete modify its configuration file in /etc/vsftpd.conf
1. Add the following config settings:
1. to give anonymous access:
1. anonymous_enable=YES
no_anon_password=YES
2. to enable browser to be used as an ftp client, the ftp should support passive mode
1. pasv_enable=YES
pasv_max_port=51000
pasv_min_port=50000
port_enable=YES
3. to change the default directory, and enable custom directory to be served by ftp server
1. local_root=/home/[user]/tools/tomcat7/logs
anon_root=/home/[user]/tools/tomcat7/logs
Restart the server to make the changes affected:
sudo service vsftpd restart
One way of accessing log files and other files from server, is to setup an FTP server so that it can serve log files and other files. The user should be able to access the server’s log files using a browser by accessing a url [eg: ftp://abcd.com]
NOTE: make sure the port 20 is opened or setup Apache to do appropriate proxying.
1. download and setup an ftp server, in this example we use vsftpd
2. after the setup is complete modify its configuration file in /etc/vsftpd.conf
1. Add the following config settings:
1. to give anonymous access:
1. anonymous_enable=YES
no_anon_password=YES
2. to enable browser to be used as an ftp client, the ftp should support passive mode
1. pasv_enable=YES
pasv_max_port=51000
pasv_min_port=50000
port_enable=YES
3. to change the default directory, and enable custom directory to be served by ftp server
1. local_root=/home/[user]/tools/tomcat7/logs
anon_root=/home/[user]/tools/tomcat7/logs
Restart the server to make the changes affected:
sudo service vsftpd restart
Subscribe to:
Posts (Atom)