PHP generated XML shows invalid Char value 27 message

A useful function to get rid of that error is suggested on this website. http://www.phpwact.org/php/i18n/charsets#common_problem_areas_with_utf-8 When you put utf-8 encoded strings in a XML document you should remember that not all utf-8 valid chars are accepted in a XML document http://www.w3.org/TR/REC-xml/#charsets So you should strip away the unwanted chars, else you’ll have an XML fatal … Read more

PHP “pretty print” HTML (not Tidy)

you’re right, there seems to be no indentation for HTML (others are also confused). XML works, even with loaded code. <?php function tidyHTML($buffer) { // load our document into a DOM object $dom = new DOMDocument(); // we want nice output $dom->preserveWhiteSpace = false; $dom->loadHTML($buffer); $dom->formatOutput = true; return($dom->saveHTML()); } // start output buffering, using … Read more

Select groups which have at least one of a certain value

This turns out to be pretty easy: you just need to use the any() function in the filter call. Indeed, it appears that: filter(any(…)) evaluates at the group_by() level, filter(…) evaluates at the rowwise() level, even when preceded by group_by(). Hence use: df %>% group_by(Group) %>% filter(any(Value==4)) Group Value <fctr> <int> 1 B 3 2 … Read more

tech