Posts

php - How can I merge Nodes & Webform Submissions into instances of one general Content Type in Drupal 6? -

i built site using drupal 6 allows users submit information site owner in 3 different ways. are: webform a : quick contact - collects name, email, phone , message. webform b : free pdf book email webform - collects info similar above, , sends user email pdf attachment book written site owner. node create : case evaluation - form node creation page using multi-step module, cck , lot of conditional fields. anonymous users can fill out form , node data emailed site owner based on rule created. all 3 of these forms work in terms of doing supposed site. webform submissions accessed webform node owner, , set table view manage node submissions. even though forms gathering different data, @ end of day, important data personal contact information (each 1 collects name, email and/or phone), , each form submission (from of forms) considered lead owner , followed on. i centralize these various form submissions (2 webforms + 1 node) 1 content type (leads) managed 1 page, rather t...

security - How to sanitize user created filenames for a networked application? -

i'm working on instant messaging app, users can receive files friends. the names of files received set sender of file, , multiple files can sent possibility of subdirectories. example, 2 files sent might "1" , "sub/2" such downloaded results should "downloads/1" , "downloads/sub/2". i'm worried security implications of this. right off top of head, 2 potentially dangerous filnames "../../../somethingnasty" or "~/somethingnasty" unix-like users. other potential issues cross mind filenames characters unsupported on target filesystem, seems harder , may better ignore? i'm considering stripping received filenames ".." , "~" type of blacklist approach individually think of problem cases hardly seems recipe security. what's recommended way sanitize filenames ensure nothing sinister happens? if makes difference, app running on c++ qt framework. it's wiser replace ".....

java - JNLP isn't cooperating JFileChooser Access Denied -

i feel dumb...... so writing java app, , if can me work you'll able see it. so jar file here: http://team2648.com/otis2/admin/omninode2.8.jar i able used java web-start application, following tutorial here: http://download.oracle.com/javase/tutorial/deployment/webstart/deploying.html so wrote following jnlp file directed: <?xml version="1.0" encoding="utf-8"?> <jnlp spec="1.0+" codebase="http://team2648.com/otis2/admin" href="test.jnlp"> <information> <title>omninode mapper</title> <vendor>techplex engineer</vendor> </information> <resources> <!-- application resources --> <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/> <jar href="omninode2.8.jar" main="true" /> </resources> <application-desc name="omninode mapper" main-class=...

geospatial - MongoDB Bound Queries: How do I convert mile to radian? -

i have collection of stores geospacial index on location propery. what trying given user's latitude, latitude , search radius (mi), want return list of stores within parameters. i saw following example on mongodb documentation ( http://www.mongodb.org/display/docs/geospatial+indexing ), looks distance in radians. center = [50, 50] radius = 10 db.places.find({"loc" : {"$within" : {"$center" : [center, radius]}}}) so, formula convert miles radians? solution awesome people @ mongodb-user helped me find answer. basically, looking way limit distance. per, updated documentation, there 3rd parameter $near query: can use $near maximum distance db.places.find( { loc : { $near : [50,50] , $maxdistance : 5 } } ).limit(20) the value $maxdistance in radians; so, had take distance in miles , divide 69. thank you! as docs say: all distances use radians. allows multiply radius of earth (about 6371 km or 3959 miles) distance in choice ...

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

i having super hard time compiling , using taglib 1.6.3 in qt project. i've tried can think of. taglib claims supported through cmake i'm not having luck. furthermore, i'm confused kinds of files need qt libs! i've built *.a files, *.lib, , *.dll. understand far... believe since i'm working in windows *.lib want. no matter do, end "undefined references" taglib functions try use when try compile qt project. have tried mingw32, msys, visual studio 2008, , cross-compiling windows on linux. turning nothing. what makes less sense me if compile same taglib source qt on mac (g++ think?) works fine! somewhere in windows compilation procedures have going wrong. have been smacking face on desk 30 (on , off) hours trying figure out. since qt uses mingw must compile taglib same compiler? if compile *.lib's visual studio not compatible? are *.a libraries usable in windows? (assuming mingw) i'm still trying handle on c++ stuff, after reading coun...

Using GO in SQL Server 2005 -

i working on sql server 2005 , have come accros issue have run multiple update query on single table 1 one. takes lots of time execute 1 one came know using "go" can run query 1 one. this update table .... go update table a go update table a i not sure can put seperate update statement , run query 1 one. doing on production need sure should work. can give me example can see using go, query runs 1 one , not parallel? from go (transact-sql) go not transact-sql statement; command recognized sqlcmd , osql utilities , sql server management studio code editor. sql server utilities interpret go signal should send current batch of transact-sql statements instance of sql server. current batch of statements composed of statements entered since last go, or since start of ad hoc session or script if first go.

c++ - cin skipping in while -

why cin being skipped in following while? int main() { int option; cin >> option; while(!cin.good()) { cout << "looping" << endl; cin >> option; } } errors in iostreams sticky. need clear error state before cin works again. int main() { int option; cin >> option; while(!cin.good()) { cout << "looping" << endl; cin.clear(); // ignore erroneous line of input: cin.ignore(numeric_limits<streamsize>::max(), '\n'); cin >> option; } }

android - GPS update interval is faster with good signal? -

i'm trying limit program take location updates every 10 seconds instead of constant updates in order reduce battery drain. works fine when i'm debugging indoors , signal weak (i.e. gps icon flashes), if phone gets proper fix (i.e. gps icon static) update interval increases second. i know code mlocationmanager.requestlocationupdates(locationmanager.gps_provider, updateinterval*1000, 0, this); not force gps take updates @ given interval, in opinion shouldn't depend on strength of signal , fluctuate much. any ideas? update: see comment i suspect gps radio works in manner either it's connected gps satellites or it's not. when it's connected, android sdk sends updates they're available gps hardware. when doesn't have full gps connection falls sending agps updates according you've requested. if want updates every 10 seconds, should save last received location 's time value in listener, , when receive new location check time aga...

On which pattern are ASP.NET webforms and MVC based? PageController, FrontController? -

i trying understand asp.net webforms , mvc point of view of understanding design patterns used. while mvc looks implementation of frontcontroller, not sure webforms pages. so, appreciate if can following questions around this. is webforms based on pagecontroller pattern? are front controller , page controller both modified versions of mvc? can webforms called special case of mvc distinction between controller , view blurred? finally, there resources on web can provide detailed reference on topic? following order of questions: 1//no. webforms based on the "smart ui" pattern, ie, control app writing event handlers. smart ui has issues, when entirely based on desktop works ok, in sense no major "fiction" introduced framework work. web, however, works on stateless http, major fiction introduced, in form of viewstate holds state of controls when page sent client browser. result, web forms introduce layer of complexity applications there sustai...

mysql - Two similar applications on different domains but same users -

i'm planning on building 2 applications using zend framework similar serve 2 different purposes can't part of same application or combined one. however, modules i'm considering. the issue i'm running if user registers first application want information available second application, hence sharing user table or user database. because applications similar have same database tables having different fields, i'm not sure if should have three, 2 or 1 databases. 3 databases user database, app1 database, app2 database. 2 databases user database , app1+2 database prefixed tables. 1 database user , app1+2 database. i'm trying give information possible, because client can't discuss details in depth. also, client wants , other not being able figure out how set up, i'm not sure best. my questions of options above, serve best, or other? should have shared user dataset across 2 applications or should users have register again? no matter of choice think be...

latex - How to extract the size of PDF? (Dimensions, not file size) -

i have many hundreds of small pdf images (created in adobe illustrator) inserted latex document. need know size of these images in real-world dimensions (e.g. 20mm x 14mm), or @ least latex can understand. is there command line tool can produce these dimensions? (i running mac os x.) a second best solution way latex extract dimensions. [i have tried pdftk, data dump command seems tell me number of pages (1).] use pdfinfo or pdfinfo.exe (from xpdf suite ): pdfinfo ^ -f 1 ^ -l 10 ^ -box ^ 20-pages.pdf this extract page sizes , box info (mediabox, cropbox, bleedbox, trimbox, artbox) pages 1 - 10 of pdf.

mfc - ON_EN_KILLFOCUS called multiple times -

i using cedit control. , have assigned event handler on_en_killfocus message. gets called correctly. problem that, when ever, close dialog box, event handler gets called 4 times. how can prevent this? why try prevent it? make sure handler ignores ones don't matter -

c++ - Linear congruential generator: How important is setting seed? -

i'm learning linear congruential generator in algorithms , data structures course. after thinking rng implementation we've been using (a=429493445, c=907633385, mod=4294967296, x _uint32), 1 thing came mind: program has function setting seed. how important function in c , c++? here's line of thought: once program starts, os assigns addresses used variables. data in memory location given seed can interpreted number. i understand in small computers may happen operating system (if there one) assigns several times same address seed wouldn't data contained in address different every time? unless system sets free ram value after every start, data contained in ram pretty random , provide enough seed. even if data contained in space given seed used program, don't see how make impact on generator itself. while unserious playing around rngs, seeding "junk in memory" work ok. bad way things: have no guarantee data in memory is random, though ca...

sql - how do i combine two selects from one table where one has a GROUP BY and the other has a DISTINCT -

both of these work individually select ponumber, count(requestnumber) "innumofrequests", sum(amount) "sumofamounts" tableview group ponumber select distinct ponumber, (10 * ceiling((datediff(day,poapproveddate,getdate()))/10)) "binofdayssincepoapproved" tableview and want end with: ponumber | innumofrequests | sumofamounts | binofdayssincepoapproved po1 | 2 | 100 | 180 po2 | 1 | 50 | 179 tableview looks like: requestnumber | ponumber | amount | poapproved date 1 | po1 | 100.00 | 2010-01-01 2 | po1 | 100.00 | 2010-01-01 3 | po2 | 50.00 | 2010-01-02 note po1 po 2 requests , poapproved data , amount same 2 requests. it seems easy book i'm using (the language of sql) can't figure out. :( alex ...

How to find out if the iPhone is on silent mode? -

i have mailing application. if user sends mail successfully, need notify mail sent successfully. that, need know if phone on silent mode (in case there 'vibrate') or regular mode (in case there 'beep'). can me it? thanks in advance cfstringref state; uint32 propertysize = sizeof(cfstringref); audiosessioninitialize(null, null, null, null); audiosessiongetproperty(kaudiosessionproperty_audioroute, &propertysize, &state); if(cfstringgetlength(state) == 0) { //silent } else { //not silent } if state string empty phone on silent - otherwise phone has audio output edit: remember add audiotoolbox framework , import. – thomas clayson answer taken (http://iphone-dev-tips.alterplay.com/2009/12/iphone-silent-mode-detection.html)

jquery - Need help to re-enable dragging of a draggable -

i have draggable element $(".element").draggable({ helper: "clone", revert: 'invalid', containment: '#parent', appendto: '#parent' }); i have 2 issues: after element dropped, original gets disabled automatically. a close anchor tag appended dropped element. on click of 'close' original element should again become draggable , should removed droppable 'div'. i have written handler close anchor follows, removes element droppable doesn't make draggable aggain. $('.cancel a',ui.helper).click(function() { $(ui.helper).remove(); $(ui.draggable).draggable('enable'); }); please help. in advance. the answer first issue set disabled option of draggable element false. $(".element").draggable({ helper: "clone", revert: 'invalid', disabled: false, containment: '#parent', appendto: '#parent' }); on handl...

.net - Class-level validation -

i validating class dataannotations utils. i have class has title property , item property. want apply requiredattribute title property should invalid if item property null; if item property set object, title not required. in short words, want requiredattribute validate if condition in class satisfied. how can done. update as didn't find other way, , since don't need functionality often, decided make rough way using class-level validator. question then, there way manually update ui make title textbox red frame, i.e. invalidate it? update 2 want class-level validator summarize on field. example, have fields cost , salesprice, wanna make sure salesprice > cost , invalidate salesprice otherwise, don't want global validation error on class level. i prefer xamly way. you may able creating custom validation attribute class. unfortunately dataannotation attributes assigned properties cannot access other properties of parent class far aware ...

PHP OpenID geting nickname & email -

for openid authentication i'm using "php openid library" ( http://www.janrain.com/openid-enabled ). how, of library, ask additional information (nickname, email)? i've got problems lightopenid, when ask email @ yandex lightopenid-> valid returns false( class ncw_openid extends lightopenid { const openid_mode_cancel = 'cancel'; public function __construct() { parent::__construct(); $this->required = array('nameperson/friendly', 'contact/email'); $this->optional = array('contact/email'); //$this->returnurl = 'http://' . site_uri . '/users/login'; } public function getattributes() { $attr = parent::getattributes(); $newattr = array(); foreach ($attr $key => $value) { if (isset(parent::$ax_to_sreg[$key])) $key = parent::$ax_to_sreg[$key]; $newattr[$key] = $value; } return $newattr; ...

c++ - how to convert a boost::weak_ptr to a boost::shared_ptr -

i have shared_ptr , weak_ptr typedef boost::weak_ptr<classname> classnameptr; typedef boost::shared_ptr<x> xptr; how convert weak_ptr shared_ptr shared_ptr = weak_ptr; xptr = classnameptr; ????? as said boost::shared_ptr<type> ptr = weak_ptr.lock(); if not want exception or use cast constructor boost::shared_ptr<type> ptr(weak_ptr); this throw if weak pointer deleted.

Could not initialize class java.awt.Rectangle -

client: [character: demian[268482346] - account: zayko - ip: 127.0.0.1] - failed running: [c] 03 enterworld - l2j server version: ${l2j.revision} - dp revision: ${l2jdp.revision} ; not initialize class java.awt.rectangle java.lang.noclassdeffounderror: not initialize class java.awt.rectangle @ java.awt.polygon.calculatebounds(unknown source) @ java.awt.polygon.getboundingbox(unknown source) @ java.awt.polygon.contains(unknown source) @ com.l2jserver.gameserver.instancemanager.dimensionalriftmanager$dimensionalriftroom.checkifinzone(dimensionalriftmanager.java:454) @ com.l2jserver.gameserver.instancemanager.dimensionalriftmanager.checkifinriftzone(dimensionalriftmanager.java:255) @ com.l2jserver.gameserver.network.clientpackets.enterworld.runimpl(enterworld.java:436) @ com.l2jserver.gameserver.network.clientpackets.l2gameclientpacket.run(l2gameclientpacket.java:62) @ com.l2jserver.gameserver.network.l2gameclient.run(l2gameclient.java:973) @ java.u...