working on it ...

Filters

Explore Public Snippets

Sort by

Found 2 snippets

    public by DanielOgbuagu  201740  1  5  0

    Adding a *.jar file (originating from java-wrapped C++ code) to an SBT project classpath

    I thought using unmanaged dependencies in SBT projects was simply dropping a jar file into the lib directory, until I bought an SDK for a biometric device. Both the C++ and the Java packages were provided. I opted for the Java package, copying the provided jar file and the JNI (*.so) files into the appropriate locations and configuring the ja
    /**
     * In my <code>build.sbt</code> file, I appended a blank line and then the following:
     */
    
    libraryDependencies += "groupID" % "artifactId" % "revision" from "file:///home/Danogbuagu/Projects/biometric-lib/filename.jar"
    
    // where,
    // groupID for example is like: com.zigzagcompany 
    // artifactId for example is like: zigzag
    // revision for example is like: 1.3.4
    // Remember the line befor the code and that after.

    public by DanielOgbuagu  4163  1  6  4

    Creating MongoDb Compound Indexes in Liftweb (i.e. Scala)

    // Assuming the following Person class and companion object:
    class Person extends MongoRecord[Person] with ObjectIdPk[Person] {
      def meta = Person
    
      object surname extends StringField(this, 40) 
    
      object firstName extends StringField(this, 40) 
    
      object otherNames extends StringField(this, 40) {
        override def optional_? = true
      }
      
      // other fields ...
      
    }
    
    object Person extends Person with MongoMetaRecord[Person]
    with RogueMetaRecord[Person] with Loggable {
    
      import mongodb.BsonDSL._
    
      override def collectionName = "Persons"
    
    // Now, here's the compound index, unique on the combined fields.
      val nameKeys = (surname.name -> 1) ~ (firstName.name -> 1)
      createIndex(nameKeys, unique = true)
    }
    

    List Complete ( 2 snippets total )

    Cannot find what you were looking for?
    Ask the Snip2Code Community

    • Public Snippets
    • Channels Snippets