Skip to content

Instantly share code, notes, and snippets.

View adamw's full-sized avatar

Adam Warski adamw

View GitHub Profile
From 58dd78237b3222e73a62e8dd8a4be001ff49785a Mon Sep 17 00:00:00 2001
From: Adam Warski <[email protected]>
Date: Tue, 2 Feb 2010 11:52:54 +0100
Subject: [PATCH] Localizing display names of fields in ProtoUser
Localizing display names of fields in ProtoUser, also making the localForm method protected instead of public
---
.../src/main/resources/i18n/lift-core.properties | 10 +++++++---
.../main/resources/i18n/lift-core_pl.properties | 4 ++++
.../main/scala/net/liftweb/mapper/ProtoUser.scala | 16 ++++++++--------
# In Rails config: config.logger = RubyToSlf4jLogger.new(config.paths.log.first)
require "java"
class RubyToSlf4jLogger < Logger
include_class "org.slf4j.LoggerFactory"
def initialize(logdev)
super
@logger = LoggerFactory.getLogger("ruby")
object Example {
// Works
sealed trait Command1[R] // R - return type
case class IntCommand1() extends Command1[Int]
case class StringCommand1() extends Command1[String]
def execute[R](cmd: Command1[R]): R = cmd match {
case IntCommand1() => 5
case StringCommand1() => "x"
}
> db.x.find()
{ "_id" : ObjectId("518cfe49a04a86d494396a96"), "a" : "20130430" }
{ "_id" : ObjectId("518cfe4ba04a86d494396a97"), "a" : "20130431" }
{ "_id" : ObjectId("518cfe4fa04a86d494396a98"), "a" : "20130501" }
{ "_id" : ObjectId("518cfe57a04a86d494396a99"), "a" : "20131001" }
{ "_id" : ObjectId("518cfe81a04a86d494396a9a"), "a" : "20130520" }
> db.x.find({"a": {"$lt": "20130501"}})
{ "_id" : ObjectId("518cfe49a04a86d494396a96"), "a" : "20130430" }
{ "_id" : ObjectId("518cfe4ba04a86d494396a97"), "a" : "20130431" }
> db.x.find({"a": {"$gt": "20130501"}})
2013-10-04 11:05:03,921 FATAL org.apache.hadoop.mapred.Child (main): Error running child : java.lang.NoSuchMethodError: org.apache.lucene.util.PriorityQueue.<init>(I)V
at org.apache.mahout.math.hadoop.similarity.cooccurrence.TopElementsQueue.<init>(TopElementsQueue.java:33)
at org.apache.mahout.math.hadoop.similarity.cooccurrence.RowSimilarityJob$UnsymmetrifyMapper.map(RowSimilarityJob.java:405)
at org.apache.mahout.math.hadoop.similarity.cooccurrence.RowSimilarityJob$UnsymmetrifyMapper.map(RowSimilarityJob.java:389)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:771)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:375)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
# VERSION 1.0
# the base image is a trusted ubuntu build with java 7 (https://index.docker.io/u/dockerfile/java/)
FROM dockerfile/java
# that's me!
MAINTAINER Adam Warski, [email protected]
# we need this because the workdir is modified in dockerfile/java
WORKDIR /
#!/bin/sh
function copy_if_changed {
local path_from="$2/$1"
local path_to="$3/$1"
local md5_from=$(md5 -q $path_from)
if [ -e $path_to ]
then
# docker/recipes/setup.rb:
package "docker" do
package_name "lxc-docker-0.11.1"
action :install
end
# docker/recipes/kill_containers.rb:
script "kill_all_containers" do
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# http://www.vagrantbox.es/
config.vm.box = "ubuntu-12.04-docker"
config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-12.04-amd64-vbox.box"
# Sets the ip we'll use to access the box
config.vm.network :private_network, ip: "10.0.0.10"
config.vm.hostname = "myapp"
package com.softwaremill.mqperf
import com.softwaremill.mqperf.mq.Mq
import scala.util.Random
import com.softwaremill.mqperf.config.TestConfigOnS3
object Sender extends App {
new TestConfigOnS3().whenChanged { testConfig =>
println(s"Starting test (sender) with config: $testConfig")