Jun 03 2010
Chrome Alert
Everytime I open Chrome, I get this dialog which is kind of annoying, and of course, it’s my default browser.
Is there anyone having same issue?

Jun 03 2010
Everytime I open Chrome, I get this dialog which is kind of annoying, and of course, it’s my default browser.
Is there anyone having same issue?

May 16 2010
I have been using Poderosa as a SSH client for quite a few days.
I think it’s quite better than Putty especially if you are prefer tabbed windows like me.
And the divided panel feature of Poderosa is also quite nice.
Just wondering how can I miss such a nice tool for so long.
P.S. But if you are die hard Putty fan, then then there is also Putty Connection Manager that may make your day.

May 10 2010
I just learned something hard way today.
I have a collection, lets call it foo_collection. The data format of that collection is something like this:
{
file: "filename1",
started: "Sat Feb 20 2010 04:15:02 GMT-0500 (EST)",
ended: "Sat Feb 20 2010 04:15:04 GMT-0500 (EST)"
}
Initially, the key “file” is used as normal index
db.ensureIndex({file: 1});
Later on, I had to change the index from normal to unique. So, I did:
db.ensureIndex({file: 1}, {unique: true});
This didn’t work because, the collection already contained multiple similar values of file key. And MongoDB console also doesn’t show any error or any message when the above command is run.
It should have been:
db.ensureIndex({file: 1}, {unique: true, dropDups: true});
Again, it should be noted that the above command will delete all the duplicate entries with the indexed key. So, use with caution.
I know this was kind of childish mistake but wanted to share so, someone reading this post won’t repeat it again.
Update: You can also check if db.ensureIndex() is working or not by calling db.getLastError() and you can also do the same from driver level by setting “safe” option. (Credit: Kristina)

Apr 05 2010
The number of “notes” count and actual notes items are inconsistent in the above screenshot.
This is a typical example where caching really does not work. Facebook likes, Tumblr notes count and article listing in Hacker News are few examples where in memory database is more useful than DB caching.

Mar 22 2010
I have been using MongoDB for few months. It is one of the arrays of open source NoSQL solutions available. The way MongoDB including CouchDB stores data in JSON format as a document (It’s called BSON, Binary JSON in MongoDB). A document is a loosely typed data format as compared to strictly typed in SQL based systems. You can find more detail information about document data format here. In MongoDB, all those documents are contained in a collection which acts as a bucket for those documents. So, a collection “contact_info” may be formatted as:
{
"_id": "Prajwal Tuladhar"
"street": "3478 78 ST",
"zip": 11378,
"email": "praj@prajwal-tuladhar.net.np",
"phone": {
"home": "64622251452"
}
}
{
"_id": "Max Payne"
"street": "17th Floor 225 Park Avenue",
"zip": 10001,
"phone": {
"mobile": "7182524423",
"office": "2127783264"
},
"fax": "1.913.384.6577"
}If you look at the above two documents, field “phone” is an example of embedded document. Other examples may be:
db.students
=======
{
"_id": "Jane",
"address": {
"address": "123 Main St",
"city": "New York",
"zip": 10011
},
"scores": [
{
"subject": "Biology",
"grade": 4.00
},
{
"subject": "Physics",
"grade": 3.50
}
]
}Here are some of the excerpts about embedded documents from MongoDB docs:
Line item detail objects typically are embedded.
Objects which follow an object modelling “contains” relationship should generally be embedded.
I think one key point is missing here. The document should be embedded or used as a reference depending on the context of the domain. If the document can be expressed as domain model then, it should be declared as first class document while optionally expressing their relationship as reference or it can be also done from application level rather than DB level (Just imagine table relationship for MySQL ISAM). So, in the above examples, if the scores can be expressed as domain object (which depends on the context of the application), it should not be used as embedded document.
And from database point of view also, embedded documents are hard to update / manipulate while they are loaded in advance which can be problematic from performance point of view when size is freaking high. There is no concept of lazy loading in the form of cursor object for embedded documents so, one should acknowledge that large embedded documents may lead to bad design and the maximum size of the MongoDB document is 4 MB,
