Posts

apache - ETag header not being sent from PHP -

i'm running php 5.3.2 , apache 2.2.14. using header() , if send "etagx" header in response, if send "etag", correct header name, nothing. header('etagx: "33653a-4831d8249af80"') works, while header('etag: "33653a-4831d8249af80"') does not. there configuration option in php.ini, or in of apache configuration files might affect this? just tested on php 5.3 , apache 2.4 , worked me. make sure apache don't unset etag this: <ifmodule mod_headers.c> header unset etag </ifmodule> fileetag none

drupal - Formatting HTML output of theme function -

i've implemented own theme function ( theme_my_theme_function ) , have implemented hook_theme tell drupal function. works correctly , output want on page, except... when @ html source code, html code outputted function in 1 long line! how theme function output formatted html neat , easy read? if want html formatted, you're going have when build html strings. easier way use template file opposed building strings of html manually (remember php html template language). there pretty write of how here: http://drupal.org/node/165706 the core node module has pretty example: node.module: <?php /** * implementation of hook_theme() */ function node_theme() { return array( 'node' => array( 'arguments' => array('node' => null, 'teaser' => false, 'page' => false), 'template' => 'node', ) ); } node.tpl.php: <div id="node-<?php print $node->nid; ?...

php - Paypal API donations split to different business accounts -

hi possible split paypal online donation different paypal account letting user paying 1 time? i mean , user pays 30€ send 50% of them 1 pp account , 50% pp account... any idea guys? :) you can use paypal's mass pay system after payment has been made main account. can data in , out using api. general overview docs: https://merchant.paypal.com/us/cgi-bin/?cmd=_render-content&content_id=merchant/mass_pay api docs: https://www.x.com/community/ppx/mass_pay the trick in system this, trying not soaked on fees, giving money paypal. mass pay has no fees receiver, , low fees sender. easy process programatically. the other way use api , code split , send $ each party using standard 'send payment' though api. you'll wind giving lot more money paypal way, mass pay better choice.

How can I detect which javascript engine (v8 or JSC) is used at runtime in Android? -

newer versions of android ( > 2.2) include v8 javascript engine, while older versions had jsc. however, according http://blogs.nitobi.com/joe/2011/01/14/android-your-js-engine-is-not-always-v8/ , javascript engine used @ runtime seems depend on environment variable present @ build-time ( js_engine ), hardware specs of device: # default / alternative engine depends on device class. # on devices lot of memory (e.g. passion/sholes), # default v8. on else, choice jsc. my question this: there way can determine javascript engine in use within webpage, embedded webview, or application? if answer no, know js engine used android emulator? the reason i'm asking because of issue: http://code.google.com/p/android/issues/detail?id=12987 basically, may javascript-to-java bridge in jsc broken on android 2.3.x, , impacts application i'm trying write. i'm seeing segfault somewhere deep in jni on emulator, not on handful of physical devices i've tested. i'm tryi...

javascript - find sequence of numbers in array and alert highest number -

i have array looks this: [1,2,3,4,5,6,8,10,12,13,14,15,20,21,22,23,24,25,26,27,28,29,30] the highest count on 1 of found sequences be: 10 my goal loop through array , identify sequences of numbers, find length of highest sequence exists. so, based on array above, length of longest sequence "10" does know of quick , easy script find this? ok, think found short way of doing (only 1 line for loop): var arr = [1,2,3,4,5,6,8,10,12,13,14,15,20,21,22,23,24,25,26,27,28,29,30]; var res = new array(); res[0] = 0; for(var i=1;i<arr.length;i++) res[i] = (arr[i] == arr[i-1] + 1) ? (res[i-1] + 1) : 0; var maxlength = math.max.apply({},res); this gives (10) result. if need (11) (which makes more sense) change 0 1 in loop. jsfiddle link: http://jsfiddle.net/gezza/8/

c++ - Looking for a function (or a macro) to return a boost::scoped_lock -

i'm looking code shortening idea. i'm using boost::scoped_lock lock boost::mutex want shorten amount of code i'm writing. currently have mutex defined in class , member field called _sync . when want lock, have write: scoped_lock<mutex> lock(_sync); the tricky part scoped lock, assume if write static function return scoped_lock, unlock gets out of function scope of static function: static scoped_lock<mutex> lock(mutex& sync) { return scoped_lock<mutex>(sync); } this approach make easy type: public void object::modify() { lock(_sync); // <-- nice , short! ;) // modify object //.. // mutex unlocked when leave scope of modify } is assumption correct? scoped_lock unlock when it's returned static function? #define lock(a) scoped_lock<mutex> scopedlockvar(a) public void object::modify() { lock(_sync); // <-- nice , short! ;) // modify object //.. // mutex unlocked when lea...

asp.net - Not calling SqlConnection.Close() in Windows Forms - Why does it work sometimes -

a friend of mine hosting asp.net 2.0 app @ home until moved , offered host on own win7/iis7/sqle2008r2 server. when put code on server, after few requests error: timeout expired. timeout period elapsed prior obtaining connection pool. may have occurred because pooled connections in use , max pool size reached. first turned max pool size temporarily "fix" problem. took closer @ code. turned out never called sqlconnection.close() . added closing , removed max pool size connection strings, , problem solved. i asked him how solved problem, , if he'd somehow increased max pool size per default in server's default web.config or something. replied ".net garbage collection". relying on garbage collection close database connections, , on server worked. on mine didn't. can explain why? he's on vacation don't want bother him asking him details on versions etc, guess running win2k8. jeff atwood has wonderful article thing, highly...