A little exercise for fluiddb.el

While catching up on my reading I came across the blog post describing the people app by @paparent (see http://fluiddb.fluidinfo.com/about/paparentapps/paparent/peopleapp/index.html#/ for the app itself).

There is some tutorial on the app page itself (click the "guide" link) on how to add yourself so I thought this might be a good exercise for the FluidDB Emacs mode
Get the code from that repository, load fluiddb.el into your Emacs and then load this function:
(defun set-people-app-location (user-id password longitude latitude register-p)
  (let ((*fluiddb-credentials* (cons user-id password))
        (*fluiddb-server* "fluiddb.fluidinfo.com")
        (people-namespace (concat user-id "/people"))
        (user-about-text (concat "Object for the user named " user-id)))

    (when register-p
      (print "Creating the people namespace")
      (fluiddb-create-namespace user-id "people" "Namespace for value for the people-app; see http://fluiddb.fluidinfo.com/about/paparentapps/paparent/peopleapp/index.html#/")

      (loop for (ns . tag) in `((,user-id . "peopleapp")
                                (,people-namespace . "longitude")
                                (,people-namespace . "latitude"))
            do (progn 
                 (print (concat "Creating tag " ns "/" tag))
                 (fluiddb-create-tag ns tag "" nil))))

    (print "Setting coordinates")
    (fluiddb-set-object-about-tag-value user-about-text (concat people-namespace "/longitude") longitude)
    (fluiddb-set-object-about-tag-value user-about-text (concat people-namespace "/latitude") latitude)

    (when register-p(
      (print "Registering the user with the people-app")
      (fluiddb-set-object-about-tag-value "collection:peopleapp" (concat user-id "/peopleapp") nil))))

Now you can use this to a) create the needed tags and namespaces (by passing a true value for register-p) and b) set your current location.
Enjoy!

Posted

0 comments

Leave a comment...