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
let mapleader = " " | |
set exrc | |
set relativenumber | |
set nu | |
set nohlsearch | |
set mouse=a | |
set hidden | |
set splitright | |
set splitbelow |
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
Selector | Description | |
---|---|---|
* | Selects all elements | |
element | Selects all elements of type 'element' e.g. h1 or p | |
el1 comma el2 | Selects all elements of the specified type e.g. h1 or h2 | |
el1 el2 | Selects all elements of type 'el2' inside elements of type 'el1' e.g. div p selects all 'p' within 'div' | |
el1 > el2 | Selects all elements of type 'el2' where 'el1' is the direct parent e.g. div > p selects all 'p' with parents 'div' | |
.cls | Selects elements with the class 'cls' | |
.cls1.cls2 | Selects elements with class 'cls1' and 'cls2' e.g. .task.information | |
#id | Selects elements with the id 'id' | |
element.class | Selects elements of type 'element' with class '.class' e.g. p.information |
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
> db.cappedLogsJavaDriver.stats() | |
{ | |
"ns" : "test.cappedLogsJavaDriver", | |
"count" : 5, | |
"size" : 180, | |
"avgObjSize" : 36, | |
"storageSize" : 4096, | |
"numExtents" : 1, | |
"nindexes" : 1, | |
"lastExtentSize" : 4096, |
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
for (int i = 0; i < 8; i++) { | |
LogEntry logEntry = new LogEntry(i); | |
datastore.save(logEntry); | |
} |
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
MongoClient mongoClient = new MongoClient(new MongoClientURI("mongodb://localhost")); | |
DB db = mongoClient.getDB("test"); | |
Morphia morphia = new Morphia(); | |
morphia.map(LogEntry.class); | |
Datastore datastore = morphia.createDatastore(mongoClient, "test"); | |
datastore.ensureCaps(); |
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
@Entity(value="cappedLogsMorphia", cap=@CappedAt(count=5, value=4096)) | |
public class LogEntry { | |
private int logId; | |
@Id | |
private ObjectId id; | |
public LogEntry(int logId) { | |
this.logId = logId; |
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
> db.cappedLogsJavaDriver.find() | |
{ "_id" : ObjectId("54a1ca44a82617da4f72e025"), "logId" : 3 } | |
{ "_id" : ObjectId("54a1ca44a82617da4f72e026"), "logId" : 4 } | |
{ "_id" : ObjectId("54a1ca44a82617da4f72e027"), "logId" : 5 } | |
{ "_id" : ObjectId("54a1ca44a82617da4f72e028"), "logId" : 6 } | |
{ "_id" : ObjectId("54a1ca44a82617da4f72e029"), "logId" : 7 } |
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
for (int i = 0; i < 8; i++) { | |
BasicDBObject logEntry = new BasicDBObject("logId", i); | |
collection.insert(logEntry); | |
} |
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
MongoClient mongoClient = new MongoClient(new MongoClientURI("mongodb://localhost")); | |
DB db = mongoClient.getDB("test"); | |
DBCollection collection; | |
if (!db.collectionExists("cappedLogsJavaDriver")) { | |
BasicDBObject options = new BasicDBObject("capped", true); | |
options.append("size", 4096); | |
options.append("max", 5); | |
collection = db.createCollection("cappedLogsJavaDriver", options); | |
} else { |
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
db.createCollection("logs", {capped: true, | |
size: 4096, | |
max:5}) |
NewerOlder