Swift: print() vs println() vs NSLog()

A few differences: print vs println:The print function prints messages in the Xcode console when debugging apps.The println is a variation of this that was removed in Swift 2 and is not used any more. If you see old code that is using println, you can now safely replace it with print.Back in Swift 1.x, print did not add newline characters at the end of … Read more

Fixing Segmentation faults in C++

Compile your application with -g, then you’ll have debug symbols in the binary file. Use gdb to open the gdb console. Use file and pass it your application’s binary file in the console. Use run and pass in any arguments your application needs to start. Do something to cause a Segmentation Fault. Type bt in the gdb console to get a stack trace of the Segmentation Fault.

R debugging: “only 0’s may be mixed with negative subscripts”

The problem: actionlist$RPos[1000] has a value of 21. n1 ranges from -31 to 0. When you add them you get a vector with a mix of positive and negative values, which isn’t allowed in subsetting. How I got there: First check traceback(): This tells me the problem is in actionlist$RPos[i] + n1 most likely. Then I just added a simple print(i) statement to tell … Read more

How can I write to the console in PHP?

Firefox On Firefox you can use an extension called FirePHP which enables the logging and dumping of information from your PHP applications to the console. This is an addon to the awesome web development extension Firebug. http://www.studytrails.com/blog/using-firephp-in-firefox-to-debug-php/ Chrome However if you are using Chrome there is a PHP debugging tool called Chrome Logger or webug (webug has problems with the order of … Read more