Monthly Archives: January 2012
capture QKeySequence from QKeyEvent
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 if (event->type() … Continue reading
Static cast : Pass QWidget and grab Custom class out that
/* Pass QWidget and grab MainWindow out that */ Pane::Pane(QWidget *parent) : QFrame (parent){ mainWindow = static_cast<MainWindow*>(parent); }
Find actual javascript size of array
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 //find value in associative array for (i in tmpArr) { console.log(i+’:'+tmpArr[i]+’, ‘); // outputs: one:First, two:Second, three:Third } … Continue reading
Dynamic base url : CodeIgniter and Zend Framework
1 2 3 $base_url = ((isset($_SERVER[’HTTPS’]) && $_SERVER[’HTTPS’] == "on") ? "https" : "http"); $base_url .= "://".$_SERVER[’HTTP_HOST’]; $base_url .= str_replace(basename($_SERVER[’SCRIPT_NAME’]),"",$_SERVER[’SCRIPT_NAME’]);
Javascript: checking if a function exists
It’s typeof to the rescue (again)! To check if a function exists before you try and call it (and get a nasty javasscript error), use typeof to check. Heres something I prepared earlier: 1 2 3 4 if(typeof window.myFunction == … Continue reading