search – Parerga und Paralipomena http://www.michelepasin.org/blog At the core of all well-founded belief lies belief that is unfounded - Wittgenstein Wed, 16 May 2012 17:25:02 +0000 en-US hourly 1 https://wordpress.org/?v=5.2.11 13825966 DJFacet 0.9.7: MPTT hierarchical facets now supported! http://www.michelepasin.org/blog/2012/05/16/djfacet-0-9-7-mptt-hierarchical-facets-now-supported/ Wed, 16 May 2012 17:25:02 +0000 http://www.michelepasin.org/blog/?p=1898 DJFacet is a pluggable module for the Django web application framework that allows you to navigate the data in your webapp using an approach based on ‘facets’. I’ve already written about DJFacet in the past; now the good news is that I’ve released a major update to the software, as now there is complete support for hierarchical facets too.

Wikipedia describes faceted search as

“a technique for accessing a collection of information represented using a faceted classification, allowing users to explore by filtering available information. A faceted classification system allows the assignment of multiple classifications to an object, enabling the classifications to be ordered in multiple ways, rather than in a single, pre-determined, taxonomic order”.

Although faceted search systems aim at providing search interfaces that go beyond the model of a single, rigid, top-down catalogue for an information space, taxonomical classifications remain always one of the most useful ways to organise a dataset, as they implicitly provide support for ‘zoom in’ and ‘zoom out’ search operations. A good compromise then is to allow the simultaneous selection of search filters coming from different taxonomical schemas – or mixing them with non-taxonomical ones.

Version 0.9.7 of Djfacet, among several other things, includes full support for displaying and navigating through hierarchical facets as long as they are expressed in the DB via django-MPTT. A demo is available here (just browse into the ‘religion’ facet to see what I mean).

Djfacet: support for hierarchies

There are still a few things to sort out before reaching version 1.0 (including updating the online docs), but it’s getting closer – stay tuned!

Links:

  • Source code on Bitbucket: bitbucket.org/magicrebirth/djfacet
  • Documentation: michelepasin.org/support/djfacet/docs/
  • Demo installation: demos.michelepasin.org/djfacet/
  • Project page: www.michelepasin.org/artifacts/software/djfacet/
  •  

    ]]>
    1898
    A bookmarklet for searching delicious http://www.michelepasin.org/blog/2010/01/06/a-bookmarklet-for-searching-delicious/ Tue, 05 Jan 2010 23:02:29 +0000 http://magicrebirth.wordpress.com/?p=490 This has been long overdue for me. A way to quickly search delicious.com without relying on third-party apps (which often you have to pay for). And it’s got to be super simple too: something like a bookmarklet that you click on and then takes you there. Just one of those things you never have the time to do….

    So today I got around doing it. I didn’t know much about bookmarklets but a few google searches gave me all I needed.  These are a few links I found useful while working on this little thing:

  • What are bookmarklets?
  • bookmarklets.com
  • Various search bookmarklets you can easily reverse-engineer
  • a perl script that makes any javascript code ready for being used as a bookmarklet
  • Essentially bookmarklets are javascript code formatted in a browser-friendly syntax, that is, by url-escaping all of its characters.
    So I set off to create a bookmarklet for opening delicious at a specific tag-page. This button will take whatever you have highlighted on the web page and search for that string on delicious as a tag (not as a search string! but obviously you can modify that). If you have nothing selected the script should ask the user for a value to use.

    The bookmarklet would look something like the following:
    search on delicious

    Mind that the bookmarklet above won’t work if you drag it to your browser button-bar, ’cause WordPress stripped off its behaviour (for security reasons I suppose). Too bad – you can easily recreate it yourself.
    The source code was something like this (note that it should be all on a single line,):

    
    <a href="javascript:q = "" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (!q) q = prompt("You didn't select any text.  Enter a search phrase:", ""); if (q!=null) location="http://delicious.com/tag/" + escape(q).replace(/ /g, "+"); void 0"
    >search on delicious</a>
    

    The script above worked for me on Apple’s Safari – the only other thing I had to do was url-escaping it. Thus the code would look as follows (again, make sure it is on a single line):

    
    javascript:q%20=%20%22%22%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt(%22You%20didn't%20select%20any%20text.%20%20Enter%20a%20search%20phrase:%22,%20%22%22);%20if%20(q!=null)%20location=%22http://delicious.com/tag/%22%20+%20escape(q).replace(/%20/g,%20%22+%22);%20void%200
    

    You can paste the code above onto a browser’s url bar to test it :-).

    But if you want to save it as a bookmarklet do the following: copy this code, open up the ‘Show all Bookmarks’ window on Safari and create a new bookmark named ‘delicious search’ (or anything else), right click on the newly created bookmark and hit the ‘edit address’ command. Finally, in the address field paste the code you have copied and you’re ready to go!


    That’s it!
    Last thing: you might want to search only through your personal tags on delicious (that’s what I do most of the time). All you have to do is modify the search string by replacing the ‘/tag/’ ending with ‘/username/’, where ‘username’ is your delicious username.. that’s the standard url format delicious.com accepts for searching personal tags. So:

    
    javascript:q%20=%20%22%22%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt(%22You%20didn't%20select%20any%20text.%20%20Enter%20a%20search%20phrase:%22,%20%22%22);%20if%20(q!=null)%20location=%22http://delicious.com/YOUR-USERNAME/%22%20+%20escape(q).replace(/%20/g,%20%22+%22);%20void%200
    

    In conclusion, using the same approach you can create bookmarklets of all sorts!

    ]]>
    490
    A Sneak Preview of Wolfram Alpha http://www.michelepasin.org/blog/2009/05/02/a-sneak-preview-of-wolframalpha/ Sat, 02 May 2009 14:50:54 +0000 http://magicrebirth.wordpress.com/?p=127 It’s the new brainchild of Stephen Wolfram, author of Mathematica. It does look impressive in my opinion – can’t wait to try it live (due to launch some time in may)!

    Defined as a Computational Knowledge Engine. It does an awful lot of number-crunching but looks more as a giant closed database than a distributed Web of data, or even a ‘Semantic web’.

    Interesting the reaction of competitor Doug Lenat, who although is claiming that Wolfram is not AI (therefore CYC’s got nothing to fear) imho is realizing he didn’t get it right when he set out trying to capture ‘common sense’. After all, all that we find in Wolfram|Alpha is symbolic reasoning. Is that so far from the way Cyc works? This might be a nice departure point for an interesting discussion…

    Lenat’s blog post contains some interesting comments on the things that Wolfram|Alpha can’t do (yet):

    When it returns information, how much does it actually “understand” of what it’s displaying to you?  There are two sorts of queries not (yet) handled: those where the data falls outside the mosaic I sketched above — such as:  When is the first day of Summer in Sydney this year?  Do Muslims believe that Mohammed was divine?  Who did Hezbollah take prisoner on April 18, 1987? Which animals have fingers? — and those where the query requires logically reasoning out a way to combine (logically or arithmetically combine) two or more pieces of information which the system can individually fetch for you.  One example of this is: “How old was Obama when Mitterrand was elected president of France?”  It can tell you demographic information about Obama, if you ask, and it can tell you information about Mitterrand (including his ruleStartDate), but doesn’t make or execute the plan to calculate a person’s age on a certain date given his birth date, which is what is being asked for in this query.  If it knows that exactly 17 people were killed in a certain attack, and if it also knows that 17 American soldiers were killed in that attack, it doesn’t return that attack if you ask for ones in which there were no civilian casualties, or only American casualties.  It doesn’t perform that sort of deduction.  If you ask “How fast does hair grow?”, it can’t parse or answer that query.  But if you type in a speed, say “10cm/year”, it gives you a long and quite interesting list of things that happen at about that speed, involving glaciers melting, tectonic shift, and… hair growing.

    Some nice coverage of it also on ReadWriteWeb and UMBC.

    ]]>
    127