Quotation from Gregory Bateson

July 10th, 2008

From: Bateson, G., 1978, ‘Afterword’, in J. Brockman (Ed.) About Bateson, London: Wildwood House pp. 244-245

Consider for a moment the phrase, the opposite of solipsism. In solipsism, you are ultimately isolated and alone, isolated by the premise “I make it all up.” But at the other extreme, the opposite of solipsism, you would cease to exist, becoming nothing but a metaphoric feather blown by the winds of external “reality”. (But in that region there are no metaphors!) Somewhere between these two is a region where you are partly blown by the winds of reality and partly an artist creating a composite out of the inner and outer events.

Search code in google

June 3rd, 2008

Picture 1.png

!!!!!!!!!!!!!!!!!!!

Just found out about it: you can search directly for code using google!

Comparing programming languages

April 3rd, 2008

Picture 2.png

Imagine you’ve got to set to lowercase a string…is it shorter to write it in php or in perl? Rosetta Code can give you an interesting perspective on this… check out how the various languages deal with it (tx god i’m not using C.. but does is really have to be that long?)

The British Wittgenstein Society gets started

March 10th, 2008

Picture 12.png

Good news, the British Wittgenstein Society (BWS) is opening its doors (well online at least): it’ll add up to the aready existing Austrian Ludwig Wittgenstein Society (ALWS), International German Ludwig Wittgenstein Society (ILWG) and North American Wittgenstein Society (NAWS). I am trying to get PhiloSURFical noticed and possibly tested by them – let’s see how it goes ;-)
From their site:

“Our aim is to ensure that Ludwig Wittgenstein’s philosophy continues to play a fertile and creative role in 21st century thought. The Society aspires to provide, through its annual conference, a British focal point for research and exchange of ideas among Wittgenstein scholars and students throughout the world. It will also seek to address, in its conference themes, the many other disciplines (psychology, anthropology, sociology, education sciences, aesthetics etc.) that Wittgenstein’s work has impacted and will continue to impact.

The BWS will make an annual bursary available to a student who wishes to pursue PhD research on Wittgenstein at the University of Hertfordshire.

The British Wittgenstein Society is sponsored by Shell.”

Social Innovation Camp in London

March 7th, 2008

Picture 11.png

Unfortunately the deadline for sending your ‘ideas’ is over – but the idea of a camp like that is awesome!

From their site:

“What happens when you get a bunch of software developers and social innovators together, give them a set of social problems and only 48 hours to solve them?

We’re going to find out.

In London between 4th-6th April 2008, the Social Innovation Camp will bring together some of the best of the UK and Europe’s web developers and designers with people at the sharp end of social problems.

Our aim is to find ways that easy-to-build web 2.0 tools can be used to develop solutions to social challenges.”

New Book on Knowledge Technologies

March 6th, 2008

Picture 1.png

A new interesting book on Knowledge Technologies is available,the author is Nick Milton. It is meant to be read also by novices so it’s deliberately not too technical or complex. I had a quick look at it this morning, and I think that it is interesting even for who’s already familiar with all this stuff, cause it gives a nice overall perspective on the field. Never too fanatic about the ’semantic’ promises, sober and realistic when describing the features and advantages of these technologies.

The first excerpt is about the ‘ever-changing meaning of ontology’. The second one instead is a graph depicting the role of ontologies in semantic systems.

And the good news is: you can get a pdf pre-print for free!

226497672.625202 1.jpg

226497434.220872.jpg

AJAX in Lisp with JQuery

February 27th, 2008

Picture 13.png
I was asked to give an example of lisp+ajax, so once I prepared it I thought it could be of help to other people too :-)

First of all, I am not a professional lisper at all, just got to know it a little during the last two years. The code I’m presenting here might not be the best one, but it works and essentially makes the point that you can do cool ajax stuff by using lisp [btw, some of this code comes from somebody who knows about lisp much more than I do, this guy here].

Anyways, let’s get going: we want to create a very very simple webapp that changes the color of some text in the page, using an ajax call. So we’ll have one main page, another page which gives back the code for updating the main page through ajax, and a couple of js files we want to use for the front-end functionality (among them, the fantastic jquery).

First of all, we’ll need two handy packages for setting up a fully-working lisp server: hunchentoot and cl-who (the more you learn about these packages, the better it is – and go through the examples – they’re really useful!). Once you’ve installed them, using asdf-install or whatever-you-like, let’s load them up and set a couple of environment variables.

(asdf:operate 'asdf:load-op :hunchentoot)
(asdf:operate 'asdf:load-op :cl-who)

(use-package :cl-who)
(setq hunchentoot:*catch-errors-p* nil
hunchentoot:*log-lisp-backtraces-p* t)

Then we define a couple of functions for starting/stopping the server and setting up the dispatcher table, which is where the mapping between web-pages in the application and lisp functions in the backend is specified. We’ll have three of these mappings: one for the main page, one for the page that serves the ajax changes (what-color?), and one for passing the static files, such as js and css (static/).



(defvar *web-server* nil)

(defun start-server ()
(setq hunchentoot:*dispatch-table*
(nconc
(mapcar (lambda (args)
(apply #'hunchentoot:create-prefix-dispatcher args))
'(("/static/" serve-static)
("/what-color" what-color?)
("/main" main)))
(list #'hunchentoot:default-dispatcher)))
(setf *web-server* (hunchentoot:start-server :port 3000)))

(defun stop-server ()
(hunchentoot:stop-server *web-server*))

When the start-server function is called, it’ll load the dispatch table and start the sever on port 3000.

The hardest thing to do now, before creating the functions that output the web-pages, is to set up the functions that handle the static files. First of all define your location, so that lisp knows where the root folder of the webapp is. That’s how it looks on my mac – you probably want to change that according to needs.



(defvar *location* "/Users/myname/dev-try/hunchentoot-examples/")

Then the function for serving the static files (serve-static). In this example web-app we’ll only have two of them (see below), but you might want to have more (e.g. css, jpg etc..). The other three functions below basically retrieve the static file, check its mime-type and pass it back to the dispatcher.



(defun serve-static ()
(let* ((uri (hunchentoot:request-uri))
(file (subseq uri (length "/static/"))))
(format *error-output* "serve-static: file=~S~%" file)
(http-write-file file (mime-types file))))

(defun http-write-file (filename mime-type)
"Send contents of FILENAME to the HTTP stream, along with its MIME-TYPE."
(setf (hunchentoot:content-type) mime-type)
(let* ((stream (hunchentoot:send-headers))
(buffer (make-array 1024 :element-type '(unsigned-byte 8 )))
(local-filename (format nil "~astatic/~a" *location* filename)))
(with-open-file (in local-filename :element-type '(unsigned-byte 8 ))
(loop for pos = (read-sequence buffer in)
until (zerop pos)
do (write-sequence buffer stream :end pos)))))

(defun mime-types (filename)
(let ((ext (subseq filename (+ 1 (position #. filename :from-end t)))))
(second (assoc ext '(("txt" "text/plain")
("css" "text/css")
("lisp" "text/plain")
("html" "text/html")
("js" "text/javascript")
("png" "image/png"))
:test #'string=))))

(defun write-http-stream (mime-type payload)
(setf (hunchentoot:content-type) mime-type)
(write-sequence payload (hunchentoot:send-headers)))

That was the trickiest part. Now let’s just create the functions that produce the html code to be passed to the browser/javascript. Before that, just a couple of useful macros that wrap the standard cl-who functions. With-html for creating html code without a header, and with-html-top for creating also the header.



(defmacro with-html (&body body)
`(with-html-output-to-string
(*standard-output* nil :prologue nil :indent nil)
(htm ,@body)))

(defmacro with-html-top (&body body)
`(with-html-output-to-string
(*standard-output* nil :prologue t :indent nil)
,@body))

Finally, the pages we can call from the browser. Main creates the main page of the app, linking to the javascript files. what-color? just outputs a random color name out of a predefined list:



(defun main ()
(with-html-top
(:html (:head
(:title "Home page")
(:script :type "text/javascript" :src "/static/jquery.pack.js")
(:script :type "text/javascript" :src "/static/my_functions.js"))
(:body
(:p :id "text" "Hi there - this is the only page for now")
(:a :href "javascript:changeColor()" "click here to change the color!")))))

(defun what-color? ()
(let ((color-list '("blue" "red" "lavender" "black" "yellow"
"orange" "mandarin" "MistyRose" "Olive")))
(nth (random (length color-list)) color-list)))

That’s it really, for the backend. Now all you have to do is to create a folder called ’static’ wherever you specified the *location* variable to point at. Inside the folder, put a copy of the latest JQuery code (jquery.pack.js), and create a new file called my_functions.js with this elementary function (sorry – that’s all the ajax we’re getting for now…) . It’s a simple function that calls the server for getting a color name, and uses it to change the color of a dom element.



function changeColor() {
$.get("what-color",
function(data){
$("#text").css("color",data);
}
);
}

Almost done. Enter (start-server) in the lisp listener, and go to http://localhost:3000/main to see your first lisp-ajax application! [if the colors don't show properly, make sure you are using Firefox]

Have fun!

New PhiloSURFical version!

February 26th, 2008

Picture 12.png
A new version is now online – I reckon it will be one of the latest ones! Yuhuuu!

Major changes:

  • the site now works at 1024×830 (it should be enough for supporting the majority of screens)
  • the pathways section now works primarily by using a hypertext interface – the java applet I was using for the visualization of the pathways is not automatically loaded anymore, but just on demand by clicking a button. This will prevent it from slowing down the whole site.
  • refined the help mechanisms and other little things throughout the site

Still to do: various things, but mainly NOT at the interface level. Basically getting more data (if possible) into the KB, refining the pathways creation process, refining the annotations of the Tractatus and making the whole KB available in OWL (along with the ontology, which is already available).
Thanks to all the people who’s emailed me with correction/suggestions!! :-)

Epistemic Logic

February 12th, 2008

book.jpg

It’s nice when a few people’s interests happen to converge. You start tackling problems together, and learning as a group. This is what happened KMi recently with the Epistemic Logic interest group. We’ve decided to start a seminar, trying to make sense of the ‘epistemic logic‘ area and possibly draw some useful tips from it.

The seminar’s title is “reasoning about knowledge‘. Fagin and others, lead authors in the area, define its scope as follows (get the PDF here):

As its title suggests, this book investigates reasoning about knowledge, in particular, reasoning about the knowledge of agents who reason about the world and each other’s knowledge. This is the type of reasoning one often sees in puzzles or Sherlock Holmes mysteries, where we might have reasoning such as this:
If Alice knew that Bob knew that Charlie was wearing a red shirt, then Alice would have known that Bob would have known that Charlie couldn’t have been in the pantry at midnight. But Alice didn’t know this . . .
As we shall see, this type of reasoning is also important in a surprising number of other contexts. Researchers in a wide variety of disciplines, from philosophy to economics to cryptography, have all found that issues involving agents reasoning about other agents’ knowledge are of great relevance to them. We attempt to provide here a framework for understanding and analyzing reasoning about knowledge that is intuitive, mathematically well founded, useful in practice, and widely applicable.

For the moment we’ve just been clarifying our language and the conceptual tools we need to move on to the core issues. But the discussion’s been really lively, so I guess I’ll keep posting about this. A simple map of the recent meeting is online for public consumption :-)

FlexBuilder and Flare

February 6th, 2008

Picture 11.png

Got a headache by trying to use the flash version of Prefuse, which is called Flare, in the Flex2 builder environment (which I found out, you can get for free if you’re a student). Basically the tutorial works fine till you reach the most interesting point: adding the Flare libraries into the project.

The library import facility doesnt seem to work: I get funny errors related to the eclipse editor that doesnt even let me visualize the file contents of the imported libraries:

Unable to create this part due to an internal error. Reason for the failure: Editor could not be initialized.

java.lang.NullPointerException ….bla, bla bla….

So, after some googling I found out that somebody else had the same problem:

There’s a pretty good tutorial that I, as a beginner, found straightforward. I ran into some problems when I was trying to “import a library into another project,” but per Jeffrey’s suggestion, I upgraded to Adobe Flex 3 beta (currently a free download). That cured my problems. Adobe Flex is apparently still a little rough around the edges. Oh right, and the tutorial provides instructions on how to develop with Flare in the Flex Builder environment.

Mind that the Jeffrey he’s talking about is the creator of Flare. Flex 3 is the solution
So, word of advice: if you want Flex for the Flare capabilities, don’t go through release 2!!!