How can I make console.log show the current state of an object?

I think you’re looking for console.dir(). console.log() doesn’t do what you want because it prints a reference to the object, and by the time you pop it open, it’s changed. console.dir prints a directory of the properties in the object at the time you call it. The JSON idea below is a good one; you … Read more

How can I use “puts” to the console without a line break in ruby on rails?

You need to use print instead of puts. Also, if you want the dots to appear smoothly, you need to flush the stdout buffer after each print… def print_and_flush(str) print str $stdout.flush end 100.times do print_and_flush “.” sleep 1 end Edit: I was just looking into the reasoning behind flush to answer @rubyprince’s comment, and … Read more

In Eclipse, can I have multiple Console views at once, each showing a different Console?

Yes, located near your console tab should be a button “Open Console”. If you click this button one of your options should be “New Console View”. You’ll now have 2 console views. One of your other buttons near your console tab is “Display Selected Console”. When you choose this option you can select from any … Read more

How to clear the console?

Since there are several answers here showing non-working code for Windows, here is a clarification: Runtime.getRuntime().exec(“cls”); This command does not work, for two reasons: There is no executable named cls.exe or cls.com in a standard Windows installation that could be invoked via Runtime.exec, as the well-known command cls is builtin to Windows’ command line interpreter. … Read more

Error in MySQL when setting default value for DATE or DATETIME

The error is because of the sql mode which can be strict mode as per latest MYSQL 5.7 documentation MySQL Documentation 5.7 says: Strict mode affects whether the server permits ‘0000-00-00’ as a valid date: If strict mode is not enabled, ‘0000-00-00’ is permitted and inserts produce no warning. If strict mode is enabled, ‘0000-00-00’ … Read more

Changing default encoding of Python?

Here is a simpler method (hack) that gives you back the setdefaultencoding() function that was deleted from sys: import sys # sys.setdefaultencoding() does not exist, here! reload(sys) # Reload does the trick! sys.setdefaultencoding(‘UTF8’) (Note for Python 3.4+: reload() is in the importlib library.) This is not a safe thing to do, though: this is obviously … Read more

Reading value from console, interactively

you can’t do a “while(done)” loop because that would require blocking on input, something node.js doesn’t like to do. Instead set up a callback to be called each time something is entered: var stdin = process.openStdin(); stdin.addListener(“data”, function(d) { // note: d is an object, and when converted to a string it will // end … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)