This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Fibonacci | |
{ | |
class Program | |
{ |
This file contains 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
void foo() { | |
print "bar"; | |
} |
This file contains 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
package mosquito.g1; | |
import java.awt.geom.Line2D; | |
import java.util.HashSet; | |
import java.util.LinkedHashMap; | |
import java.util.LinkedHashSet; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Map.Entry; | |
import java.util.Random; |
This file contains 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
private boolean isLetterInDictionary(Letter letter, Set<Multiset<Character>> dictionary) { | |
for (Multiset<Character> temp : dictionary) { | |
if(temp.contains(letter.getCharacter())) { | |
logger.error("temp(" + temp.toString() + " contains the letter, " + letter.toString()); | |
return true; | |
} | |
} | |
return false; | |
} |
This file contains 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
private List<Integer> getStartTimes(List<Plane> inPlanes, List<Integer> startTimes, int index) { | |
if (inPlanes.size() == 0) { | |
return startTimes; | |
} | |
else { | |
startTimes.add(inPlanes.remove(index++).getDepartureTime()); | |
return getStartTimes(inPlanes, startTimes, index); | |
} | |
} |
This file contains 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
package test | |
import com.mongodb.casbah.Imports._ | |
import org.scalatest._ | |
import org.scalatest.matchers.ShouldMatchers | |
import play.api.libs.json._ | |
import play.api.{Play, Logger} | |
class TestLoadingJsNumber extends FlatSpec with ShouldMatchers { |
This file contains 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
// recurse through each element of "docs", using `builder` to add another key-value MongoDBObject for time-stamp purposes | |
def getEnrichedDocs(docs: List[DBObject]) : List[DBObject] = { | |
def go(list : List[DBObject], docs_: List[DBObject]) : List[DBObject] = list match { | |
case x :: xs => var builder = MongoDBObject() | |
builder = builder ++ MongoDBObject("LoadTimestamp" -> Utils.getTimestamp) // returns a Long (I know that I should be using a BSON TS, but that's a TODO | |
builder = builder ++ x | |
go(xs, docs_ :+ builder) // call go() recursively with the updated accumulator (2nd arg) | |
case Nil => docs_ | |
} | |
go(docs, List[DBObject]()) |
This file contains 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
// Array of JSON Objects where each JSON object has a non-distinct key name | |
// note that `records`'s array element row has name, age and hair | |
// Note- update at bottom showing how to use $elemMatch to achieve what the initial find()'s could not | |
db.test3.find() | |
{ "_id" : 1, "records" : [ { "name" : "ralph", "age" : "55", "hair" : "brown" } ] } | |
{ "_id" : 2, "records" : [ { "name" : "bill", "age" : "25", "hair" : "blue" } ] } | |
{ "_id" : 3, "records" : [ { "name" : "joe", "age" : "35", "hair" : "blonde" } ] } | |
> | |
> db.test3.ensureIndex( { records: 1} ) |
This file contains 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
package test | |
import com.mongodb.casbah.Imports._ | |
import com.mongodb.util.JSON | |
import com.typesafe.config.ConfigFactory | |
import org.scalatest._ | |
import org.scalatest.matchers.ShouldMatchers | |
import play.api.libs.json._ | |
import play.api.{Play, Logger} |
OlderNewer