Where answers come from

Some pages can ask a language model questions. Set this up once; your choice is remembered in this browser for the whole site.

Model source
Use another source instead

Smallest-to-largest weight downloads. Qwen3.5 0.8B is our starting choice for page Q&A. GPU estimates are not total RAM: leave room for the browser, context and temporary buffers. Hardware changes speed and capacity; answers still need checking.

Session-only loading avoids saving model weights, uses extra RAM and downloads again after unloading. Turn it off to save downloads. Delete-data-on-exit or private browsing may impose a much smaller storage limit than the displayed estimate.

You sign in on OpenRouter; it gives this page a key for your account.

A free account does not make every model free. Choose a model with a listed :free variant; merely adding that suffix does not create one. Check free-model availability and pricing.

Chat

AI assistant, not Shawn Hartsock. It does not speak for him.

Inspect the page excerpt

Up to 4,800 characters, not the whole site. Recent conversation turns are retained within the model’s context limit.

Ask about this page, or just say hello.

Ready when you are.

Not saved or uploaded automatically. Closing keeps this conversation in this tab; changing pages starts a new one. Model replies can be wrong.

Fun with Groovy and the Reflection API

Originally published .

Here’s the scenario: You’ve got dates in the format “MM/dd/yyyy” to be parsed and turned into a real Date object. You would parse the date like so:


 public Date format(String str) {

  def format = new SimpleDateFormat( "MM/dd/yyyy" )

  return format.parse(str)

 }

 public String format(Date date) {

  def format = new SimpleDateFormat( "MM/dd/yyyy" )

  return format.format(date)

 }

And you have hundreds of collections of Java and Groovy objects that your library could be potentially mapping from hashes that look something like this:


 ["foo":[ "id" : "5", "started":"12/11/2007", "name":"bob" ]]

You could write a switch statement for each of these… or you could go and ask the class defintions for what the types of foo.id and foo.started are. But if you do this:


class Foo {

  Long id

  Date started

  String name

}

def foo = new Foo()

println foo.started.getClass()

… that println will print “null” because the started object is set to null. So how do I know if “started” is a date or not? I need to know the type on the other side of the “started” member. It would be nice to have a reverse mapping I could use… so I wrote this:


def getTypeMap(Class clazz) {

    def typeMap = [:]

    def members = clazz.getDeclaredFields()

    members.each( {

        m ->

            typeMap[m.getName()] = m.getType()

    } )

    return typeMap

}

… now you can ask the type of a field like so …


    def classOf(Class clazz, field) {

     def typeMap = getTypeMap(clazz)

     if(typeMap.containsKey(field)) {

      return typeMap[field]

     }

     else {

      return null

     }

    }

… to get the type of the field on the class you are working with… in a loop you would…


def params = ["id":"5","started":"12/11/2007","name":"bob"]

def foo = new Foo()

params.each({ key,val ->

  def clazz = classOf(foo.getClass(),key)

  if(clazz && clazz != Date.class) {

     foo[key] = clazz.newInstance(val)

  }

  else if(clazz) {

     foo[key] = (Date) format(val)

  }

})

Presuming you knew that all the values of “val” were strings and all the members in “Foo” had constructors that could handle a string argument intelligently. I cache up the type map else where so that the real production classOf doesn’t build a new type map on each pass.

But now I can map from arbitrary strings into real objects and back without having to specify a “mapping” for each object.

Explore the map · Browse by topic and date