09.16.06
Posted in games, web at 10:55 pm by wingerz
Up until the past few weeks, I had only purchased items on eBay – mostly in college when I was going through my Jet Li phase (my sister and I watched Fist of Legend four times in a row during one of her east coast trips). Back in those days I had to deal with sending money orders or checks in the mail, and I imagine the sellers were making trips to the post office to send me my kung fu VCDs.
In any case, Jen and I recently shuffled things around in our study. I re-discovered a lot of my old video games and decided to finally sell some of them (since I’m sort of saving up for a new camera). It turns out that one of the old PS1 games (Lunar 2, a gift from Phil), was worth $100-150 (I ended up selling it for $100, after getting inquiries about it from Belgium, Brazil, and Finland). I was surprised to see a few of my old Dreamcast games go for $25-30. eBay’s streamlined the entire process – just punch in the bar code number of a game, and it inserts a well-written description and box art for you. Once the auction is done, accept a payment through Paypal, print a mailing label (my small scale came in handy), and drop it off in the mail. Sure, they skim a few percent off here and there, but it saves me from multiple trips to the bank and post office, so it’s well worth it.
I’ve got a few more things that I will probably sell in the next few weeks. Not because they are worth anything (they aren’t) but because I figure that some gamer out there will get a bargain, and a game that has been collecting dust in our basement for years will get a new home.
Permalink
08.31.06
Posted in web at 5:35 pm by wingerz
Flickr recently introduced geotagging support to photos. Apparently it has been quite successful so far, with users tagging well over a million photos since it was first released. It’s pretty easy to use – you can just drag your photos onto a Yahoo Map and flickr will take care of the rest.
While I’m all for having more photo metadata, it is a little scary to think that a non-tech-savvy person might tag personal photos of children, home interiors, and other stuff with the exact coordinates of his or her home (and also pinpoint the location of their camera(s), which might be quite expensive). Flickr lets you set a default privacy level for the geotags (private, friends/family, public), but they recommend the public setting.
In short, I’m hoping that users will be smart about what they geotag. Publicly geotagging your home (or a friend’s place) is not a good idea.
Permalink
07.19.06
Posted in development, semantic web, web at 11:17 pm by wingerz
I received an email from a friend who wanted to learn more about my work. He is not that familiar with the Semantic Web, and I tweaked my reply to him because it does a decent job of explaining what Queso does. Pre-reading: Queso introduction, RDFa in Queso.
Core technologies, in order of appearance:
- RDF – Resource Description Framework – representing data in subject-predicate-object triples, heart and soul of the Semantic Web
- Atom – most widely known as a feed format, also for publishing content
- JSON – Javascript Object Notation – representing objects as strings that can be eval’ed in Javascript (there are also libraries for parsing JSON in other languages) – takes the pain out of parsing responses on the client
- XHTML – HTML as XML, which means that you can’t have open tags, (
p, I’m looking at you), attribute values must have quotation marks around them, etc.
- RDFa – a standard for embedding RDF in XHTML
- SPARQL – SPARQL Protocol and RDF Query Language – I like it even more because 1) it’s a recursive acronym and 2) Elias and Lee are on the working group.
- Microtemplates – templates for HTML – bind Javascript objects to them to display your data
Our high-level goal this summer is to put a web front-end onto Boca, our RDF store. Most of our group’s work over the past few years has focused on building infrastructure to support the Semantic Web. Our UI work has primarily involved creating libraries for RCP-based applications, but we’ve always known that making things web-accessible is important.
In Queso, we want to store both data and XHTML/Javascript application code. We want web application designers to be able to dump their (potentially structured) data into the system, which stores everything as RDF triples. SPARQL provides an easy, standardized way to query for data in a flexible, precise manner. The data in the system can be easily extracted and repurposed for use in other applications, such as mash-ups. The following is a simple example where I’ve tried to improve readability by leaving out namespaces and base URIs. Don’t follow this as a copy-and-paste tutorial.
There’s a site called mywikimap that shows local gas prices on a Google Map. If you wanted to store data for an application like this using Queso, you could post Atom entries of the following format as XHTML:
<div about="[queso:thisEntry]">
price: <span property="price">2.95</span>
latitude: <span property="latitude">7</span>
longitude: <span property="longitude">9</span>
time found: <span property="time">2006-07-19T10:27:00</span>
</div>
While this will display in a (somewhat ugly) human readable form, it is also valid RDFa, so Queso extracts RDF triples from it (semicolon at the end of the line just means that the following triple has the same subject):
_:gasEntry <price> "2.95" ;
<latitude> "7" ;
<longitude> "9" ;
<time> "2006-07-17T10:27:00" .
These triples will be stored along with the triples that represent the Atom entry. Now you can query them using SPARQL, with the following query (which restricts the results to entries from July 17 or later located in a certain area):
select ?price ?lat ?lon ?time
where {
?entry <price> ?price ;
<latitude> ?lat ;
<longitude> ?lon ;
<time> ?time .
filter (
?lat > 5 && ?lat < 10
&& ?lon > 7 && ?lon < 12
&& ?time > "2006-07-17T00:00:00"
)
}
What’s more, you can get this back as a JSON object that looks something like this (according to this standard):
{ price : "2.95", lat : "7" ... }
Then you can eval it in Javascript (in the real world you’d do some checking on it before eval’ing it):
var gasEntry = eval(jsonResult);
var str = "Price: " + gasEntry.price
+ ", latitude: " + gasEntry.lat
+ ", longitude: " + gasEntry.lon;
Rather than constructing a string on the client via string concatentation, we can use microtemplates to display the data. An example template (Note that the names of the classes match the names of the variables in the SPARQL query above):
<div id="gastemplate">
price: <span class="price"></span>
latitude: <span class="lat"></span>
longitude: <span class="lon"></span>
time found: <span class="time"></span>
</div>
In Javascript, the data can be bound to the template with the following line:
new IBM.ET4A.Template("gastemplate").bind(entry);
And now the div will show up with data values filled in.
So what’s so great about all of this? We didn’t have to deal with anything database related, like setting up tables and writing SQL code for inserting data into the system or querying. If we wanted to add additional data (say, the gas station name, the street address, etc.), we could encode additional triples very easily. We also didn’t have to write a web API to expose our data to the world. On the client, we didn’t have to parse any XML or RDF in Javascript. Anyone can use the data, either for its originally intended purpose (display on a Google Map) or something else (trend analysis across time and location or something more interesting).
Now that we’ve got the data set up, we move on to application development. In this (simple) case, one would develop the XHTML and Javascript files (including our libraries for Atom publishing and SPARQL querying) necessary for a web UI for this application and upload them to Queso. They would be posted to Queso as Atom entries containing the appropriate content types. And that’s it for application deployment – pointing your web browser to the appropriate URL would give you the content as XHTML. These files can also contain some RDFa markup so that additional metadata about the application can be stored. This would give us a server application registry for free via a SPARQL query for everything on the system that is of type application. For more complex applications we can set up traditional web frameworks and have them interact with Queso on behalf of a client.
Of course, there are a lot of problems as well. We haven’t looked much at security, though our store has built-in access control. We’re looking into how to make this as scalable as possible, and the thought of having an open SPARQL endpoint is frightening. But for now we hope that this can serve as a sandbox for people to experiment with RDF, Atom, RDFa, and SPARQL.
Permalink
07.18.06
Posted in development, semantic web, web at 12:03 am by wingerz
Elias posted about Queso, our summer project that mixes the Web2.0 (REST-ful URLs, JSON, some nice Ajax-y UI libraries) and Semantic Web (data stored as RDF, queryable via SPARQL) worlds.
Content is inserted into the system is by posting Atom entries. The entries are stored as RDF (converted via Atom OWL by Henry Story), so their content and metadata is accessible via SPARQL queries. Because Atom relies on both an ID and a timestamp to establish the uniqueness of an entry, the ID cannot be used as the resource that serves as the subject of statements describing the particular Atom entry. Instead we use a blank node that has <http://www.w3.org/2005/10/23/Atom#id> and http://www.w3.org/2005/10/23/Atom#updated> properties. All of the triples for a particular Atom id are stored in a named graph that has this id as its name.
Of course, we might want to store some additional RDF triples in addition to the ones that represent the Atom entry. For this we use RDFa which gives us a means of embedding RDF triples in XHTML. Using RDFa is one way to transition from the current web towards a more semantic web.
If the Atom entry is posted with the content type set to “xhtml”, Queso will run an RDFa parser on the content, extracting any embedded triples and storing them along with the triples for the entry (in the same named graph). For example, posting the following as content type “xhtml” (if you are posting with the ATOMbrowser, leave off the enclosing divs):
<div xmlns="http://www.w3.org/1999/xhtml">
<div xmlns:wingerz="http://wingerz.com/"
xmlns:queso="http://queso.adtech.ibm.com/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
about="[queso:thisEntry]" role="foaf:Person">
<link rel="foaf:img"
href="http://wingerz.com/wingerz.jpg" />
<link rel="foaf:weblog"
href="http://wingerz.com/blog"/>
<div property="foaf:name"
datatype="xsd:string">Wing Yung</div>
</div>
</div>
will result in the following triples being added to the store:
_:thisEntry a Person ;
<foaf:img> <http://wingerz.com/wingerz.jpg> .
<foaf:weblog> <http://wingerz.com/blog> .
<foaf:name> "Wing Yung"^^<xsd:string>
along with other triples describing the author, title, content, summary, etc. of the Atom entry:
_:thisEntry a <http://www.w3.org/2005/10/23/Atom#Entry>;
<http://www.w3.org/2005/10/23/Atom#id> <urn:lsid:abdera.watson.ibm.com:entries:397859049> .
<http://www.w3.org/2005/10/23/Atom#updated> "2006-08-25T23:22:00.995Z^^<xsd:dateTime> .
...
Note that we use <queso:thisEntry> in the XHTML as a magic resource that gets replaced by the blank node that represents this particular Atom entry.
Once the content has been posted it can be accessed in several ways. The first one is the ATOMbrowser. Navigate to the appropriate collection (”wingerz”) and entry (”RDFa test”). The content and other attributes are viewable in the right-most column. Grabbing id (urn:lsid:abdera.watson.ibm.com:entries:397859049), we can visit the entry’s content, which is output as XHTML.
Finally, if you go to the SPARQL browser, you can query the store for the triples. Click the “Graphs” tab and add the id (urn:lsid:abdera.watson.ibm.com:entries:397859049). Uncheck the introspection document and click back over to the “Query” tab. Run the default query (which brings back all of the triples in this named graph). For less data try the following query instead:
SELECT ?person ?blog ?pic
WHERE {graph ?g {
?person a <http://xmlns.com/foaf/0.1/Person> ;
<http://xmlns.com/foaf/0.1/weblog> ?blog ;
<http://xmlns.com/foaf/0.1/img> ?pic .
}
}
And of course, if you hit the SPARQL endpoint, preferably with Lee’s SPARQL Javascript library, you can request your output in JSON format so that your client never has to parse RDF or Atom.
So what good is this? We hope to serve both data (content as Atom and RDF) and applications (content as Javascript and XHTML) off the server. Application deployment should be trivial. Semantic Web-aware developers can easily create, remove, update, and delete data, speeding up development time. And because everything is accessible through SPARQL, others can use the data or combine data from different applications in interesting ways.
See also:
Ben’s entry about posting Atom entries using Abdera.
Permalink
07.01.06
Posted in development, firefox, web at 10:20 am by wingerz
When you make a request over HTTP, you can get a number of status codes returned (like 200 (OK) and 404 (not found)). One such code is 304, which tells the client that the page requested was not modified, meaning that the client can use the local cached version.
Unfortunately, when you make a XMLHttpRequest in Firefox (allowing you to make a HTTP request without refreshing the page) and the return status set by the web server is 304, the XMLHttpRequest.status property is set to 200. In most cases this is fine because it doesn’t matter whether the page came from a webserver or from the local cache – in either case, the content is available for use.
In our case we want to be able to query our server about a particular entity and only take additional action running some SPARQL queries) if the status code is 200. When our server returns a 304, we won’t do anything. But since Firefox only gives a 200 in this case, we’ve had to add a custom HTTP header.
I found some mention of this problem elsewhere. In my opinion, if a webserver returns a 304, that should get bubbled up to the client somehow since it has meaning beyond 200, so I filed a bug report. Sounds like not everyone agrees with me.
Permalink
06.10.06
Posted in rails, web at 6:32 am by wingerz
Recently I volunteered to put together a new website for my wife’s former company, New Sector Alliance (the old site). I figured it was a good way to learn the right way to put a website together. The only customer requirements: Make it look better than the old site, and add in some flashing quotes.
Some of the things I’ve picked up:
- Creating layouts with
div positioning rather than tables: No more fiddling with colspans and rowspans, put your layout boxes wherever you want them, even overlapping or obscuring one another.
- Nice rounded tabs: I used A List Apart’s sliding doors approach. Basically it involves creating a (narrow) left image and a (wide) right image of a box with rounded corners, then positioning them as backgrounds with the left image pushed to the upper left and the right image pushed to the upper right. Only the part of the image that covers the tab element shows through. The other neat trick is for changing the background image on a hover event. Rather than switching images or switching the class of an element, you put two images into a single image, stacked on top of each other, then switch the positioning of the image on a hover event.
- Slick graphical effects: script.aculo.us is one of many Javascript libraries for cool “Web 2.0″ effects. It’s pretty easy to use. I created a box that contains changing quotes and used this to fade quotes in and out.
- More Javascript: Found a simple sortable table script, which I dumped in to display every past project that the company has done (134). Things like this make me happy to know perl.
- Cross-browser functionality: I haven’t really looked at this yet, but I am not looking forward to it. Some of the stuff doesn’t even render in IE.
- Development environment: I actually started coding the site up in Ruby on Rails to take advantage of the layout system. I’ve got a default layout that draws the header, main nav menu, and footer. It’s made working with the nav menus much easier (especially for highlighting the item in the menu that matches the page that’s currently being viewed).
Permalink
06.01.06
Posted in games, web at 8:06 pm by wingerz
…even though I didn’t get a DS Lite early.
Two days ago, this post showed up on Cheapass Gamer – basically some guy (the now famous “Trakan”) went into a Target and found a Nintendo DS Lite in the display case. He was able to purchase it, even though the official release date is June 11. Over the last few days, there have been hundreds of responses from various people, many of whom have tried to find the DS Lites themselves. Sounds like they’re all in stores already, but all of the activity has caused Target, Walmart, Sears, and other retailers to issue statements to tell employees not to sell them until June 11.
I’ve skimmed a lot of the posts – my favorite part is about how one guy saw two other shifty guys eyeing the DS Lites in a store. Later in the thread the shifty guys responded, saying that they noticed the first guy.
It’s amazing to see how a single purchase and subsequent post has made its way through the Internet, motivating so many people to call and visit nearby stores. It may have been my imagination (and other people report this as well) but every store clerk I have talked to knows what the DS Lite is and that its release date is June 11.
Permalink
05.17.06
Posted in development, dogooder, web at 8:32 pm by wingerz
I was adding links to feeds on doGooder a few nights ago. I wanted to create some ’subscribe to this feed’ links for various RSS readers, so I started hunting around for the appropriate icons. I stumbled upon FeedBurner (via several sources, including vitamin).
Point Feedburner at your feed and point your users to Feedburner – they’ll see a page like this (all good deeds) or this (approved good deeds). The original feed is in Atom, but Feedburner converts it to whatever format is required. And it provides all of the nice little icons.
Feedburner does other stuff as well – the subscription tracking looks quite nice. Will be playing around with it more.
Permalink
« Previous Page « Previous Page Next entries »