liviu's blog
How to see php errors in firebug
If you want to see php errors in firebug here is how you do it: <?php
/**
* class: Debugger
* author: <a href="http://doru.serveblog.net">Moisa Doru</a>
* contact: <a href="mailto:moisadoru@gmail.com">moisadoru@gmail.com</a>
* info: this class displays PHP errors in Firebug; works only in PHP5, tested in PHP 5.2.0
* usage: <strong>include_once("debugger.php")</strong> as the very first include();
* licence: free as in free beer ;)
*/
How to view the code of included files in firefox
JSView is a nice firefox addon that let's you see the source of external js files for example, easy.
From the description of the addon:
A nice way to get the value of a $_GET in php
Here is a nice way to get the value of a $_GET in php (i think it will also work with $_POST)
function get($value)
{
$valoare = isset($_REQUEST[$value]) ? addslashes(strip_tags($_REQUEST[$value])) : '';
return $valoare;
}
javascript typecasting
In case you want to make sure javascript wants to add two values instead of concaternating them when you use "+" you can make them act as an int for example with parseInt:
a+1 might concaternate
parseInt(a) + parseInt(1) will add
javascript bidimensional array working example
It was kind of hard to make a bi dimensional array in javascript; i struggled a bit when i needed to do so; so tgis is what worked for me eventually:
How to debug javascript
I found a way to debug javascript, in case something more powerfull is needed:
The how to is described here: http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html
How to call a javascript function from actionscript
This is how you call a javascript function from actionscript (2 I think):
on (press){
getURL("JavaScript:function(argument)");
}
A smart search for mysql - full text search
Mysql has something called full text search, that returns results by relevance. Kind of like google does. The downside is that it can only be used on MyISAM tables, which unlike InnoDB tables, lock the entire table when it's being written to, instead of locking only a row.
For a table that is very ofter being written and read from that could be hard to take.
mysql: How to see what field repeats itself in a table
I liked this query a lot so i wanted to remember it.It's simple but pretty cool:select column, count(column) as numfrom tablegroup by column having num > 1;
How to block an ip from viewing your adsense ads
I saw this here i think.
It's a simple way to block certain ip's you might suspect want to give you invalid clicks to get you banned in adsense.
Of course first you have to have a list of ip's you suspect to be ill intentioned, and that isn't very likely to happen in the real world, but if you do, here is what you could do.