miércoles, 11 de marzo de 2009

installing SGML addon for Io and using it to get latest xkcd image

Io can be a PITA to install. SGML addon is an example of it.

things to try:
- install libsgml (from http://www.hick.org/code/skape/libsgml/ )
- cd /usr/local/lib
ln -s sgml sgml-1.1.4

- cp sgml/include/Variant.h sgml/Variant.h

- cd steved..../addons/SGML/
ln -s sgml sgml-1.1.4

It doesn't work unless you run io from /usr/local/lib
^ This is only a draft, tomorrow I'll clean it... sure.....

Ok, say you already have SGML installed along with your Io instalation.

Today's toy problem is HTML parsing. I thought I'd do something web related (like my last squeaky google fight) . Well, This is the result. a Tiny script to get latest xkcd png and put it as a wallpaper using feh. The code has too many hardcoded things, but, you know... it's only a demo, right?
# updates wallpaper with latest xkcd image
# kidd

XKCD := Object clone do (
      url := "http://www.xkcd.com"
      fetch := method(
         html := URL with(url) fetch asString asHTML
         urlImage := html elementsWithNameAndClass("div", "s") at(2) elementsWithName("h3") at(1) allText split(": ") at(1)
         File with("/tmp/sc.png") setContents(URL with(urlImage) fetch)
         return ("/tmp/sc.png")

xkcd := XKCD clone
System system("feh --bg-scale " .. xkcd fetch .." ")

Let's hope next Io post will use some of Io's cool features, not just 'standard' code


5 comentarios:

Anónimo dijo...

...please where can I buy a unicorn?

Anónimo dijo...

手伝ってくれますか? [url=http://ci2s.org/viagura.htm]バイアグラ 服用[/url] バイアグラ

Anónimo dijo...

調子が悪いです。 [url=http://ci2s.org/viagura.htm]バイアグラ[/url] バイアグラ 服用

Anónimo dijo...

no existe Probable http://nuevascarreras.com/category/cialis-generico/ cialis 5 mg precio Meravigliosa, questo prezioso parere comprar cialis sin receta itntyuoqhw [url=http://www.mister-wong.es/user/COMPRARCIALIS/comprar-viagra/]comprar viagra[/url]

Anónimo dijo...

la phrase Exacte contre lejaculation viagra pour femmes en pharmacie