recursive permission settings under linux
Linux No Comments »For files:
find /dirpath -type f -name ‘*.php’ -exec chmod 0755 {} \;
For folders:
find /dirpath -type d -exec chmod 0771 {} \;
allow only numbers in an input with javascript
Javascript No Comments »javascript: this.value = this.value.replace(/[^0-9]/g, ”);
Weird Drupal pager behaviour
Uncategorized No Comments »Can be because of your SQL is formatted with whitespaces, linebreaks
--- pager.inc.orig 2007-07-30 09:49:13.000000000 -0400
+++ pager.inc 2007-07-30 09:47:36.000000000 -0400
@@ -62,7 +62,7 @@
// Construct a count query if none was given.
if (!isset($count_query)) {
- $count_query = preg_replace(array('/SELECT.*?FROM /As', '/ORDER BY .*/'), array('SELECT COUNT(*) FROM ', ''), $query);
+ $count_query = preg_replace(array('/\s*?SELECT.*?FROM /As', '/ORDER BY .*/'), array('SELECT COUNT(*) FROM ', ''), $query);
}
// Convert comma-separated $page to an array, used by other functions.
How to handle data from a Drupal 6.x AHAH callback with a custom javascript function
Drupal, Javascript, jQuery No Comments »I’ve achieved it with a bit of hack.
in misc/ahah.js +2 rows
Drupal.ahah.prototype.success = function (response, status) {
eval("if(typeof "+this.callbackfunc+" == 'function') { "+this.callbackfunc+"('"+escape(response.data)+"'); }");
Drupal.ahah = function(base, element_settings) {
this.callbackfunc = element_settings.callbackfunc;
in includes/form.inc +1 row:
function form_expand_ahah($element) {
...
$ahah_binding = array(
...
add line: 'callbackfunc' => $element['#ahah']['callbackfunc'],
Thats all.
now you can use a custom javascript callback name like:
$form['cim']['irszam'] = array(
'#type' => 'textfield',
'#title' => t('Irszám'),
'#size' => 4,
'#maxlength' => 4,
'#ahah' => array(
'event' => 'blur',
'path' => 'get_varos_by_irszam',
'callbackfunc' => 'somefunctiontoreceive',
),
);
and in one of your JS files:
function somefunctiontoreceive(data){
alert(data); // you can do with it whatever you want
}
This should be a drupal patch, but I’m a beginner, I will learn it sometime and add it here.
Must have Android apps
android No Comments »Handcent SMS, WiSyncPlus, IntelligentHomeScreen, EasyMoney, Twitdroid, Androidvnc, iMusic, Nimbuzz, Shazam, Call Meter
SMS backup: http://code.google.com/p/android-sms/
write SMS from/via PC: http://code.google.com/p/desktopsms/downloads/list
Selecting the first matching parent element with jquery
Uncategorized No Comments »Very very simle
$(this).parents(”.kategoriak:first”)
or
$(”.arr_h”,$(this).closest(”TR”))
How to test your webpage under different IE versions?
Uncategorized No Comments »Download Microsoft Virtual PC and different OP system / browser images from here:
Simple object transmitting between Javascript - PHP via AJAX call
Javascript, PHP No Comments »I suppose, you know how to make an AJAX call, the simplest solution as long as I know is use JSON.
PHP:
$data = array( 'name'=>'John' , 'age'=>'23');
echo json_encode($data);
Javascript:
data = eval("(" + data + ")");
alert(data.name); // John