Skip to content
Advertisement

When to close MongoDB database connection in Nodejs

Working with Nodejs and MongoDB through Node MongoDB native driver. Need to retrieve some documents, and make modification, then save them right back. This is an example: With asynchronous nature, if the process of updating the document takes longer, then when cursor reaches the end of documents, database connection is closed. Not all updates are saved to the database. If

How to make a text flash in html/javascript?

I know flashing text is banned at many places but still as my client requires it, I need to flash one line of text using HTML, JavaScript which ever is feasible. I would like the text to appear and disappear within seconds and continue this cycle. I know text-decoration:blink in CSS can do this but it only works in FireFox,

How can I hide the Android keyboard using JavaScript?

I would like to hide the Android virtual keyboard in JavaScript. Someone suggested doing this: But this doesn’t work if the keyboard is already visible. Is this something that can be done? Answer What you need to do is create a new input field, append it to the body, focus it and the hide it using display:none. You will need

Backbone and jQuery events

I have a simple task – retrieve click listener function from DOM element. I’ve fased two problems: I have no idea how to obtain event listener, that was set via addEventListener function $(element).data(‘events’) is always empty Talking about first problem – I think it’s not critical as I’m using this function only in one place. But the second problem is

In Javascript, what does this underscore mean?

I’m reading a tutorial on backbone.js here: http://addyosmani.com/blog/building-spas-jquerys-best-friends/ What are the underscores? (_index, _photos, _album) Why use them? Answer It means private fields or private methods. Methods that are only for internal use. They should not be invoked outside of the class. Private fields contain data for internal use. They should not be read or written into (directly) from outside

Printing a web page using just url and without opening new window?

I am using this script to print a webpage. My views render this page and The JS take care all other things. But I dont want to open new window for that. So, What should I use instead of window.open(URL) so no new window opens. Similarly, I don’t want to open new window for print function.So, Whenever I render this

Advertisement