Why is this not throwing a NullPointerException?

null assignments do not change value by globally destroying that object. That kind of behavior would lead to hard-to-track bugs and counterintuitive behavior. They only break that specific reference. For simplicity, let’s say that sample points to address 12345. This is probably not the address, and is only used to make things simple here. The … Read more

How to write to error log file in PHP [closed]

If you don’t want to change anything in your php.ini file, according to PHP documentation, you can do this. error_log(“Error message\n”, 3, “/mypath/php.log”); The first parameter is the string to be sent to the log. The second parameter 3 means expect a file destination. The third parameter is the log file path.

How do I copy the contents of one ArrayList into another?

You can use such trick: myObject = new ArrayList<Object>(myTempObject); or use myObject = (ArrayList<Object>)myTempObject.clone(); You can get some information about clone() method here But you should remember, that all these ways will give you a copy of your List, not all of its elements. So if you change one of the elements in your copied … Read more

Have you ever used PhantomReference in any project?

I used PhantomReferences in a simplistic, very specialized kind of memory profiler to monitor object creation and destruction. I needed them to keep track of destruction. But the approach is out-dated. (It was written in 2004 targeting J2SE 1.4.) Professional profiling tools are much more powerful and reliable and the newer Java 5 features like … Read more

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