Posts

Showing posts from June, 2013

sony camera api controlling multiple cameras -

can use sony camera api set off 5 or 6 (or more) action cams @ same time or in sequence? grab image each one? i know action cam remote can control 5 devices - may using non public apis. i've scanned doc's , not sure if can connect many cameras @ once / sync them taking photos @ same time. unfortunately can connect 1 action cam @ time since requires direct wifi connection between phone/tablet , action cam , phone cannot support more 1 wifi connection @ once.

excel - EPPlus multiple tabs c# -

i'm using epplus export excel. have done functions "excelworksheet". join of them in 1 excel(one per tab) using don't know how can it. here main function: public actionresult exportreports(string sheetname) { try { var req = getrequest(); var filedownloadname = "onlinereport.xlsx"; var contenttype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; var package = new excelpackage(); var ws1 = analysisbyaircarrier(package, req); var ws2 = summary(package, req); var filestream = new memorystream(); package.saveas(filestream); filestream.position = 0; var fsr = new filestreamresult(filestream, contenttype); fsr.filedownloadname = filedownloadname; return fsr; } catch (exception ex) { _logger.error("error exportreports", ex); } } i join ws1 , ws2 in same file in different tabs. note:...

Python Can't Find Modules -

i'm running python script resizes , converts images jpg , rgb. script worked until upgraded computers hd , moved on time machine backup. when try run script can't find modules. image module (i use pillow). traceback (most recent call last): file "processimgs.py", line 1, in <module> import os, sys, argparse, shutil, imgfunctions file "/web/script/python/img_processing/imgfunctions.py", line 1, in <module> import os, sys, image, shutil, re importerror: no module named image i using homebrew manage modules, , "brew list" outputs following: freetype graphicsmagick libpng libtool little-cms2 openssl pkg-config readline webp gdbm jpeg libtiff little-cms openjpeg pillow python sqlite if run "pip list" get: pillow (2.3.0) pip (1.5.4) setuptools (2.2) wsgiref (0.1.2) if run "help(modules)" in python, image module isn't listed. co...

android - How to hide an Ad? -

hello use code below show ad in game , works fine, created banner ( setcontentview() ) in gameactivity.java . , have gamescene.java . wanna hide banner sometimes. how can reach "adview" variable (which in gameactivity.java) gamescene.java? i have 1 activity gameactivity.java , others scenes (gamescene, menuscene...). want show banner in menu scene,but want hide in game scene. @override @suppresslint("newapi") protected void onsetcontentview() { super.onsetcontentview(); final framelayout framelayout = new framelayout(this); final framelayout.layoutparams framelayoutlayoutparams = new framelayout.layoutparams( framelayout.layoutparams.match_parent, framelayout.layoutparams.match_parent, gravity.fill); final framelayout.layoutparams adviewlayoutparams = new framelayout.layoutparams(framelayout.layoutparams.wrap_content, framelayout.layoutparam...

java - Why we can't extends more than one class -

this question has answer here: multiple inheritance in java 8 answers java inheritance 6 answers well, developing application uses jframe , applet. why can't extend both.. public class myclass extends applet, javax.swing.jframe {...} //invalid... the valid code is. public class myclass extends applet { javax.swing.jframe frame = new javax.swing.jframe(); public void init(){ frame.setsize(300, 400); frame.setvisible(true); } } why so? why can't extends more 1 class the designers of java learned mistakes made in other languages such c++ diamond problem issue caused multiple inheritance decided make java single inheritance language simplify development.

Serializing data to JSON in python -

can give me guidelines how serialize data file similar presented below? { "minshift": -0.5, "maxshift": 0.5, "stepshift": 0.002, "feeds": { "cfh": "cfh_20140318t0900.txt", "lmax": "lmax_20140318t0900.txt", "saxo": "saxo_20140318t0900.txt" }, "instruments": [ { "instrument_old": "cfh/eurusd", "instrument_new": "lmax/eurusd" }, { "instrument_old": "cfh/eurusd", "instrument_new": "saxo/eurusd" }, { "instrument_old": "lmax/xauusd", "instrument_new": "saxo/xauusd" } ] } i have: shiftdata list 3 elements (for min, max , stepshift) dictionary key:value => {provider_name : filename} list of 2 element lists [instrument_new, instrument_old] nam...

java - Android BroadcastReceiver onReceive Update TextView in MainActivity -

in mainactivity have textview: textv1. have method in mainactivity updates textview: public void updatethetextview(final string t) { mainactivity.this.runonuithread(new runnable() { public void run() { textview textv1 = (textview) findviewbyid(r.id.textv1); textv1.settext(t); } }); } in broadcasrreceiver need update text in textv1 in mainactivity. public class notifalarm extends broadcastreceiver { @override public void onreceive(context context, intent intent) { // other things done here notification // need update textv1 in mainactivity here } } how can done? broadcastreceiver run service. code cannot change. can access , change textv1 in mainactivity onreceive()? i've tried many things fail. in mainactivity initialize variable of mainactivity class below. public class mainactivity extends activity { private static mainactivity ins; protected void oncreate(b...

Twitter Spring Integration - query as payload -

can use twitter spring integration gateway (or splitter) instead of polling consumer? idea use payload query can multiple twitter custom searches. payload come chain. one way use http outbound gateway, not go this, because have implement entire twitter api (authentication - twitter template, tweet duplication - metadata store). the proper spring integration endpoint <si-twitter:outbound-gateway/> request/response scenario; don't have that; feel free open new feature jira issue that. however, under covers, use twittertemplate ; can invoke directly; like... twittertemplate tt = new twittertemplate(consumerkey, consumersecret, accesstoken, accesstokensecret); searchparameters searchparameters = new searchparameters(query).count(20).sinceid(sinceid); searchresults results = tt.searchoperations().search(searchparameters);

html - How can I make fixed elements visible ONLY when their parent elements are visible? -

the site i'm working on has several div sections each width , height of viewport. stacked vertically, each relative positioning (see codepen ). inside each element fixed-position h1 . i'd fixed h1 in each element remain visible when respective parent visible. i've tried number of z-index experiments no success. ideas on try next? since fixed position element located in viewport , not dom. meaning need manipulate html tag making pretty impossible. two options though, first being change position absolute (with adjustments position being based off closet parent position of relative, absolute, fixed or dom root) , hide appropriate parent element. second option hide , show fixed element using favorite js library respond user interaction instead of wrapping it.

java - what event perform in termination action -

what event perform @ time of termination program in eclipse? means whenever directly close program whatever running in eclipse console pressing red button or close event perform ? if u know please share knowledge me exactly run when terminate program run eclipse depends on type of program being run, types of launch code ends in terminate method of org.eclipse.debug.core.model.runtimeprocess . runtimeprocess uses destroy method of java.lang.process kill program.

jquery - Create list / array of table values -

i have table 6 fixed columns looks below , variable content created dynamically. within each column value can appear once may not appear in columns. is there way can list / array values columns cat , volumes columns vol example variables below? my table: <table id="mytable"> <thead> <tr> <th class="myheader">cat 1</th> <th>vol 1</th> <th class="myheader">cat 2</th> <th>vol 2</th> <th class="myheader">cat 3</th> <th>vol 3</th> //... </tr> </thead> <tbody> <tr> <td>item1</td><td>8</td><td>item2</td><td>7</td><td>item3</td><td>9</td> </tr> <tr> <td>item3</td><td>5</t...

iphone - statusBar event to go top of viewController [iOS]. -

is there option of enable/disable when person touch clock of statusbar app go top of viewcontroller. i created app main viewcontroller doesn't work , others works well, didn't know if option or api? thanks in advance. if you're talking uiscrollview or uitableview . then need implement following method uiscrollviewdelegate or uitableviewdelegate . - (bool)scrollviewshouldscrolltotop:(uiscrollview *)scrollview { return yes; // scroll top when touching statusbar }

java - Why Byte can't hold a value that is within its range? -

you can't put large value in small cup. well, ok, can, you'll lose some. you'll get, say, spillage. compiler tries prevent if can tell code something's not going fit in container(variable) using. for example, int x= 24; byte b= x; // won't work!! now range of byte -128 127 . now, question why doesn't work? after all, value of x 24 , , 24 small enough fit byte (may novice level question, confused concept). you know byte b= x; equivalent byte b= 24; , , intelligent compiler can tell that, java specified in precise way ensure compilers same thing, , not allow compilers notice equivalence purposes of accepting or rejecting program. (they can use performing optimization afterward, though.) compiler supposed know expression x has static type int , can't guarantee byte b= x assigning value in range of byte . instead, have write byte b = (byte) x , explicitly converting ("casting") expression x type byte . (this general pri...

signals - gtk tree view. Handle both single and double click -

according gtk+3 reference site : the "row-activated" signal emitted when method gtk_tree_view_row_activated() called, when user double clicks treeview row "activate-on-single-click" property set false, or when user single clicks row when "activate-on-single-click" property set true. emitted when non-editable row selected , 1 of keys: space, shift+space, return or enter pressed. is there no way deal both single , double click? example, single click action, double click one. you can try use parent signals, in case gtkwidget's signal "button-press-event", event of gdk_button_press doing , gdk_2button_press doing other. little note: have grab gtktreeviewselection on row need.

Where did clojure.contrib.string/partition go? -

ok, mildly confused whole clojure.contrib reorganisation. i identified clojure-contrib.string/partition function need. last commit 4 years ago , apparently clojure.contrib moved individual repositories. supposedly clojure.contrib.string moved clojure.string , except partition function. want know if not overlooking obvious before copy old code project. yes indeed. looks dropped during migration clojure.string namespace. if you, copy clojure.contrib.string/partition codebase.

ios - Information on pushing to new DetailView -

this question has answer here: passing data between view controllers 35 answers does know of tutorials out there explains how push new details views. right have 2 tableviews, first tableview holds states , second tableview holds area names. second tableview want able press area , display information in detailview, i'm not sure how information detailview. roottableviewcontroller.h #import <uikit/uikit.h> @interface roottableviewcontroller : uitableviewcontroller @end roottableviewcontroller.m #import "roottableviewcontroller.h" #import "secondtableviewcontroller.h" @interface roottableviewcontroller () @end @implementation roottableviewcontroller { nsmutablearray *states; } - (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle:style]; if (self) { // custom initialization } return self; } - (void)view...

ruby on rails - testing with rspec codeschool level 5 challenge 4 -

here base question test: we've changed code below we're mocking zombiemailer.tweet method instead of entire method. there still more make example work. first, finish let(:mail) statement below creating stub deliver method returns true. update mock call tweet method returns mail stub created. unfortunately can not alter models, question, or mailer. models: # tweet.rb class tweet < activerecord::base belongs_to :zombie validates :message, presence: true attr_accessible :message after_create :email_tweeter def email_tweeter zombiemailer.tweet(zombie, self).deliver end private :email_tweeter end # zombie.rb class zombie < activerecord::base has_many :tweets validates :email, presence: true attr_accessible :email end mailer: class zombiemailer < actionmailer::base def tweet(zombie, tweet) mail(:from => 'admin@codeschool.com', :to => zombie.email, :subject => tweet.message) end end i kee...

c# - Linq To Entities Join Issues -

how make join linq entities? var resulta = client.getfirstlist().tolist(); var resultb = client.getsecondlist().tolist(); var d = (from b in resultb join in resulta on b.anicollection.select(x => x.typeid) equals a.typeid select b) you should able query following: from in context.customers join b in context.orders on a.customerid equals b.customerid join c in context.anicollection on b.typeid equals c.typeid select b

java - Selecting a window behind a JFrame -

alright, give bit of background, have jframe i've manipulated full screen transparent overlay when user types keystroke on keyboard. the goal want user select opened window (so web browser you're using now) further manipulate program. have overlay working global keystroke managed jintellitype , swing's nifty extended state method full screen...ness. the problem have nice-looking overlay appears way want, cannot select of windows because jframe on them. need screencloud has screenshot selection (look @ 0:19 on video), user needs click on window when overlay/message appears. i'm looking jna getting window sizes , other info later use in application. i'm open ideas on how go this. worst case scenario see on ctrl-alt-tab window switcher selecting window. note : if helps @ all, i'm using trayicon application centered around, calls , creates jframes , such. for future, if (which doubt anyone) runs problem, have jna grab rectangle each window ,...

java - UPSERT in PostgreSQL using jOOQ -

i trying perform upsert in postgresql using jooq library. for doing trying implement following sql statement in jooq: https://stackoverflow.com/a/6527838 my code looks far: public class upsertexecutor { private static final logger logger = loggerfactory.getlogger(upsertexecutor.class); private final jooqcontextprovider jooqprovider; @inject public upsertexecutor(jooqcontextprovider jooqprovider) { preconditions.checknotnull(jooqprovider); this.jooqprovider = jooqprovider; } @transactional public <t extends record> void executeupsert(table<t> table, condition condition, map<? extends field<?>, ?> recordvalues) { /* * of trying upsert on postgresql. see: * https://stackoverflow.com/a/6527838 */ selectconditionstep<record1<integer>> notexistsselect = jooqprovider.getdslcontext().selectone().from(table).where(condition); selectconditionstep<r...

Image manipulation for a social site in Java or Javascript -

i'm working on social website uses upload of images display picture , banner ( fb cover) using angularjs on frontend , play framework (java) on backend. however, not able find best way process uploaded image (cropping, resizing, etc). should on client side in javascript or upload server , in java ? , libs, should use. veeery wide question, can give tips, not answer... anyway last time completed similar task graphicsmagick + gm4java + jcrop quite nice, of course there still coding you, imho it's start.

c++ - Missed characters in cout_ing? -

i'm trying make code can convert image binary(o-1) , worked there many symbols (ascii characters) missed in result of code while when open image in hex editor find full image converted , find these characters converted , , when tried make counter beside every binary comes out , noticed counter stops before missed character , starts again after passing it. here code.. #include <string> #include <bitset> #include <iostream> #include<fstream> using namespace std; int main() { ifstream file("e:\\2.jpg"); string mystring; ofstream fout("e:\\mnmn.txt"); while(file>>mystring) { (size_t = 0; < mystring.size(); ++i) { fout <<i <<"-"<< bitset<8>(mystring.c_str()[i])<<endl; }} return 0; } the result comes out like: 0-11111111 1-11011000 2-11111111 3-11100000 4-00000000 5-00010000 0-01001010 \\passed 00001001 character , started counter beginig 1-00000000 etc... ...

r - Manipulating x axis in panel plot when a factor is used -

Image
the code i've used is: mcgc <- ggplot(sam, aes(x = person,y = m, colour = x)) + geom_point(size = 0.75) + scale_colour_gradient2(high="red", mid="green", limits=c(0,1), guide = "colourbar") + geom_hline(aes(yintercept = mad, linetype = "mad"), colour = "blue", size=0.75, show_guide = true) + geom_hline(aes(yintercept = mmad, linetype = "mmad"), colour = "black", size=0.75, show_guide = true) + facet_wrap(~ plan, scales = "free", ncol = 4) + scale_linetype_manual(name = "plan of health care", values = c("mad" = 1, "mmad" = 1),guide = "legend") for data: plan person x m mad mmad 1 1 95 0.323000 0.400303 0.12 1 2 275 0.341818 0.400303 0.12 1 3 2 0.618000 0.400303 0.12 1 4 75 0.320000 0.400303 0.12 1 5 13 0.399000 0.400303 0.12 1 6 20 0.400000 0.400303 0.1...

swing - GUI Bank Account Java -

i'm having problems deposit , withdraw buttons. don't when click on them. goal have user deposit , withdraw account. sorry i'm new gui thing. bankaccount file deposit , withdraw calculations public class bankaccount { private double balance; public bankaccount() { balance = 0; } public bankaccount(double initialbalance) { balance = initialbalance; } public void deposit(double amount) { double newbalance = balance + amount; balance = newbalance; } public void withdraw(double amount) { double newbalance = balance - amount; balance = newbalance; } public double getbalance() { return balance; } } i'm having trouble in file @ actionperformed method. import java.awt.borderlayout; import java.awt.flowlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jlabel; import ja...

Change WPF Textbox Foreground Color on Event -

i change foreground color of textbox based on incoming event (the incoming number differs 1 in textbox) change black if text changed through ui. have working in circuitous way, i'm not sure of correct way it. the xaml: <textbox style="{staticresource recparm}" foreground="{binding path=acquisitiontimechangedbyinstrument, converter={staticresource booleantobrush}}" name="acquisitiontxtbox" textchanged="onacquisitiontimechanged" > <textbox.text> <binding path="acquisitiontime" mode="twoway" stringformat="{}{0:f6}" updatesourcetrigger="propertychanged" > <binding.validationrules> <vm:acquisitiontimerule min="200e-6" max="40" /> </binding.validationrules> </binding> </textbox.text> </textbox> the code behind: private void onacquisitiontimechanged(object send...

java - List View not populating dynamic objects at the right position -

i have custom list view has dynamic parts , pre defined portions. when populate it. static portions appear @ correct position in list view dynamic portions override !st of list view leaving part of layout in rest of postions blank. why happening? this custom list view: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <linearlayout android:id="@+id/ll_list_items" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <textview android:id="@+id/txtvw_ch_item_label_name" android:layout_width="match_parent" android:layout_height="wrap_conten...

Call Detection for skype in android -

like telephony call detection using phonestatelistener , want detect call skype in android. there listener skype telephony call. please suggest way. thanks friend shazli, there reliable workaround solve issue. whenever skype call gets connected puts notification , on ending call removes notification. notificationlistenerservice can used detect skype notification. add below lines in manifest file. <service android:name=".skypenotificationlistenerservice" android:label="@string/app_name" android:permission="android.permission.bind_notification_listener_service"> <intent-filter> <action android:name="android.service.notification.notificationlistenerservice" /> </intent-filter> </service> create service listen notifications. public class skypenotificationlistenerservice extends notificationlistenerservice { private boolean mskypeconnected; private sta...

Equally distribute a list in python -

suppose have following list in python: a = ['a','b','c','d','e','f','g','h','i','j'] how distribute list this: ['a','f'] ['b','g'] ['c','h'] ['d','i'] ['e','j'] and how achieve if have list of unequal length , putting 'superfluous' items separate list? i want able distribute elements of original list n parts in indicated manner. so if n=3 be: ['a','d','g'] ['b','e','h'] ['c','f','i'] and 'superfluous' element in separate list ['j'] you can use zip list comprehension: def distribute(seq): n = len(seq)//2 #will work in both python 2 , 3 return [list(x) x in zip(seq[:n], seq[n:])] print distribute(['a','b','c','d','e','f','g','h',...

java - Store stream volume and restore it after service -

i have android app changes users ringer preference or notification volume when music playing. is there way can store current volume settings across streams , restore when service killed? i used getstreamvolume(); volume , stored value until service killed. after service killed used setstreamvolume(); return volume stored setting. android reference - getstreamvolume();

Updating single item in a basket with multiple items using php and My Sql -

i making shopping basket website , stuck on updating quantities, have database conected , basket being generated basket table, have loop displays products in users basket , produces form each product generating textbox user can enter quanitity , click submit. have seperate file called updatebasket excutes update statement using gameid in whereclause. having trouble sending gameid each product on updatebasket file when update button clicked. here code below. this cart.php file cart.php <?php require "dbconnect.php"; session_start(); $memberid = $_session['id']; $query = "select rectable.gameid, rectable.gameimg, rectable.gameprice, rectable.gamename rectable, basket rectable.gameid = basket.gameid , basket.id = '".$memberid."'"; $results = $connect->query($query); $numrow = $results->num_rows; $count = 0; while ($count < $numrow) { $row = $results -> fetch_assoc(); extract($row); echo"<div>"; echo...

vba - Calculating value of formula -

is there way read formula vba structure "y=3x^2-5*x+3" , have "y=" replaced blank ("") , x replaced actual value? you can use evaluate caculate string formula if had 3*x^2-5*x+3 (rather 3x^2-5*x+3 ) code retruns 53 dim strin string strin = "3*x^2-5*x+3" msgbox evaluate(replace(strin, "x", "5"))

c++ - cocos2d-x ver3 action blink in Sequence doesn't executes , single action does -

i have strange situation try run blink action part of sequence on sprites although method getnumberofrunningactions returns 1 sprite dosn't blink. where pmatchedsymbolarray array of reelsymbol sprite extendet class class reelsymbol :public sprite { public: create_func(reelsymbol); reelsymbol(); virtual bool init(); void setup(); static reelsymbol* createwithspriteframename(const std::string& spriteframename); private: int getintfromname(std::string key); settings* psettings; }; for(ssize_t a=0; a<pmatchedsymbolarray->count();a++) { auto actionblink = blink::create(2, 5); auto repeat = repeat::create(actionblink, 2); reelsymbol* symbol = ((reelsymbol*)pmatchedsymbolarray->getobjectatindex(a)); auto actionsequence = sequence::create( actionblink, delaytime:...

inject - Roboguice 2.0 (android): POJO injection error (always null) -

my base pojo class: public class basedao { public basedao() { } // ... } my extends pojo class: public class kelvindao extends basedao { public kelvindao () { super(); } // ... } i want use kelvindao in service that: public class hankelvinhandler extends httprequesthandler { @inject private kelvindao mkelvindao; public void treatget() { mkelvindao.blabla(); !!! mkelvindao null } it's simple doesn't work :( thank guys help! how creating hankelvinhandler? if you're doing within subclass of roboguice class, such roboactivity, should work. example: public class myactivity extends roboactivity { @inject private hankelvinhandler m_handler; [...] } otherwise (i.e., you're creating within pojo), you're in regular guice land, , believe need use injector instance of it. example: public class myclass { public void dosomething() { injector injector = guice.createinjecto...

How to use gdb python debugging extension inside virtualenv -

i'm running ubuntu, , installed python-dbg package. when trying use installed version directly works great: $ gdb python2.7-dbg gnu gdb (ubuntu/linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 ---x snipped x--- reading symbols /usr/bin/python2.7-dbg...done. (gdb) r starting program: /usr/bin/python2.7-dbg [thread debugging using libthread_db enabled] using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". python 2.7.3 (default, feb 27 2014, 19:39:25) [gcc 4.6.3] on linux2 type "help", "copyright", "credits" or "license" more information. >>> program received signal sigint, interrupt. 0x00007ffff6997743 in __select_nocancel () @ ../sysdeps/unix/syscall-template.s:82 82 ../sysdeps/unix/syscall-template.s: no such file or directory. (gdb) py-bt (<--- works, has nothing do) (gdb) so, i've been building virtualenv using package's binary python2.7-dbg (since libraries need recompiling), using...

MySQL & PHP Performance -

i have question regarding differences between mysql_query (which know being deprecated , obsolete) , mysqli , relative performance difference notice. so putting can - developed api scratch in php 5.4, using mysql v5.0.96, running on lamp server (centos, apache, mysql, php) quad core 3.0ghz, 16gb ram, 100mbps duplex con... standard server really. to make initial call api postman (great app if don't know - it's google chrome extension worth look) take average of 160ms, considering on other side of world, , have authentication checks, not fussed rest stunned me difference in performance between 2 sets of code below: the call + return of array of 55 results in indexed table using mysqli below: $mysqli = new \mysqli("127.0.0.1", "username", "password", "database", 3306); if ($mysqli->connect_errno) { echo "failed connect mysql: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;...

NHibernate Batching for Sybase -

when setting ado.batch_size property on nhibernate configuration ignored. if debug session shows batch size 1 though set 25. does nhibernate 3.3.3 support batching sybase anywhere? no batching supported sql server client , oracle client. sybase driver uses nonbatchingbatcher means no batching. extended driver use batching i've created batcher nhibernate http://pastebin.com/gbps6w4a sample configuration key line db.driver configuration.databaseintegration( db => { db.connectionstring = "some connection string" db.keywordsautoimport = hbm2ddlkeywords.none; db.driver<sybasesqlanywheredotnet4withbatcherdriver>(); db.dialect<sybasesqlanywhere12dialect>(); db.batchsize = 25; db.logsqlinconsole = showsqlinconsolewindow; db.logformattedsql = showsqlinconsolewindow; });

php - *nix: Performing nested -exec with find command -

i'm trying following thing: hunt down 777 directories, , within directories, hunt down php files contain string "mail(". goal make part of cron-job runs every night , finds of php files contain mail functions may have been inserted surreptitiously onto our server. so, i've written command: find -type d -perm 777 -exec find {} -name "*.php" \; -exec grep "mail(" {} \; which (is supposed to): 1: find folders 777 privileges 2: each such folder, find php files contained therein 3: each such file, perform grep find string "mail(" however, doesn't appear working. doing giving me list of php files in 777-privileged directories, it's not performing grep. i've looked @ postings this: find -exec multiple commands which lead me believe nesting of -exec possible. there obvious i'm missing? in advance time! you can't nest find -exec , can nest sh in turns calls find -exec . gnu find, have rewrite {} i...

php - PDO Exception for each statement VS. Once for transaction? -

i'm implement transactions in php scripts , i'm doing testing myself understand how work. have following code snippet: try{ $db->begintransaction(); $update = "update persons set first_name = 'adam' person_id = 4"; $stmt = $db->exec($update); $select = "select person_id, column_that_doesnt_exist persons"; try{ $stmt = $db->prepare($select); $stmt->execute(); $rows = $stmt->fetchall(pdo::fetch_assoc); echo json_encode('success'); } catch (pdoexception $e) { echo 'execute failure'; } echo ' code gets here'; $db->commit(); } catch(pdoexception $e){ $db->rollback(); echo json_encode('commit failure'); } which outputs: execute failure code gets here and person 4's first name updated adam. now i'm pretty sure it's getting committed because second query never failed, because never executed s...

javascript - Loading child routers from database durandal -

i trying create child routes in durandal 2 database starterkit without success. although succeeded in rendering static contents shown below: define(['plugins/router', 'knockout'], function (router, ko) { var childrouter = router.createchildrouter() .makerelative({ moduleid: 'sectiongroups', fromparent: true }).map([ { route: ['', 'child1'], moduleid: 'pages/child1', title: 'child1', nav: true }, { route: 'child2: moduleid: 'pages/child2', title: 'child2', nav: true }, { route: 'child3', moduleid: 'pages/child3', title: 'child3', nav: true } ]).buildnavigationmodel(); return { router: childrouter }; }); however i've been unable dynamically output the menus database. doing somethig wrong? please see code below define(['plugins/router', 'knockout','services/oasismanager', 'services/logger...

how to handle "files are identical only difference is the date" in git -

usecase: we service business, running third party software suite our work. develop our own additions , customizations software suite. these customizations interwoven file tree of third party software suite. our chosen workflow centralized repo on our lan server , local repos on different pcs , cnc machine. problem solve: our problem file dates in file tree depend on date , time of initial software installation on particular node, may further change, once (frequent) third party patches , updates installed via proprietary patching program. we push , pull nodes. accordingly, git finds lot of modified files, not modified other having different date stamp. have seen messages in git-gui , (can't remember) git-bash, pointed out situation (file content identical, difference date). q: practice handle case. ideally, want ignore "modified files" purely date stamp related. i have searched stack-overflow ideas, came across couple of posts relating ignoring lines of cod...

java - Android AssetServer extending NanoHTTPD -

i'm developing assetserver extending nanohttpd in order access javascript features not available file:// based pages. this code have far: class assetserver extends nanohttpd{ private activity activity; public assetserver(int port, activity activity) { super(port); this.activity = activity; } @override public response serve(ihttpsession session){ string mime = "text/plain"; inputstream = null; string path = "www" + session.geturi(); system.out.println("nanohttpd: serving " + path); string response = null; try{ = activity.getassets().open(path); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); response = new string(buffer); }catch(ioexception ioe){ system.err.println("nanohttpd: error: " + ioe); } ...