Removing <?xml version="1.0"?> from the output of XSLTProcessor->transformToXml()
<xsl:output method="html" />
Thanks to this post on php.net for the answer:
http://us3.php.net/manual/en/xsltprocessor.transformtoxml.php#80887
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
What next?
1. Bookmark us with del.icio.us or Digg Us!
2. Subscribe to this site's RSS feed
3. Browse the site.
4. Post your own code snippets to the site!
<xsl:output method="html" />
open -a Automator #-------------------------------------------------- Drag or add actions here to build your workflow: Library: Finder -> Action: Get Selected Finder Items Library: Automator -> Action: Run Shell Script - Shell: /bin/sh - Pass input: as arguments if [[ $# -gt 1 ]]; then exit 0; fi if [[ -d "$@" ]]; then printf "%s" "$@" | /usr/bin/pbcopy #/usr/local/bin/cpath # cf. http://osxutils.sourceforge.net /usr/bin/open -a Terminal /usr/bin/osascript -e 'tell application "Terminal" to do script with command "printf \"\\e[8;26;115;t\"; printf \"\\e[3;300;240;t\"; cd \"$(/usr/bin/pbpaste)\"; /usr/bin/clear" in (first window whose name contains " ")' # alternative without /usr/bin/clear (experimental) # requires: # defaults write com.apple.Terminal Autowrap NO # or: # Terminal menu -> Window Settings ... -> Buffer -> in the Scrollback # section check the box next to "Wrap lines that are too long" # -> click "Use Settings as Defaults" # /usr/bin/osascript -e 'tell application "Terminal" to do script with command "cd \"$(/usr/bin/pbpaste)\"; /usr/bin/tput cup 0 0; /usr/bin/tput dl1; /usr/bin/tput el; /usr/bin/tput dl1; /usr/bin/tput el" in (first window whose name contains " ")' exit 0 elif [[ -r "$@" ]]; then printf "%s" "$@" | /usr/bin/pbcopy /usr/bin/open -a Terminal /usr/bin/osascript -e 'tell application "Terminal" to do script with command "printf \"\\e[8;26;115;t\"; printf \"\\e[3;300;240;t\"; /usr/bin/clear; /bin/sleep 0.3; /usr/bin/nano \"$(/usr/bin/pbpaste)\";" in (first window whose name contains " ")' exit 0 fi exit 0 #-------------------------------------------------- open -a Automator ~/Library/Workflows/Applications/Finder/openterminal.workflow
select * from table where (bit_sum & bit) = bit
<?php class xml { var $dom; var $uri; function xml($uri) { $this->dom = new DOMDocument(); if(preg_match('/\.xml$/', $uri)) { $this->uri = $uri; } else { $this->uri = $this->create($uri); } $this->dom->load($this->uri); } function set($query, $value) { $path = new DOMXPath($this->dom); $nodes = $path->query($query); $nodes->item(0)->nodeValue = $value; } function get($query) { $path = new DOMXPath($this->dom); $nodes = $path->query($query); return $nodes->item(0)->nodeValue; } function save() { $this->dom->save($this->uri); } function create($uri) { // Build the URI of the template file. $template = sprintf('%s/0.xml', $uri); // If the directory doesn't exist, we can't really // do anything. if(!is_dir($uri)) { exit('No directory'); } // If the template file doesn't exist, we cannot // create a new file automatically. if(!file_exists($template)) { exit('No template'); } // Load the template XML into our DOMDocument. $this->dom->load($template); // Scan the directory into an array. $dir = scandir($uri); // Pull out the highest ID $id = str_replace('.xml', '', array_pop($dir)); // Add one to it $id++; // Construct the new path with the new ID $uri = sprintf('%s/%s.xml', $uri, $id); // Save the new file $this->dom->save($uri); // Return the URI of the new XML file. return $uri; } } // The following code will create a new XML file // under the directory /var/www/data/users. $x = new xml('/var/www/data/users'); $x->set('//user/name', 'John Doe'); $x->save(); ?>
SELECT * FROM Table1 INNER JOIN Table2 ON Table1.col LIKE '%' + Table2.col + '%'
#!/bin/sh for file in `ls *.java` do sed -e "s/old.package.name/new.package.name/" $file > /tmp/tempfile.tmp mv /tmp/tempfile.tmp $file done
find . -type f -exec grep <pattern> {} \;
[user@host ~]$ find . -type f -exec grep Vista {} \;
cd /usr/src/ sudo wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.2.tar.gz sudo tar zxvf haproxy-1.3.15.2.tar.gz sudo aptitude install libpcre++-dev sudo make TARGET=linux26 CPU=i386 USE_STATIC_PCRE=1 sudo make install sudo haproxy -f /etc/haproxy/haproxy.conf
sudo mkdir /etc/mongrel_cluster sudo ln -s /mnt/app/ticketsolve/shared/config/mongrel_cluster_new_production.yml /etc/mongrel_cluster/mongrel_cluster_new_production.yml sudo cp /usr/bin/mongrel_cluster_ctl /etc/init.d/ sudo chmod +x /etc/init.d/mongrel_cluster_ctl cd /etc/init.d/ sudo /usr/sbin/update-rc.d -f mongrel_cluster_ctl defaults
xv -root -quit -maxpect ~/images/blah.jpg