Solr, DataImportHandler, UUID and SQL Server

I’ve recently been setting up Apache Lucene/Solr to index static PDF files and also import data to the collection from MS SQL Server.

After successfully indexing PDF files and providing them with a unique id via UUID I wanted to import several SQL tables that each had a ID column called ‘id’. These tables would obvioulsy have overlapping ID’s at some stage so I wanted to use UUID on these documents as well.

I struggles to find much documentation on Solr, SQL Server and UUID, but after successfully setting up UUID via http://wiki.apache.org/solr/UniqueKey, you also need to the UpdateRequestHander on the dataimport handler as well. Therefore the following code:

<requestHandler name=”/dataimport” class=”org.apache.solr.handler.dataimport.DataImportHandler”>
<lst name=”defaults”>
<str name=”config”>db-data-config.xml</str>
</lst>
</requestHandler>

changed to this

<requestHandler name=”/dataimport” class=”org.apache.solr.handler.dataimport.DataImportHandler”>
<lst name=”defaults”>
<str name=”config”>db-data-config.xml</str>
<str name=”update.chain”>uuid</str>
</lst>
</requestHandler>

then auto creates unique id’s when importing on mass from SQL Server tables.

RGB to HEX Converter

Working with CSS I am constantly trying to convert RGB values from Photoshop to their hex equivalent. There is probably a setting in PhotoShop that I have missed, but the following small form will quickly convert RGB values to the HEX equivalent. You can then use these values in CSS with # at the beginning.

Let me know if you find this useful:

R:
G:
B:
:

HTTP Response Header Checker

HTTP Response Header Checker

FAIL, “.$url.” does not exist”;
} else {
if(empty($info[“path”])) {
$info[“path”] = “/”;
}
$query = “”;
if(isset($info[“query”])) {
$query = “?”.$info[“query”].””;
}
$out = “HEAD “.$info[“path”].””.$query.” HTTP/1.1\r\n”;
$out .= “Host: “.$info[“host”].”\r\n”;
$out .= “Connection: close \r\n”;
$out .= “User-Agent: RJPargeter.com Response Header Checker v1.0 – rjpargeter.com/contact for feedback\r\n\r\n”;
fwrite( $fp, $out );
$html = “”;
while ( !feof( $fp ) ) {
$html .= fread( $fp, 8192 );
}
fclose( $fp );
}
if(!$html) {
$message = “FAIL, “.$url.” does not exist”;
} else {
$headers = explode(“\r\n”, $html);
unset($html);
for($i=0;isset($headers[$i]);$i++ ) {

//if(preg_match(“/HTTP\/[0-9A-Za-z +]/i” ,$headers[$i])) {
// $status .= preg_replace(“/http\/[0-9]\.[0-9]/i”,””,$headers[$i]);
//}
}
//$message = $status.” “.$response_array[$status];
}
}
?>
The HTTP Response is the information returned in the HTTP Protocol when you access URL’s over the Internet. Google, Yahoo and in fact all browsers rely on this information to determine if the information you are trying to access has been found or if not what may of happened to it.

The full HTTP response contains a variety of information that a web server will send in response to a HTTP request. This information can yield interesting information such as the web server a site is hosted upon, the scripting language used and most importantly the response code. The following search box allows you to enter a URL and see the full HTTP Response.

Why is this useful you may be thinking? Well Google, etc rely on the response codes to determine if they index your site. For a resource to be indexed you will most often than not be looking for a ‘200 ok’ response. If a page is missing you may get a ‘404 page not found’. If a page has gone you may look for a ‘410 Gone’ response to be sent back.

Feel free to use this tool I have developed to test your URL’s HTTP response:

Domain:


Response Code:“;
for($i=0;isset($headers[$i]);$i++ ) {
echo “
” , $headers[$i];
}

} else {
echo “Response Code:
“;
echo $message;
}

?>