Archive for Technology

Installer encountered an error: 0×80070422

// February 26th, 2009 // 2 Comments » // Technology

There are times when it becomes painfully obvious just Why I Avoid Windows as much as possible…

Today I downloaded the Windows Media Streaming Server package for Windows 2008 Server x64 from Microsoft, and when I tried to install it I got the following pretty, intuitive and self-explanatory error message:

windows error 300x129 Installer encountered an error: 0x80070422

Installer encountered an error: 0×80070422
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

What this actually means is “This software package requires that the Windows Update Service and that BITS (Background Intelligent Transfer Service) are running during installation”.

Now, granted, it was not all that difficult to find this answer on Google. But really, wouldn’t it be much easier just to have more descriptive error messages to begin with?

Oh well. In a perfect world perhaps.

Updated: RSS Autodiscovery with PHP

// April 4th, 2008 // No Comments » // Technology

Found an excellent function made by Keith Devens for autodiscovery of RSS feeds on a website.

The only issue I had with it was that a lot of news sites these days publish more than one RSS feed, so I updated the code to return an array of feeds instead of only the first one + I made it fetch the body of the page instead of supplying it in the call.

This is what I got:


function getRSSLocation($location = false){

$html = file_get_contents($location);
$feeds = array();

if(!$html or !$location){
return false;
}else{
#search through the HTML, save all tags
# and store each link's attributes in an associative array
preg_match_all('/ /si', $html, $matches);
$links = $matches[1];
$final_links = array();
$link_count = count($links);
for($n=0; $n<$link_count; $n++){
$attributes = preg_split('/\s+/s', $links[$n]);
foreach($attributes as $attribute){
$att = preg_split('/\s*=\s*/s', $attribute, 2);
if(isset($att[1])){
$att[1] = preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1]);
$final_link[strtolower($att[0])] = $att[1];
}
}
$final_links[$n] = $final_link;
}
#now figure out which one points to the RSS file
for($n=0; $n<$link_count; $n++){
if(strtolower($final_links[$n]['rel']) == 'alternate'){
if(strtolower($final_links[$n]['type']) == 'application/rss+xml'){
$href = $final_links[$n]['href'];
}
if(!$href and strtolower($final_links[$n]['type']) == 'text/xml'){
#kludge to make the first version of this still work
$href = $final_links[$n]['href'];
}
if($href){
if(strstr($href, "http://") !== false){ #if it's absolute
$full_url = $href;
}else{ #otherwise, 'absolutize' it
$url_parts = parse_url($location);
#only made it work for http:// links. Any problem with this?
$full_url = "http://$url_parts[host]";
if(isset($url_parts['port'])){
$full_url .= ":$url_parts[port]";
}
if($href{0} != '/'){ #it's a relative link on the domain
$full_url .= dirname($url_parts['path']);
if(substr($full_url, -1) != '/'){
#if the last character isn't a '/', add it
$full_url .= '/';
}
}
$full_url .= $href;
}
if(!in_array($full_url, $feeds))
$feeds[] = $full_url;
}
}
}
return $feeds;
}
}