Showing posts with label http. Show all posts
Showing posts with label http. Show all posts

Thursday, June 05, 2014

A quick map of my current home automation

Here's a quick diagram I'm working on to depict my house's current state.


The dotted lines are projects that are in progress or not quite working as expected - for example, my Rootooth didn't do what I needed, my EnviR power meter is now installed (but not the second one for solar) but needs a bigger 433mhz aerial on the ninjablocks; and Huginn isn't yet deployed to an instance.

I can't quite tell who will win out of Zapier, IFTTT and Huginn yet - my money is on open source, though there's a long way to go.

Surprisingly, bluetooth is rarely in the mix - the roomba, and perhaps bluetooth for presence sensing would be about it.
UPnP is there for the airconditioner and XBMC, which boils down to HTTP. Ninjablocks is very HTTP oriented at the moment; but soon MQTT will take over a big chunk of its messaging.

ZWave, I have a stick but no devices - the cost was too high.



Saturday, November 22, 2008

Simple Content Negotiation for RDF service application with PHP

Need to serve up HTML for most users, but have an RDF representation of your resource?

Simply pop in:

$accept = explode(',', $_SERVER['HTTP_ACCEPT']);
if (in_array('application/rdf+xml', $accept)) {
header('Location: path/to/rdf/version.rdf');
die();
}

Wednesday, March 23, 2005

The Semantic Web & Porn: The solution PICS never was.

Do any of you fellow web folk remember a thing called Platform for Internet Content Selection (PICS)?

It was a content labelling system for the web. It was mainly focused on accurately labelling content to provide you with choice before you were assaulted with pictures of people doing nasty things with food items.

Yes, we've all seen goatse.cx.

There were several approaches undertaken with PICS, from HTTP headers...


HTTP/1.0 200 OK
Date: Thu, 30 Jun 1995 17:51:47 GMT
Last-modified: Thursday, 29-Jun-95 17:51:47 GMT
Protocol: {PICS-1.1 {headers PICS-Label}}
PICS-Label:
(PICS-1.1 "http://www.gcf.org/v2.5" labels
on "1994.11.05T08:15-0500"
exp "1995.12.31T23:59-0000"
for "http://www.greatdocs.com/foo.html"
by "George Sanderson, Jr."
ratings (suds 0.5 density 0 color/hue 1))
Content-type: text/html


... to META tags ...


<META http-equiv="PICS-Label" content='

(PICS-1.1 "http://www.gcf.org/v2.5"

labels on "1994.11.05T08:15-0500"

until "1995.12.31T23:59-0000"

for "http://w3.org/PICS/Overview.html"

ratings (suds 0.5 density 0 color/hue 1))

'>



But it never really was too effective. That's because it was a bitch to label every page with something hard to read like that, and if you didn't know how to make your webserver do things niftily, you were screwed.

When MCF came about, and turned into RDF, PICS was the cool application for it.


Separate W3C working groups are developing a new label format, called RDF; the Resource Description Framework, based on XML. RDF labels will be able to express everything that PICS labels can express, but will also permit string and structured values, and some other nifty features. The latest information on this available at http://www.w3.org/RDF.


... but then, no one really cared for a good few years.

So why this post?

Because PICS is back and more RDFish than ever before!

It works like CSS does - one file to describe them all.

<link rel="meta" href="labels.rdf" type="application/rdf+xml" title="Content labels" />

... and in labels.rdf, we find:


<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:label="http://www.w3.org/2004/12/q/contentlabel#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:icra="http://www.icra.org/rdfs/vocabularyv03#">

<rdf:Description rdf:about="">
<dc:creator rdf:resource="http://www.icra.org" />
<label:authorityFor>http://www.icra.org/rdfs/vocabularyv03</label:authorityFor>
</rdf:Description>

<label:Ruleset rdf:ID="Ruleset">
<label:hostRestriction>icra.org</label:hostRestriction>
<label:hostRestriction>icra.org.uk</label:hostRestriction>
<label:hostRestriction>icra.tv</label:hostRestriction>
<label:hostRestriction>rsac.org</label:hostRestriction>
<label:hasDefaultLabel rdf:resource="#label_1"/>
</label:Ruleset>

<label:ContentLabel rdf:ID="label_1">
<rdfs:label>No nudity, no sex, no violence, no potentially offensive language, no user-generated content, no other potentially harmful activities</rdfs:label>
<icra:cz>1</icra:cz>
<icra:lz>1</icra:lz>
<icra:nz>1</icra:nz>
<icra:oz>1</icra:oz>
<icra:sz>1</icra:sz>
<icra:vz>1</icra:vz>
</label:ContentLabel>
</rdf:RDF>



So how do you get it working for you?

Well, you can either read W3C tech specs or you can use this handy dandy reference (mine has more mention of nudity, buttocks, and exposed genitals).




<label:ContentLabel rdf:ID="label_1">
<rdfs:label>Human readable description of rating goes here. WARNING: This contains geek pr0n.</rdfs:label>
<!-- Category nx: Nudity -->
<icra:nz>1</icra:nz> <!-- No Nudity -->

<!-- Category cx: User Generated Content -->
<icra:cz>1</icra:cz> <!-- No User-Generated Content -->

<!-- Category lx: Language -->
<icra:lz>1</icra:lz> <!-- No Language Content -->
<!-- Category ox: Potentially Harmful Activites -->
<icra:oz>1</icra:oz> <!-- No Potentially Harmful Activites Content -->
<!-- Category sx: Sexual Material -->
<icra:sz>1</icra:sz> <!-- No Sexual Material Content -->
<!-- Category vx: Violence -->
<icra:vz>1</icra:vz> <!-- No Violent Content -->
</label:ContentLabel>