PHP dump, Beejive and MySQL tidbits
Hi,
Haven’t had time to post recently and this is a relatively short one.
I’ve been coding with PHP again recently and was looking for something similar to ColdFusions cfdump and didn’t know until last week that the var_dump function existed, its very handy although it doesn’t output the dumped variable in a very user-friendly fashion.
As I posted previously I jailbroke my iTouch and was looking for a good app for IM. I installed Apollo IM hearing that it was meant to be very good but it only has .Mac, MSN, AIM and one other I can’t remember, the main problem with the app is that there doesn’t seem to be Google Talk support. After looking around for a bit I found Beejive which is excellent, very nice to use but unfortunately only works from within Safari and isn’t a standalone app but will do for the moment. Check it out at Beejive.
I had this error during the week when doing some CF troubleshooting. I couldn’t figure it out for a while and the error message wasn’t especially helpful.
Element 25316 is undefined in a Java object of type class coldfusion.runtime.TemplateProxy.
The error occurred (I don’t know why I was doing this) when I was trying to index into a CF object as you would a struct! So if I had an object oObject and try to do something like oObject["someValue"] you will get an error like above.
Finally just a couple of quick really useful MYSQL snippets I picked up during the week. I needed to rename a MYSQL table, the SQL below does this nicely.
rename table myOriginalTable TO newTableName;
Another really great piece of SQL performs an insert if a record doesn’t exist and if it does exist it performs an update on the record.
INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE c=c+1;
Coalesce is a nice MYSQL function, it returns the first non-null in a list. If there is nothing besides NULL in the list, 1 is returned as in the case below.
SELECT COALESCE(NULL,1) FROM tbl_test