Updates from March, 2008 Toggle Comment Threads | Keyboard Shortcuts

  • Tyler 3:03 pm on March 11, 2008 Permalink
    Tags: gravatars, , ,   

    Gravatars and Liftweb. 

    Liftweb and Gravatars together at last.

    Here’s the snippet:
    package net.liftweb.example.snippet

    import net.liftweb.example.model._
    import scala.xml.{NodeSeq, Text, Group, Node, Elem}
    import net.liftweb.http._
    import net.liftweb.http.S
    import net.liftweb.mapper._
    import net.liftweb.http.S._
    import net.liftweb.util.Helpers._
    import net.liftweb.util._
    import java.util.Locale
    import net.liftweb.sitemap._
    import net.liftweb.sitemap.Loc._
    import java.security._

    // gravatar_id - MD5 sum of your email address
    // size - image size
    // rating - rating of the image, let's start with "G" which is also the default

    class Gravatar {
    val theUser: User = User.currentUser.openOr(new User)

    private def getMD5(s: String): String = {
    val m = MessageDigest.getInstance("MD5")
    m.update(s.getBytes(),0,s.length())
    BigInt(1,m.digest()).toString(16)
    }

    def getGravatar(xhtml: NodeSeq): NodeSeq = {
    var src = "http://www.gravatar.com/avatar.php?gravatar_id=" + getMD5(S.attr("e").openOr(theUser.email))
    src = src + "&size=" + S.attr("s").openOr("42")
    src = src + "&rating=" + S.attr("r").openOr("G")

    <img src={src}/>
    }

    And here’s how to use it in your templates:

    <lift :Gravatar.getGravatar e="email address" s="80" r="G" />

     
  • Tyler 8:50 am on April 3, 2007 Permalink  

    Skim – PDF annotation application. 

    Skim 0.2 is a PDF annotation application.

    Hmm.. I’ve been spending time learning ObjC/Cocoa over the last few months. And I’m writing an application. A PDF annotation application. WTF?

    Stupid more skilled developers *fist shake*

     
  • Tyler 1:02 pm on January 31, 2007 Permalink  

    Grails 0.4 released 

    Here’s the release information.

     
  • Tyler 10:34 am on December 20, 2006 Permalink  

    Visual Studio on Parallels / Red Steel. 

    After installing Parallels on my MacBook Pro I installed Visual Studio C# Express to see how it would perform. Without any sort of metrics I’ll say that it seemed faster than my T60, notably compilation appeared to be much faster.

    Laura rented Red Steel for the Wii. Um.. I burned through the first two levels and the entire time I was fighting with the controls. It’s not a bad game, in fact, it’s quite good for a launch title. I think that more time with the controller and more time on the cut scenes and this game would have been great. As it is, the control scheme knocked me out of the experience.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel