This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To use the H2 console servlet in your Lift app add the following to your web.xml | |
and Boot.scala files. Then you can access it via /console. | |
web.xml: | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE web-app | |
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" | |
"http://java.sun.com/dtd/web-app_2_3.dtd"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
H2 has it's own connection pool manager that H2 claims [1] is faster than using | |
DriverManager.getConnection(). Here's how to configure it for use in a Lift app. | |
/** | |
* H2 db connection manager | |
*/ | |
object H2DBVendor extends ConnectionManager { | |
// create the connection pool | |
private val cp = org.h2.jdbcx.JdbcConnectionPool.create( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.liftweb.util.ActorPing | |
import net.liftweb.common.Logger | |
class Boot extends Logger { | |
def boot { | |
// where to search snippet | |
LiftRules.addToPackages("your.package") | |
... | |
val myActor = new MyActor | |
myActor ! Msg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.joda.time.{DateTime, DateTimeConstants, Period => JodaPeriod} | |
import org.joda.time.format.ISOPeriodFormat | |
object waiverSetting extends StringField(this, 32) { | |
override def optional_? = true | |
override def displayName = "Waiver Period" | |
val periodFormatter = ISOPeriodFormat.standard | |
override def defaultValue = periodFormatter.print(new JodaPeriod) | |
def period: JodaPeriod = periodFormatter.parsePeriod(value) | |
def setFromForm(d: Int, h: Int, m: Int) = setBox(Full( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.regex._ | |
import scala.xml._ | |
import org.mindrot.jbcrypt.BCrypt | |
import net.liftweb._ | |
import common._ | |
import http.S | |
import http.js._ | |
import json.JsonAST.{JNothing, JNull, JString, JValue} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.1 | |
# This is script that extracts the trees of two commits to temporary | |
# directories and then runs meld on both directories, so you can compare | |
# them using meld's nice recursive browsing interface. | |
# | |
# This is for an answer to this question: | |
# http://stackoverflow.com/questions/2006032/view-differences-of-branches-with-meld | |
from subprocess import call, Popen, PIPE, check_call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable.{HashMap, SynchronizedMap} | |
import scala.xml._ | |
import net.liftweb._ | |
import common._ | |
import http._ | |
import util.Props | |
import util.Helpers._ | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Boot extends Loggable { | |
def boot { | |
// set the default htmlProperties | |
LiftRules.htmlProperties.default.set((r: Req) => new XHtmlInHtml5OutProperties(r.userAgent)) | |
// set htmlProperties based on uri | |
LiftRules.earlyInStateful.append(HtmlPropertiesManager.testUri) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.xml.NodeSeq | |
import net.liftweb._ | |
import common._ | |
import json._ | |
import json.ext.{EnumSerializer, JsonBoxSerializer} | |
import mongodb.JObjectParser | |
import mongodb.record.BsonRecord | |
import mongodb.record.field.MongoFieldFlavor | |
import record.{Field, FieldHelpers, MandatoryTypedField} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.MathContext | |
import net.liftweb.record.field._ | |
import net.liftweb._ | |
import common._ | |
import json._ | |
import json.ext.{EnumSerializer, JsonBoxSerializer} | |
import mongodb.record._ | |
import mongodb.record.field._ | |
import paypal._ |
OlderNewer