Posts

Showing posts from June, 2010

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

c - What is the best way to allocate memory to variables within a structure? -

for example, have structure , code: typedef struct { long long *number; } test; test * test_structure; test_structure = malloc(sizeof(test)); test_structure->number = malloc(sizeof(long long) * 100); free(test_structure->number); free(test_structure); versus structure , code: typedef struct { long long number[100]; } test; test * test_structure; test_structure = malloc(sizeof(test)); free(test_structure); since know number array 100, either of these methods acceptable, or 1 way better other, , why? the second way better several reasons: you have release 1 allocation, not 2 (reduced chance of memory leakage). you have encoded size of array in data structure, , code analysis. first version have size, , no-one can subscript wrong. if added 'size' member appropriately initialized first structure, there less force argument, not less force. you can copy entire second structure structure assignment; can't copy first structure in same way. the a

Moving a cocos2d-iphone+box2d boy in one direction -

please can advice me on this. i have cocos2d-iphone +box2d body wish move in 1 direction(movement left right of iphone screen) using accelerometer controls , parallax scrolling. please how do @ moment body moves both left , right once device tilted. not want use forces or impulse since i not enabling touch controls. accelerometer code : - (void)accelerometer:(uiaccelerometer *)accelerometer didaccelerate:(uiacceleration *)acceleration { float32 accelerationfraction = acceleration.y * 6; if (accelerationfraction < -1) { accelerationfraction = -1; } else if (accelerationfraction > 1) { accelerationfraction = 1; b2vec2 gravity(-acceleration.y *10, acceleration.x *10); world->setgravity( gravity ); } thanks in advance . you should use mousejoints. @ tutorial . there explains trying accomplish.

iphone - Custom Image for UIButtonTypeInfoLight Button -

i create custom info type button. halo effect goes on button image, place imageview ontop? or can try add halo setimage? tried setimage, seems when u try set halo, larger actual button, halo gets resized button's bounds. tried disabling clipstobounds, autoresizing mask, , setting contentmode button..but none seem work. neither. have create generic button (either [uibutton buttonwithtype:uibuttontypecustom] or [[uibutton alloc] initwithframe: ... ] , set showstouchonhighlight property yes.

Blending objects with eachother but not with background actionscript 3 -

i have number of objects (represented displayobjects) wish blend eachother. however behind these objects there background not want involve in blending. so want blend these objects eachother , afterwards use result of blending new displayobject (for example put on top of randomly colored background). so have is: var obj1:displayobject = getfirstobj(); var obj2:displayobject = getsecobj(); var background:displayobject = getbackground(); obj1.blendmode = blendmode.add; obj2.blendmode = blendmode.add; a first attempt tried putting these objects common displayobjectcontainer hoping blending mode relative objects contained same displayobjectcontainer, not seem case. var objectspool:sprite = new sprite(); objectspool.addchild( obj1 ); objectspool.addchild( obj2 ); addchild( background ); addchild( objectspool ); so diddent me anywhere. appreciated. edit: changed displayobjectcontainer sprite in last code snippet if put objects container, , remove stage, can draw

php - store a session variable into mysql -

right have this: session_start() $_session['title'] = $_post['title']; i store variable jquery preserved in php session, question ...using mysql_query()...how store session variable in database? i've been trying find out proper way without getting empty value the full query: mysql_query("insert titles (content, type, url, title) values ('$content','7',$url',".mysql_real_escape_string($_session['title'])."')"); here jquery : var title = $(".hidden").text(); $.post("tosqltwo.php", { title: title} ); var url = $(".hide").text(); $(".button").click(function() { var content = $(this).siblings().outerhtml(); $.ajax({ type: "post", url: "tosqltwo.php", data: { content: content, url: url } }); }); i able content, url , type. title remains

JavaScript: Do I need a recursive function to solve this problem? -

in fiddle http://jsfiddle.net/5l8q8/28/ , if click black button, randomly selects 1 of 2 values (red or blue) array. randomly selected value assigned ran . in real life application, there 16 elements in array. if pink "playagain" button, chooses random element same array want make sure it's not same 1 chosen last time. therefore, when click playagain , assign ran lastran , compare next randomly chosen value array and, if same, choose randomly again. however, way have isn't guaranteeing (upon completion of playagain ) ran different. i think need recursive function comment 2 in code below, keep breaking code when try create it. can comment on 3 comments in code below? note, i'm relative newbie, code awful... $("#playagain").click(function(){ lastran = ran; ran = getrandom(myarray, true); if (ran === lastran) { ran = getrandom(myarray, true); //1. need return this? //2. want test ran === lastran again

ruby - Rails update_attributes without save? -

is there alternative update_attributes not save record? so like: @car = car.new(:make => 'gmc') #other processing @car.update_attributes(:model => 'sierra', :year => "2012", :looks => "super sexy, wanna make love it") #other processing @car.save btw, know can @car.model = 'sierra' , want update them on 1 line. i believe looking assign_attributes . it's same update_attributes doesn't save record: class user < activerecord::base attr_accessible :name attr_accessible :name, :is_admin, :as => :admin end user = user.new user.assign_attributes({ :name => 'josh', :is_admin => true }) # raises activemodel::massassignmentsecurity::error user.assign_attributes({ :name => 'bob'}) user.name # => "bob" user.is_admin? # => false user.new_record? # => true

javascript - Socket.IO basic example not working -

i'm 100% new socket.io , have installed it. trying follow examples, , can server side running can't seem client side connected. the following server.js: var http = require('http'), io = require('socket.io'), server = http.createserver(function(req, res){ res.writehead(200, {'content-type': 'text/html'}); res.end('<h1>hello world</h1>'); }); server.listen(8090); var socket = io.listen(server); socket.on('connection', function(client){ console.log('client connected.'); client.on('message', function(){ console.log('message.'); client.send('lorem ipsum dolor sit amet'); }); client.on('disconnect', function(){ console.log('disconnected.'); }); }); this index.html <!doctype html> <html lang="en"> <head> <title>socket example</title> <base href="/&q

c - Click through transparent window in Xlib -

i able draw anywhere on screen, think should create transparent, fullscreen, undecorated window. the problem is, events pass through window. i'd catch mouse-move event , use it. any ideas? might able in higher-level library? simply take screen capture , make full screen window filled pixels. won't live update able process mouse , keyboard events like.

iphone - Help with UIPopOverController size -

Image
so have view bunch of button in uiscrollview . when user presses button, want uipopovercontroller display pointing @ selected button. kind of works, popover wrong size , points random point in view. here code. in advance. -(void)detail:(id)sender{ uibutton *button = sender; nslog(@"tag = %i", button.tag); uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller]; if (ui_user_interface_idiom() == uiuserinterfaceidiompad) { self.popover = [[uipopovercontroller alloc] initwithcontentviewcontroller:navcontroller]; self.popover.delegate = self; [self.popover presentpopoverfromrect:button.bounds inview:self.view permittedarrowdirections:uipopoverarrowdirectionany animated:yes]; } than problem size of popover: in view inside popover, have: self.contentsizeforviewinpopover = scroll.contentsize; nslog(@"%f, %f", scroll.contentsize.height, scroll.contentsize.width); nslog(@&qu

Does the Prado PHP Framework support MongoDB? -

the prado php framework looks interesting, before dive in, wondering if mongodb can used database prado without issues? prado based on apache tapestry, java framework. tapestry not have mongodb library (unless added) being php, prado can work mongodb, 1 must php configuration since mongo php driver third-party library , there no specific prado library mongodb. first, configure mongodb, install mongodb php driver, create prado class interact (the same apache tapestry). amount of issues encountered in regards class create , how bridges prado mongodb. standard php code looks this: <?php try { // open connection mongodb server $conn = new mongo('localhost'); // access database $db = $conn->test; // access collection $collection = $db->items; // execute query // retrieve documents $cursor = $collection->find(); // iterate through result set // print each document echo $cursor->count() . ' document(s) found. <br/&

nstimer - timer in iOS not working -

i have code repeated timer in app: (inside viewdidappear) nsdate *date = [nsdate datewithtimeintervalsincenow: 3]; nstimer *restrictiontimer = [[nstimer alloc] initwithfiredate: date interval: 3 target: self selector:@selector(changerestriction) userinfo:nil repeats:yes]; and - (void) changerestriction { nslog(@"inside !!"); } however, dont see output, ? if you're using -initwithfiredate:.. have manually add timer nsrunloop. use +scheduledtimerwithtimeinterval:.. , automatically trigger.

Selenium: Stored variable is not considered across test cases while executing test suite from command prompt -

i have test suite 3 test cases, out of first test case has variables required in other 2 test cases(something dataset test suite) all while executing testsuites in selenium ide (manually loading test suite in ide , run), fine. but wanted report test case execution, using below command execute testsuite java -jar "selenium-server jar path" -htmlsuite "*firefox" "baseurl" "testsuite path" "results file path" now problem while executing test suite command propmt, variables stored in first testcase, not considered in 2nd test case , on. so can me solve issue. open archive: selenium-server.jar\core\scripts\ find selenium-testrunner.js find , remove next code file: storedvars = new object(); storedvars.nbsp = string.fromcharcode(160); storedvars.space = ' ';

c# - Why can't I preallocate a hashset<T> -

why can't preallocate hashset<t> ? there times when might adding lot of elements , want eliminate resizing. there's no technical reason why shouldn't possible - microsoft hasn't chosen expose constructor initial capacity. if can call constructor takes ienumerable<t> , use implementation of icollection<t> , believe use size of collection initial minimum capacity. implementation detail, mind you. capacity has large enough store distinct elements... edit: believe if capacity turns out way larger needs be, constructor trim excess when it's finished finding out how many distinct elements there really are. anyway, if have collection you're going add hashset<t> and implements icollection<t> , passing constructor instead of adding elements 1 one going win, :) edit: 1 workaround use dictionary<tkey, tvalue> instead of hashset<t> , , not use values. won't work in cases though, won't give same i

mysql - java load data infile query discarding wrong lines -

java application insert data mysql using load data infile query. in csv file, wrong formatted values lacking rows, improper fields (string value integer value). if there non-correct record(line) on file, java application throws exception , not add any records correct lines. if execute same query same file using heidi sql program (sql client program), add records, non-correct lines (put null value lacking fields etc). want java application behave sql client, put lines @ least insert correctly well-formed lines. thanks. sql load data infile '/a.txt' table test_data fields terminated ',' code snippet public void query(string query, connection conn) throws sqlexception { preparedstatement ps = null; try { ps = conn.preparestatement(query); ps.executeupdate(); } catch (mysqltransactionrollbackexception e) { logger.error("", e); throw new mysqltransactionrollbackexception();

sharepoint 2010 - Can't read file in ItemAdding event receiver -

i try read file in itemadding (sharepoint2010). use code: public override void itemadding(spitemeventproperties properties) { xmldocument doc = new xmldocument(); string file = path.combine(properties.weburl, properties.afterurl); doc.load(file); } but program return error in doc.load(file); - remote server returned error: (401) unauthorized. how solve problem? in user-context code running? have enough permissions file? you try using elevated privileges http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx

Set Background cell color in PHPExcel -

how set specific color active cell when creating xls document in phpexcel? $sheet->getstyle('a1')->applyfromarray( array( 'fill' => array( 'type' => phpexcel_style_fill::fill_solid, 'color' => array('rgb' => 'ff0000') ) ) ); source: http://bayu.freelancer.web.id/2010/07/16/phpexcel-advanced-read-write-excel-made-simple/

.htaccess redirect - should this work? -

i using rule: redirectmatch 301 /resources/(.*) /community//$1 to redirect these sorts of url's: http://www.domain.com/resources/view/123 to http://www.domain.com/community/view/123 and http://www.domain.com/resources/all/ to http://www.domain.com/community/all/ given rule above, should need do? yes, work fine (but still remove double slash // in target url part -- single slash enough). in case -- can make bit simpler (no need relatively expensive regex @ such simple redirect). simple redirect instead of redirectmatch same job: redirect 301 /resources/ /community/

r - convert factor to date with empty cells -

i have factor vector x looking this: "" "1992-02-13" "2011-03-10" "" "1998-11-30" can convert vector date vector (using as.date() )? trying obvious way gives me: > x <- as.date(x) error in chartodate(x) : character string not in standard unambiguous format at moment solve problem this: > levels(x)[1] <- na > x <- as.date(x) but doesn't elegant... thank in advance! you need tell as.date format expect in character vector: xd <- as.date(x, format="%y-%m-%d") xd [1] na "1992-02-13" "2011-03-10" na "1998-11-30" illustrate these indeed dates: xd[3] - xd[2] time difference of 6965 days ps. conversion using as.date works regardless of whether data character vector or factor.

camera - Filter / image texture Iphone -

good! need add image of iphone's camera filter / texture through uiimagepickercontroller, not know how directly access camera image, since access eye. the filter may black / white, sepia or else. thank much! regards finally fixed problem adding mask image, not necessary apply filter lol. thanks

PayPal API to pay via credit card -

i need allow users pay via credit card on site. i'm trying find suitable api option can't find it. have implemented payment via paypal far, need allow users pay via credit card without account on paypal. anyone knows specific payment type is? here 1 way: first, you'll need website payments pro merchant account paypal. then, become familiar dodirectpayment api , allow process transactions on site paypal working in background. customers able fill out credit card information, etc., on site without visiting paypal directly. this means customers not required have paypal account in order make transaction on site. if proceed way, need ssl certificates, , required implement express checkout customers not want make transaction on site. sample code feet wet. luck!

create profile URL like in Facebook OR Subdomain -

is subdomain in facebook profile or url shows specific profile based on name followed after e.g. www.facebook.com/profile-name if profile url want in website each user able have own profile url facebook. i want php script when user registers site should created then. thanks. the way sort of thing using apache mod_rewrite way make rules how apache translates incomming requests , php file respond. apache mod_rewrite

java - Create table with native SQL works for Hibernate/HSQLDB, insert fails. Why? -

i use hsqldb , hibernate. have implement functionality on database level (trigger ...) , because of have execute native sql. create new table (works) , try insert data (fails). sa such there should no access right violation. can guess why user lacks privilege or object not found: a492interface thrown? this code (simplified): session.createsqlquery("create table entity_table_map (entity_name varchar(50) not null primary key,table_name varchar(50) not null)").executeupdate(); session.createsqlquery("insert entity_table_map (entity_name,table_name) values (\"a429interface\",\"interface\")").executeupdate(); here relevant log: [server@19616c7]: 0:sqlcli:sqlprepare create table entity_table_map (entity_name varchar(50) not null primary key,table_name varchar(50) not null) [server@19616c7]: 0:sqlcli:sqlexecute:5 [server@19616c7]: 0:sqlcli:sqlfreestmt:5 [server@19616c7]: 0:hsqlcli:getsessionattr [server@19616c7]: 0:sqlcli:sqlprepare insert

winapi - Controlling the aspect ratio in DirectShow (full screen mode) -

i'm using directshow simple approach (igraphbuilder renderfile) , try control else querying supplemental interfaces. the option in question aspect ratio. thought maintained default, same program behaves differently on different machines (maybe versions of directx). not huge problem video in window, because can maintain aspect ratio of window myself (based on video size), full-screen mode can not understand how can control. i found there @ least 2 complex options: vmr video , adding overlay mixer, there known way doing igraphbuilder' renderfile video? when igraphbuilder::renderfile, internally adds video renderer filter graph. typically vmr-7 video renderer filter : in windows xp , later, video mixing renderer 7 (vmr-7) default video renderer. called vmr-7 because internally uses directdraw 7. at point can enumerate graph's filters, locate vmr-7 , use interfaces such ivmraspectratiocontrol specify mode of interest.

windows phone 7 - How to create a buffer and determine what is inside the buffer of a mapPolyLine? c# -

i'm trying create buffer around mappolyline determine if there's inside mappolyline. below code mappolyline: private void routeservice_calculateroutecompleted(object sender, calculateroutecompletedeventargs e) { // if route calculate success , contains route, draw route on map. if ((e.result.responsesummary.statuscode == bingmaprouteservice.responsestatuscode.success) & (e.result.result.legs.count != 0)) { // set properties of route line want draw. system.windows.media.color routecolor = colors.blue; solidcolorbrush routebrush = new solidcolorbrush(routecolor); //mappolyline routeline = new mappolyline(); app.routeline.locations = new locationcollection(); app.routeline.stroke = routebrush; app.routeline.opacity = 0.65; app.routeline.strokethickness = 5.0; // retrieve route points de

Indexed search displays html and js-code typo3 -

i've upgraded 4.2 4.5 in single upgrades (4.2->4.3 etc.). after final upgrade, indexed search displays html , js code of content blocks in search results. not though. can't find pattern that. moved html block bottom, in case displays top block, emptied tables start index_ make sure renders index new, emptied browser's cache, still displays html , js code. i compared node, displayed correctly result, html block top most, code same, 2 pictures added image slider, access , appearance have same settings. any idea what's causing behavior? experienced same thing? thanks answer , sorry trouble.. (just make complete, yes, html valid.) i did not quite found out why search-thing occurs, managed find workaround extracting js in seperate .js-file, , call within script-tags. expected don't display teaser @ all, displayed real content instead. no idea why happened, can suppress that. maybe else too..

Jersey Client API - authentication -

i'm using jersey client api submit soap requests jax-ws webservice. default jersey somehow using windows nt credentials authentication when challenged. can explain jersey in code? , can overriden? i have tried using httpbasicauthfilter , adding filter on client. have tried adding credentials webresoruce queryparams field neither being picked up. at first got working documented in jersey user guide authenticator.setdefault (authinstance); however did not relied on setting global authenticator. after research discovered jersey has httpbasicauthfilter easier use. client c = client.create(); c.addfilter(new httpbasicauthfilter(user, password)); see: https://jersey.github.io/nonav/apidocs/1.10/jersey/com/sun/jersey/api/client/filter/httpbasicauthfilter.html https://jersey.github.io/nonav/apidocs/1.10/jersey/com/sun/jersey/api/client/filter/filterable.html#addfilter(com.sun.jersey.api.client.filter.clientfilter)

asp.net - Dynamic Table to Edit SQL Database Data (Editable Table) -

just after bit of advice. i have table generated using sql database , put asp:repeater display data. the table displays fine, relevant data. happy! but information in table may need changed user. rather having separate page or separate section user can submit edits, came idea make each cell in table text box. , on page the, text of each text box set database values. so table display , same, except each cell editable. i'm having trouble getting work. ive got far is: <asp:repeater id="rptpending" runat="server"> <headertemplate> <table id="tblpending" cellpadding="0" cellspacing="0" border="0" class="display"> <thead> <tr> <th>company name</th> <th>telephone</th> <th>fax number</th> <th>address line 1</th>

Change column for joined class mapping in Fluent NHibernate Automapping -

i have inheritance public abstract class userentity : entity { public virtual int id { get; protected set; } } public class employee : userentity { public virtual string email { get; set; } } entity standard nh class overridden methods equals, gethashcode, etc. , use autmap rewriting .includebase() i got fluent nhibernate automapping <class xmlns="urn:nhibernate-mapping-2.2" name="dto.entities.userentity" table="userentities"> <id name="id" type="system.int32"> <column name="id" /> <generator class="identity" /> </id> <joined-subclass name="dto.entities.employee" table="employees"> <key foreign-key="fk_employee_userentity"> <column name="userentityid" /> </key> <property name="email" type="system.string"> <column name=

How do I solve the "Cannot perform this operation on a closed dataset" with Borland Database Engine and a Delphi application? -

the application working perfectly, until edited user database (*.dbf) in openoffice.org calc. gives me above error closed dataset. as per own comment, unable open database file because corrupt. thus, error in case meant not forgot open it, app cannot open corrupt .dbf file. other not-so-obvious reasons why might error, obvious thing failed set table active property true, include system or bde configuration errors (odbc or ado, or other bde runtime files missing or not configured) required open file

Calling Gephi from Ruby on Rails -

i'm interested in building data visualisation component , can see how done prefer not reinvent exists. if 'first' i'm prepared put initial code on github others share [and improve !!] essentially i'd able following: 1) access table or tables within database , create nodes based on entries within them. add nodes on create, remove them on delete. 2) use foreign keys and/or join tables [for many-many links] create edges. add edge(s) when node created, remove edges when node deleted, check , add/remove edges when node updated. 3) pass nodes , edges gephi display i can see how steps 1 , 2 , -- haven't been able find (after searching) how step 3. has had success in doing this? -- example code they're willing share ? thanks we tried similar once, may not much. wrote rake task got data out our db, fed gephi manually. wasn't satisfactory , in end went rake task -> csv -> r script visualization (basically connections of users on w

xcode4 - Xcode 4 Ad-Hoc Distribution - Unable to Download -

i had upgrade our development machine xcode4 , after initial interface change has gone quite smoothly. i'm in process of using ad-hoc distribution on first time followed guide set profiles/schemes etc. http://diaryofacodemonkey.ruprect.com/2011/03/18/ad-hoc-app-distribution-with-xcode-4/ this process took: 1/ setup new provisioning profile under distribution. selected ad-hoc, correct app , uuids. 2/ installed profile within xcode 4. 3/ in xcode duplicated release configuration , named ad-hoc. 4/ under code-signing made sure ad-hoc had new profile selected. 5/ edit archive scheme , selected 'ad-hoc' build configuration. 6/ select product > archive , made sure profile listed correct. 7/ on save screen selected 'enterprise distribution' , entered app url , title. 8/ copied resulting ipa archive, plist , mobileprovision (downloaded in point 1) our http server. 9/ added required html , pointed mobile safari it. 10/ selected mobileprovision

java - Generating WSDL using Websphere 6.1 not generating sequence arguments correctly -

i trying generate wsdl file endpoint class using websphere 6.1 java2wsdl ant task the endpoint coded as class mysvcendpoint implements mysvc_sei { public someothercomplextype[] mycall(string[] argstrings) throws javax.xml.soap.soapexception { . . } } interface is: public interface mysvc_sei extends java.rmi.remote { public someothercomplextype[] mycall(string[] argstrings) throws javax.xml.soap.soapexception; } the wsdl generated contains following entries: <element name="mycall"> <complextype> <sequence/> </complextype> </element> <element name="mycallresponse"> <complextype> <sequence/> </complextype> </element> as can see, 'argstrings' argument has disappeared, though seems recognize something should there. also, return type seems have disappeared too. anyway, when generate stubs based on wsdl, interface gene

iphone - CrossPaltform Mobile Application -

i want following: 1- mobile friendly portal - accessed through different mobile phones. 2- mobile applications same functionality of portal different platforms: ios(iphone,ipad), blackberryos(blackberry mobiles , playbooks),android os (android mobiles , tabs), windowsos, symbian os (smartphones). i web developer , ios programmer using objective-c, , have resources can develop on android, blackberry , other platforms using native languages. the application present data internal database , deals different types of web services, , write data file system of device itself. what best practice mobile applications, each 1 alone native language, or using html,css,js , produce them platforms using phonegap or else??? thanks lot. you should refer this...

mysql - how do I trim an email input address so only the data before the @ is inputted into the database? -

i using coldfusion 9 add data mysql database form. i create username email address inputed form. for example, <cfset store_user_email = emailaddress> <cfset store_username = trim emailaddress before @> i'm not sure how trim down email address? any appreciated. <cfset store_username = trim(listfirst(emailaddress,"@"))>

Get intent of uninstall app in android -

i want know intent of uninstall app because of in app when user opens first screen device id saved in server side using php. when user uninstall app automatically device deleted in server side. for prepared code php delete device id. when call webservive. i tried below code public class myreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { string action = intent.getaction(); if("android.intent.action.package_removed".equals(action)){ // here wrote code of delete device id in server side } but not working because intent not raised. please tell me intent raise when user uninstall app or tell me suggestions solve problem. thanks in advance. regards you cannot uninstall intent own app. see thread more - get application uninstall event in android

flash - Programatically draw a (drop)shadow -

this goes programming languages. i use adobe flash as3 , reason boyond post, cannot use built-in dropshadow filters. i do, however, have bitmap data available, color , alpha values. so there should way draw own dropshadow filter.... right? existing algorithms should go , check out? not looking as3 implementation, other example allow me convert code. usually, dropshadows done so: copy bitmap's alpha channel blur copied alpha channel (a gaussian blur should fine) move copied alpha channel down , right use copied alpha channel darken background (that is, multiply background's rgb values inverse value alpha channel; same combining alpha channel all-black bitmap , alpha-blending on background) draw original bitmap (also using alpha-blending)

objective c - UIWebView isn't displayed until moved by touches -

i have 3 webviews in uiview , 1 showed. when loading urls not-displayed webviews, , move them frame center show white box - white screen, if keep saying finished loading. so... there possibiliy force them redraw after loading? when scroll them in random direction webviews encouraged show content... other ideas fix bug? code: - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { return yes; } - (void)webviewdidfinishload:(uiwebview *)webview { boolean end = true; (int = 0 ; < 3 ; ++) { if ( mainwebviews[i].isloading ) { end = false; } } if (end) { //nslog(@"nothing loading?"); [loader stopanimating]; loader.hidden = yes; } webview.hidden = no; // how redraw here? } - (void)webviewdidstartload:(uiwebview *)webview { //nslog(@"start loading"); webview.h

c# - Is it possible to call Dynamics CRM 2011 late-bound WCF Organization service without the SDK - straight customized binding? -

i'm trying implement pure wcf scenario want call dynamics crm wcf service without relying on sdk helper classes. basically, implement federated authentication against dynamics crm 2011 using native wcf support .net framework. the reason i'm doing port scenario later-on biztalk. i've generated proxy classes svcutil, part of policies , security assertions not compatible configuration schema. svcutil suggests build binding code instead, i'm trying do. the resulting code here: private static void callwcf() { organizationserviceclient client = null; try { // login live.com issuer binding var wshttpbinding = new wshttpbinding(); wshttpbinding.security = new wshttpsecurity(); wshttpbinding.security.mode = securitymode.transport; // endpoint binding elements var securityelement = new transportsecuritybindingelement(); securityelement.defaulta

Non-recursive way to get all files in a directory and its subdirectories in Java -

i trying list of files in directory , subdirectories. current recursive approach follows: private void printfiles(file dir) { (file child : dir.listfiles()) { if (child.isdirectory()) { printfiles(child); } else if (child.isfile()) { system.out.println(child.getpath()); } } } printfiles(new file("somedir/somedir2")); however, hoping there non-recursive way (an existing api call, maybe) of doing this. if not, cleanest way of doing this? you can replace recursive solution iterative 1 using stack (for dfs) or queue (for bfs): private void printfiles(file dir) { stack<file> stack = new stack<file>(); stack.push(dir); while(!stack.isempty()) { file child = stack.pop(); if (child.isdirectory()) { for(file f : child.listfiles()) stack.push(f); } else if (child.isfile()) { system.out.println(child.getpath()); } } } printfiles(new file("somedir/somedir2"));

swing - java - deactivate a listener -

i have general question regarding listeners. lets have 2 jtabbedpane s , both have changelistener . both displayed , want them both show same pane (index) when user changes selected pane in 1 other changes too. in brief, 1 jtabbedpane listener changes other jtabbedpane using setselectedtab() . obviously, first listener activate second listener , second reactivate first in endless operation. this solved booleans. there smarter way it? there way change tab without triggering listener? there way activate listener when user changes , not code? thank you. btw: have same questions buttons. buttons take code listener , put in method. when 1 button needs activate button calls code. in jtabbedpane different. the simple solution act when necessary. example: if(currenttab != desiredtab) { // change tab } that prevent infinite loop. if need able switch behavior on , off, using boolean flag isn't bad way go it. alternative remove listener, using removech

c# - Error in loading assembly -

i new silverlight development , struck on following problem. i trying add silverlight 3.0 toolkit in visual studio 2008 on windows 7 machine .while browsing add required dll throws error - error in loading type assembly.could not load file or assembly system.windows check following: 1) visual studio running in administrator mode. 2) installation of toolkit not corrupt. repair if necessary. hope helps!

nhibernate inheritance mapping issue -

i changed relationship between party & partyname uni-directional, , tests pass now. but have question final test output: when test saves student, inserts party, inserts cascading relationship partyname. great. at end when fetches student, final select. but right before final select , right after initial insert partyname update: nhibernate: update partynames set therequiredname = @p0, everythingelse = @p1, contextused = @p2, salutation = @p3, effectivestart = @p4, effectiveend = @p5 partynameid = @p6;@p0 = 'hesh' [type: string (0)], @p1 = 'berryl;;;' [type: string (0)], @p2 = 'student' [type: string (0)], @p3 = null [type: string (0)], @p4 = null [type: datetime (0)], @p5 = null [type: datetime (0)], @p6 = 65536 [type: int32 (0)] i don't follow why doing that. triggering update? cheers, berryl mapping <class name="party" table="parties"> <id name="id"> <column name="partyid&quo

fluent nhibernate - FluentNHibernate: Nested component mapping results in NHiberate QueryException -

hi have problem mapping in nhibernate. when run linq query referring 1 of component classes of entity, queryexception below: could not resolve property: closedcases of: project.entities.headline i have 1 table records want map multiple objects of headline entity. question: is there wrongly set in mapping? my headline entity separated multiple logical classes can see below public class headline:entity { public virtual datetime date { get; set; } public virtual teamtarget teamtarget { get; set; } } public class teamtarget : entity { public virtual datetime fromdate { get; set; } public virtual datetime todate { get; set; } public virtual targetitem achievedtarget { get; set; } public virtual team team { get; set; } } public class targetitem : entity { public virtual decimal closedcases { get; set; } public virtual decimal invoicing { get; set; } } mapping file: public class headlinemap: classmap<head

Get file name of a URL in PHP -

i want file name url. problem it's not ending extension. for example, http://something.com/1245/65/ . on clicking url, pdf file. how store file name of file in variable? <?php header('content-type: text/plain'); $curl = curl_init('http://localhost/fakefile.php'); curl_setopt($curl, curlopt_header, true); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_customrequest, 'head'); if (($response = curl_exec($curl)) !== false) { if (curl_getinfo($curl, curlinfo_http_code) == '200') { var_dump($response); $redispo = '/^content-disposition: .*?filename=(?<f>[^\s]+|\x22[^\x22]+\x22)\x3b?.*$/m'; if (preg_match($redispo, $response, $mdispo)) { $filename = trim($mdispo['f'],' ";'); echo "filename found: $filename"; } } } curl_close($curl); that parse content-disposition line filename=foo.b

iphone - UIPickerView in iOS, obtain text from row in different component -

i need obtain text specific row of picker !!the delegate didselect not work, because after reloading components variable getting information before data reloaded. need obtain data calling function. in advance !! - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component; { return [yourarray objectatindex:row]; } if want picker nsstring, check row selected, , string @ corresponding row-index in yourarray

Force new line when fwriting a CSV in PHP -

$out_text = "\r\n"; $out_text_body = implode("\r\n", $output_array); $out_text = $out_text . $out_text_body; fwrite($han, $out_text); code above adds bunch of csv lines stored in array file separated new line characters. file being written contains bunch of csv lines already. the problem that, despite pre-pending the text written "\r\n", in newly written csv, new block starts on same line old one. implodes variable works fine. stumped on this, been looking @ long cannot see problem simple. dan can start writing line: fwrite($han, php_eol); fwrite($han, $out_text); as asside, while technically not matter, more this: fwrite($han, php_eol); foreach( $out_array $out_text ) { fwrite($han, $out_text); } i reserve writing large blocks of text (which include newlines) file_put_contents . technically not matter, , above more php 4 compliant (though doubt care anymore), have more standard "feel" it.

c# - NetworkInformation.IPGlobalProperties vs. WMI for Ipaddresses, dns-servers, dhcp etc -

should prefer 1 on other? im leaning heavily towards networkinformation.ipglobalproperties instead of select * win32_networkadapterconfiguration wmi if can verify information need available use networkinformation if can , if can provide want. wmi more generic interface implements sorts of things, , service can stopped or might not available or corrupted (it has happened me few times). networkinformation believe wrapper around win32 apis should work , have no dependencies (besides .net 3.0+). always better use simplest , more specific tool gets job done.

Returning an dictionary object from a function in VBA -

i have following declaration in function in vba: set dict = createobject("scripting.dictionary") when try return dict using code getdates = dict error. can please? thanks! set getdates = dict you have use set.

xml - Omitting a number in XSLT -

part of xml have file is: <global> <globalparam name="rollname" value="scene" 10:00:00:00" /> <globalparam name="tapeorg" value="10:00:00:00" /> <globalparam name="readstart" value="00:00:00:00" /> <globalparam name="readduration" value="00:02:05:09" /> </global> currently xsl doesn't handle in field , follows: <xsl:template match="globalparam"> <globalparam> <xsl:attribute name="name"> <xsl:value-of select="@name" /> </xsl:attribute> <xsl:attribute name="value"> <xsl:value-of select="@value" /> </xsl:attribute> </globalparam> </xsl:template> this fine but, sofware outputs if reprocesses file it(as can see above adds 10:00:00:00 file name , xml file , need remove both can handl

How do I close a jquery contextMenu? -

i'm using a jquery contextmenu plug-in , have small issue i'm trying resolve. currently when click 'delete' menu item function call prompts user confirmation box deletetests function. @ point contextmenu still visible , confirmation box. ideally close contextmenu user selects menu item , proceed delete function. this seems should trivial can't seem working. $(document).ready(function(){ $.contextmenu({selector: '#context-menu', items: { "delete": {name: "delete", icon: "delete", callback: menu_click }, sep1: "---------", quit: {name: "quit", icon: "quit", callback: $.noop} }}); function menu_click(key, opt) { if (key == "delete") { // need close menu here deletetests(); } } }); you're right. should trivial, author did not provide functionality. you can @ source , copy whatever author did when clicks outside of menu detected,

iphone - My Picker shows question marks, but still sends the proper info to my Label -

i made simple picker displays information chose in label on same page. picker showing ? ? ?, when scroll on ? shows correct things chosen in label. how show words in pickerwheel itself? without seeing code, difficult track down. how setting information in label , picker? if have array of strings displayed in picker, easy: in .h file, use: @interface viewcontroller : uiviewcontroller <uipickerviewdatasource, uipickerviewdelegate>{ nsarray * arrayofstring; uilabel * thelabel; uipicker * thepicker; } in .m file, use: #pragma mark - #pragma mark view - (void)viewdidload;{ [super viewdidload]; arrayofstrings = [[nsarray alloc] initwithobjects:@"1", @"2", @"etc", nil]; } #pragma mark - #pragma mark picker delegate methods - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)thepickerview; { return [arrayofstrings count]; } - (nsinteger)pickerview:(uipickerview *)thepickerview numberofrowsincomponent:(nsinteg

easy_install virtualenv on python 2.4 -

i'm trying install latest version of virtualenv using easy_install on rhel5.6 python 2.4 , i'm receiving following error. file "/usr/lib/python2.4/site-packages/virtualenv-1.6.3-py2.4.egg/virtualenv.py", line 500 finally: ^ syntaxerror: invalid syntax i've checked virtualenv code https://github.com/pypa/virtualenv/blob/develop/virtualenv.py#l500 , seems syntax correct 2.4. any ideas? changed in version 2.5: in previous versions of python, try...except...finally did not work. try...except had nested in try...finally. looks latest virtualenv not compatible python <2.5

.net - How do I reference the WPF Toolkit in Visual Studio 2010? -

i'm trying use wpf toolkit visual 2010 project (i'm interested in chart controls found in system.windows.controls.datavisualization namespace), cannot figure out assembly reference. i've installed toolkit , seems have installed c:\program files (x86)\wpf toolkit\v3.5.50211.1 . i've read posts how might need copy assemblies gac attempted , following code: import clr clr.addreference("wpftoolkit") still fails. has used wpf toolkit lately vs2010? how did add reference it? import sys, clr sys.path.append(r'c:\program files (x86)\wpf toolkit\v3.5.50211.1') clr.addreference("wpftoolkit") you may need running .net 2 version of ironpython 2.6, since wpftoolkit site doesn't if it's compatible .net 4.

javascript - Default path problem in backbone.js -

i'm trying create first bb app. it's going ok have problem. router looks this: var playersapprouter = backbone.router.extend({ routes: { '': 'index', }, initialize: function () { this.model = new playersappmodel({}); this.view = new playersappview({model: this.model}); }, index: function () { alert('it works'); //<-- doesn't }, }); and later in code have: $(function () { window.app = new playersapprouter; backbone.history.start({pushstate: true}); app.model.players.reset(<?php require('players.php'); ?>); //<-- players.php loads bunch of json data. }); now, why doesn't index action of router fire? doing wrong? there other problems code? the full app can found here: http://development.zeta-two.com/development/f14/ get rid of pushstate:true @ works http://fiddle.jshell.net/r5tek/9/show/ there maybe bug pushsate. see her

objective c - how moom for osx works? -

i'm trying figure out how moom can modify window of other applications. mean, can change dimensions of other nswindow object can't understand window list , how can access frames. is there way access other apps execution like: nsarray *windows = [nssystem allapplication]windowlist]; you can find free version of moom here http://manytricks.com/moom/ most tools work through accessibility api . exposed in applescript "system events" application, you'll better results using directly. note user have "enable access assistive devices" (in universal access prefpane) allow application this.