Posts

Showing posts from July, 2012

javascript - Check if event.target has Children -

<h1>this puzzle</h1> <h3>by julian blaschke </h3> <h4 id ="result">its wrong<h4> <table>   <tr>     <th>puzzle</th>   </tr> <tr> <td><div id="dropdiv1" ondrop="drop(event)" ondragover="allowdrop(event)"></div></td> <td><div id="dropdiv2" ondrop="drop(event)" ondragover="allowdrop(event)"></div></td> <td><div id="dropdiv3" ondrop="drop(event)" ondragover="allowdrop(event)"></div></td> </tr> <tr> <td><div id="dropdiv4" ondrop="drop(event)" ondragover="allowdrop(event)"></div></td> <td><div id="dropdiv5" ondrop="drop(event)" ondragover="allowdrop(event)"></div></td> <td><div id="dropdiv6" ondrop...

SVG: Mask not working as expected -

i have rather basic svg vertical line going through 4 circles. mask have vertical line has same definition line itself, difference being stroke color (#fff in case) because want able see through mask. but, unknown reasons, mask still acts if color black, hiding element. if knows why it's behaving this, please let me know. <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 400 400"> <defs> <mask id="education"> <path class="through" fill="none" stroke="#fff" stroke-width="2" stroke-miterlimit="10" d="m200 325.6v42.5m200 325.6v44.2"/> </mask> </defs> <path class="arrow" fill="#c57773" d="m191.9 41.5l8.1-14 8.1 14"/> <path style="mask: url(#education);" class="through" fill="none" stroke="#58595b" str...

dictionary - segmentation fault in c program with a trie -

i'm getting seg fault spell check program. tried gnu , valgrind can't figure out going on. (node defined in .h file) program spell check cs50x worked on smaller dictionary seg faults while running well. here node: typedef struct node { bool is_word; struct node* letters[27]; } node; and here speller.c course - written course staff: #include <ctype.h> #include <stdio.h> #include <sys/resource.h> #include <sys/time.h> #include "dictionary.h" #undef calculate #undef getrusage // default dictionary #define dictionary "dictionaries/large" // prototype double calculate(const struct rusage* b, const struct rusage* a); int main(int argc, char* argv[]) { // check correct number of args if (argc != 2 && argc != 3) { printf("usage: speller [dictionary] text\n"); return 1; } // structs timing data struct rusage before, after; // benchmarks dou...

http - Parameters in Path Segments of URL -

there 1 interesting thing in url format: parameters in path segments of url. for more information see section "2.2.5" in " o'reilly - http - definitive guide ". or in official specification https://www.ietf.org/rfc/rfc2396.txt section 3.3. this book can found freely in internet. let's consider following url: http://www.example.com/first-segment/second-segment/index.html?type=helloworld here /first-segment/second-segment/index.html path part of url. and first-segment first segment of path second-segment second segment of path index.html third segment of path it stated in book each segment have individual parameters separated semicolon ";". in our example be: http://www.example.com/first-segment;f1=www/second-segment;s1=1;s2=2/index.html;i1=100;abc=200?type=helloworld here f1 - parameter first-segment s1 , s2 - parameters second-segment i1 , abc parameters index.html the question is: know practical exampl...

php - Telegram bot Send message -

i using irazasyed.github.io telegram sdk sending message here code when send message bot nothing happen , no reply receives problem ? my_bot_token replaced <?php require 'vendor/autoload.php'; use telegram\bot\api; $telegram = new api('my_bot_token'); $update = json_decode( file_get_contents( 'php://input' ) ); $chat_id = $update->getmessage()->getchat()->getid(); $response = $telegram->sendmessage([ 'chat_id' => $chat_id; 'text' => 'hello world' ]); $response->getmessageid(); ?>

I am writing a simple php code to check if number is odd or even -

i trying write simple php code see if number odd or keep getting error saying "expected statment" after closing bracket on if statement. can please explain need do? <?php function odd_or_even($num) { if ($num % 2 == 0); { print'number even'; } else { print 'odd'; } } posting community wiki. as stated in comments: if ($num % 2 == 0); ^ ends/terminates statement. as per manual states on line termination: as in c or perl, php requires instructions terminated semicolon @ end of each statement. closing tag of block of php code automatically implies semicolon; not need have semicolon terminating last line of php block. closing tag block include trailing newline if 1 present. reference: http://php.net/manual/en/language.basic-syntax.instruction-separation.php answer: remove it. taken comments: "the else unexpected because conditional becomes 1 liner nothing. e...

android - why i cant get anything back for bing API -

i cant thing bing img search api, here details of api https://dev.cognitive.microsoft.com/docs/services/56b43f0ccf5ff8098cef3808/operations/56b4433fcf5ff8098cef380c since httpclient deprecated use httpurlconnection, can tell me wrong code ? all params , key good, have tested on website. thanks! public void run() { httpurlconnection connection = null; try { url url = new url("https://api.cognitive.microsoft.com/bing/v5.0/images/search"); connection = (httpurlconnection) url.openconnection(); connection.setrequestmethod("post"); connection.setdoinput(true); connection.setdooutput(true); connection.setconnecttimeout(8000); connection.setreadtimeout(8000); connection.setusecaches(false); connection.setrequestproperty("ocp-apim-subscription-key", "562eaaada4b644f2bea31a454f2...

javascript - traval data to different controller in angularjs ionic -

i have array of structure this val[one][0]="dog", val[one][1]="cat", val[two][0]="john", val[two][1]="doe", val[two][2]="foo", val[three][0]="something" first need check if array 1 , 2 or 3 exist or not. , checking length of array. if there 1 available need start val[one][0].then value must passed next 4 views because working on ionic framework.and in fourth page there question "you completed operation on dog" , next question "do want take quiz on [cat](which val[one][1])".if yes button clicked, redirects first page , starts same process taking value cat. after finishig val[one] , have take val[two] , same process repetead value val[two] , val[three]. how can solve problem. can me please?

java - Response entity and response in client differ -

i've got spring rest web application. i've got method returns response entity. @requestmapping(value = "/shoes", method = requestmethod.get, produces = mediatype.application_json_value) public responseentity<?> getshoes() { collection<shoes> shoes = shoesservice.findall(); responseentity responseentity = new responseentity<>(shoes, httpstatus.ok); return responseentity; } when set breakpoint on last line, can see responseentity contains list of following objects: shoes{id=1, localization=localization{id=1, city='denver'}, category=category{id=1, name='wellingtons', group='male'}, size=9} but when send request in client app, json, contains id , size: { "id": 1, "size": 9 } i wonder why don't receive localization , category. here shoes class: @table(name = "shoes") public class shoes{ @column(name = "id") @id @generatedvalue(...

markdown - Mathjax don't show up on Jekyll Github Pages but show up on localhost -

Image
i using jekyll on github page. created blog post using mathjax display math equations. i used script written in here in file mathjax_support.html put in _includes directory. in _includes/head.html added line {% include mathjax_support.html %} just before </head> . once that, running jekyll blog locally on localhost works fine commiting github page break mathjax code. here blog post on github trying display correctly. using kramdown markdown parser. i cannot understand why works on 1 side , not other. if has idea, happy hear it. ! you don't need mathjax working on github page. can instead implement hack: step 1) run blog locally , take screenshots of expressions step 2) commit screenshots gh page or upload them image hosting service step 3) replace expressions respective images, e.g replace $x+2=3$ . use direct links or browsers unable load images! btw, markdown syntax inline images: ![description of image, in case doesn't loaded](...

python - How to elegantly transform '1-3,6-8' to '1 2 3 6 7 8' within a list? -

problem background: i have list of ~10,000 lists containing irregular data needs transformed specific format. data ingested pandas dataframe after transformation. tl/dr; how elegantly transform matched strings of following regex in list? regex '\d{1,3}-\d{1,3},\d{1,3}-\d{1,3}' example: '1-3,6-8' '1 2 3 6 7 8' current solution: using list comprehensions required multiple type casts transform string , unfit lasting solution. pat = re.compile('\d{1,3}-\d{1,3},\d{1,3}-\d{1,3}') row = ['sss-www,ddd-eee', '1-3,6-8', 'xxxx', '0-2,3-7','234','1,5'] lst = [((str(list(range(int(x.split(',')[0].split('-')[0]), int(x.split(','[0].split('-')[1])+1))).strip('[]').replace(',', '')+' ' +str(list(range(int(x.split(',')[1].split('-')[0]), int(x.split(',')[1].split('-')[1]) + 1))).strip('[]...

R read.table csv where text field contains enters -

i have sql query result exported csv format ";" separator. should contain 5 columns: order_id (str), user_rating (int), user_feedback (str), created_by (str), created_on (date) problem users can have comments spanning multiple lines in user_feedback field. while in sql coerced nice single line view. exported csv dataset not read in properly. fread() data.table , read.table() both failed. got read in 1 column using: data1 <- read.table('myfile.csv', stringsasfactors = f, header = f, sep = "\t", allowescapes = t, quote = "") the problem follows: query result contains 50000 rows, csv read in 50267 rows. checking data, seems took user_feedback contained 'enters' , read in separate rows. how import data properly, user_feedback data every row single string field?

How to use redux-saga with redux and react-redux -

i trying understand how redux-saga works, implementing simple example (a button when clicked fetch user api , reducer adds user store) react, redux , react-redux. here saga (with console.logs debugging): import { take, call, put } 'redux-saga/effects'; import { get_user, setuser } './actions/actioncreators'; export default function * watchfetchuser () { console.log('inside saga'); yield take(get_user); console.log('received click'); const url = 'http://uinames.com/api/?ext'; const user = yield call(fetch, url); const usertojson = yield user.json(); yield put(setuser(usertojson)) } unfortunately when click "get user" button nothing happens: import react, { proptypes } 'react'; import cssmodules 'react-css-modules'; import styles './button.css'; const button = ({ getuser }) => { function handleclick() { getuser console.log('clicked'); } return ( <butt...

C++ How to declare as atribute, a pointer to my own type, using templates -

this problem: have class "nodo" (to make bsts) has array of pointers same type attribute, , have son class "nodoavl" (to make avl trees) have inherit atribute, pointers must point same type, is, point "nodoavl". there way this? maybe code, can explain better: #include<iostream> using namespace std; template <class t> class nodo { protected: t d; "my_own_type" *h[2] = {null}; // here need pointers own type // nodo has 2 pointers nodo // , nodoavl has 2 pointers nodoavl public: nodo(t dato = t()) { d = dato; } }; template <class t> class nodoavl : public nodo<t> { protected: int alt = 0; public: nodoavl (t dato = t()): nodo<t>(dato) {} int altu () {return alt;} }; i gratefull help. --- update --- i have read crtp (thanks some programmer dude ) , although didn't understand utility, found solve problem. decided m...

jquery - Jplayer - Click a link and play a song in the playlist -

how can play song in playlist after clicking link? looks jplayer generates list group automatically. in case, link image start mp3 file in playlist. <a class="track" href="/tsp-01-cro_magnon_man.mp3"><img src=''></a> here's script $(document).ready(function() { var myplaylist = new jplayerplaylist({ jplayer: "#jquery_jplayer_1", cssselectorancestor: "#jp_container_1" }, [{ title: "cro magnon man", artist: "mushroom records", mp3: "http://www.jplayer.org/audio/mp3/tsp-01-cro_magnon_man.mp3", oga: "http://www.jplayer.org/audio/ogg/tsp-01-cro_magnon_man.ogg" }, { title: "your face", artist: "ministry", mp3: "http://www.jplayer.org/audio/mp3/tsp-05-your_face.mp3", oga: "http://www.jplayer.org/audio/ogg/tsp-05-your_face.ogg" }, { title: "thin ice", artist: "screa...

mysql - How to Compare a String in an SQL Database to a PHP Variable -

ok, title says, want find out how can compare string in sql database php string. <!doctype html> <html> <head> <title>processing request</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <h1>account creation</h1> <h3> <?php $dbhost = "localhost"; $username = "root"; $password = ""; $connect = mysqli_connect("$dbhost", "$username", "$password"); $db = "accounts"; if (!$connect){ die("error: database connection failed: " . mysqli_connect_error()); } mysqli_select_db($connect, $db); $makeuser = $_post["makeuser"]; $makepass = $_post["makepass"]; $sql = "insert accounts (username, password) values ('$makeuser', '$makepass')"; if("select username accounts u...

Building a Filter in a loop, JSONPath -

i want loop through array of strings , add each string jsonpath filter object: filter f = filter(); // error (int j = 0; j < in_paths.size(); j++) { f = f.and(where(in_paths[j]).exists(true)); } the problem approach can't seem create "empty" filter. know if possible? if not, can offer alternative? the initial filter can check see if document root exists. filter f = filter(where("$").exists(true)); (int j = 0; j < in_paths.size(); j++) { f = f.and(where(in_paths[j]).exists(true)); }

scala - How to test a controller in Play Framework with a functional test -

i'm trying make functional test controller play framework version 2.5.9. i have controller called homecontroller @singleton class homecontroller @inject()(implicit exec: executioncontext) extends controller { def index = action.async { future{ ok(views.html.index("home")) } } } my view looks this @(message: string) @main("home") { <h2>welcome</h2> } the arguments in @main goes in title of page , test looks this class applicationtwospec extends playspec oneserverpersuite onebrowserpersuite htmlunitfactory{ implicit val ec = implicits.global val homecontroller = new homecontroller() implicit override lazy val app = new guiceapplicationbuilder() .router(router.from{ case get(p"/") => homecontroller.index }) .build() "the sample controler server" must { "have home in title" in { go s"http://localhost:90...

three.js - Multiple scenes on different canvases -

i'm trying create 2 scenes on 2 different canvases. possible in three.js? var scene1 = new three.scene() var scene2 = new three.scene() scene1.add(camera1) scene2.add(camera2) ... renderer.render(scene1, camera1) renderer.render(scene2, camera2) will work that? yes - totally possible, renderer-instance bound webglcontext of canvas. need create create renderer every canvas have. be renderer1.render(scene1, camera1); renderer2.render(scene2, camera2); (the other way around works well: can use multiple renderers render same scene different cameras) edit based on comments you can render multiple scenes different regions of same canvas, using 1 renderer. need setup different viewport , scissor-test every scene (based on https://threejs.org/examples/#webgl_multiple_views ) // first, render scene normally: camera.aspect = totalwidth / totalheight; camera.updateprojectionmatrix(); renderer.setviewport(0, 0, totalwidth, totalheight); renderer.setscissortest(fa...

html - onClick() function can't trigger javascript code -

i have small problem. tried add onclick function submit button javascript doesn't run. dont't know error :( when put code inside onclick property alert dialog works fine. <head> <script type="text/javascript"> fuction login() { alert('hello'); } </script> </head> <body> <form action="javascript:void(0);" method=""> <fieldset class="clearfix"> <p><span class="fontawesome-user"></span><input type="text" value="إسم المستخدم أو الأيميل" name="username" onblur="if(this.value == '') this.value = 'إسم المستخدم أو الأيميل'" onfocus="if(this.value == 'إسم المستخدم أو الأيميل') this.value = ''" required/></p> <!-- js because of ie support; better: placeholder="username" --> ...

bootstrap create horizontal checkbox menu -

i have simple form created in bootstrap , want edit actual version horizontal checkbox, actual html code : http://www.bootply.com/fe0dz54ezl i want edit image : https://snag.gy/do8yrq.jpg in moment when click on 'instant delivery' hide 'delivery in time' i need when click on check box 'instant delivery' disable part of checkbox 'delivery time' , conversely. how can ?

compilation - Unable to build Nativescript Android app -

i trying build nativescript app android platform. running command │ $ tns build android [--compilesdk api level] [--key-store-path file path --key-store-password password│ -key-store-alias name --key-store-alias-password password] [--release--static-bindings--copy-to file path of necessary components filled in. each time run it, gives me message necessary steps build it. there missing? first check if every thing ok command tns doctor : 1- tns create projectname create nativescript project, 2-in created project tns platform add android add android platforms folder , can build android, 3-in created project tns build android build (automatically tns platforms add android job if didnt run that) not deploy device, 4-in created project tns run android build , deploy device( automatically tns platforms add android job if didnt run that)

Eagerly evaluating all predicate calls in Prolog -

reading swi-prolog documentation on meta-predicates , assumed call(f, ...) equivalent f(...) , f predicate. observe behavior of 2 diverge in cases. instance, suppose knowledge base includes clause f(g(x)) . query call(f, g(x)) succeeds, whereas f(call(g, x)) not. problematic, because need use clauses bodies include nested predicate calls. i'd prolog evaluate predicate calls eagerly (i wonder if right word?), such query f(call(g, x)) reduces f(g(x)) before unification begins, , succeeds. possible?

python - Print two arrays side by side using numpy -

Image
i'm trying create table of cosines using numpy in python. want have angle next cosine of angle, looks this: 0.0 1.000 5.0 0.996 10.0 0.985 15.0 0.966 20.0 0.940 25.0 0.906 , on. i'm trying using loop i'm not sure how work. currently, have . any suggestions? let's have: >>> d = np.linspace(0, 360, 10, endpoint=false) >>> c = np.cos(np.radians(d)) if don't mind having brackets , such on side, can concatenate column-wise using np.c_ , , display: >>> print(np.c_[d, c]) [[ 0.00000000e+00 1.00000000e+00] [ 3.60000000e+01 8.09016994e-01] [ 7.20000000e+01 3.09016994e-01] [ 1.08000000e+02 -3.09016994e-01] [ 1.44000000e+02 -8.09016994e-01] [ 1.80000000e+02 -1.00000000e+00] [ 2.16000000e+02 -8.09016994e-01] [ 2.52000000e+02 -3.09016994e-01] [ 2.88000000e+02 3.09016994e-01] [ 3.24000000e+02 8.09016994e-01]] but if care removing them, 1 possibility use simple regex: >...

java - Multi level polymorphism in Jackson -

i'd able deserialize json objects having more 1 discriminator column. should allow have set of classes map polymorphic json, lot of possible combinations. wrote hierarchy of classes , used annotations described in documentation. trying deserialize using generic class causes error: seems jackson not walk through entire tree of classes, stops on first level, reading annotations of top class. doing wrong or jackson limitation? for example, consider following code: import com.fasterxml.jackson.annotation.jsonsubtypes; import com.fasterxml.jackson.annotation.jsontypeinfo; import com.fasterxml.jackson.databind.jsonmappingexception; import com.fasterxml.jackson.databind.objectmapper; import java.io.ioexception; import static com.fasterxml.jackson.annotation.jsontypeinfo.as.property; import static com.fasterxml.jackson.annotation.jsontypeinfo.id.name; @jsontypeinfo(use = name, include = property, property = "animal") @jsonsubtypes({ @jsonsubtypes.type(value = do...

Unable to register a device with MobileFirst and Swift client -

i testing ibm mobilefirst sample code using locally installed mfp server ios client. expecting following code give me error or token. however, both nil. wlauthorizationmanager.sharedinstance().obtainaccesstoken(forscope: nil) { (token, error) -> void in if (error != nil) { self.titlelabel.text = "bummer..." self.connectionstatuslabel.text = "failed connect mobilefirst server\n\(serverurl)" print("did not recieve access token server: " + error.debugdescription) } else { self.titlelabel.text = "yay!" self.connectionstatuslabel.text = "connected mobilefirst server\n\(serverurl)" print("recieved following access token value: " + token!.value) } self.testserverbutton.isenabled = true } things for: that you're using correct app version (if registered via console) that you're using correct appl...

c++ - std::array Can't compare between two arrays with my class as its element -

i have 2 std::array same size , store same element type (a class wrote) when compare them using == operator compiler throws error: ...\include\xutility(2919): error c2672: 'operator __surrogate_func': no matching overloaded function found . i tried comparing tow arrays vectors elements , worked comparing arrays class write i'm getting error. test class: class class { int i; public: class() {} class(const class& other) {} class(class&& other) {} ~class() {} class operator= (const class& other) {} class operator= (class&& other) {} bool operator== (const class& other) {} }; comparison: std::array<class, 3> a0 = {}; std::array<class, 3> a1 = {}; if (a0 == a1) "cool"; error i'm getting: ...\include\xutility(2919): error c2672: 'operator __surrogate_func': no matching overloaded function found if @ std::array 's definition of ope...

html - Slideshow angular not working -

have found example of how make slideshow angular, done. slide-effect left not work in example. http://plnkr.co/edit/bxwnlyvjucnl7c1k65au?p=preview anyone idea have done wrong. var pictures = angular.module("myapp", []) .controller("slideshowcontroller", function($scope, $timeout) { var slideinslideshow = 4; var slidetimeinterval = 4000; $scope.slider = 1; var slidetimer = $timeout(function interval() { $scope.slider = ($scope.slider % slideinslideshow) + 1; slidetimer = $timeout(interval, slidetimeinterval); }, slidetimeinterval); var image = { one: "image/image01.jpg", two: "image/image02.jpg", three: "image/image03.jpg", four: "image/image04.jpg" }; $scope.image = image; }); .slideshow { width: 600px; height: 400px; margin: 0 auto; margin-bottom: 30px; overflow: hidden; position: relative; border: 1px solid red; } .slider { f...

How to do null checks in Scala in an idiomatic way? -

case class account( val name: string, val uuid: string, val lat: double, val lng: double ) } object account { def create(row: row): option[yellowaccount] = { val name = row.getas[string]("store_name") val uuid = row.getas[string]("uuid") val lato = row.getas[string]("latitude") val lngo = row.getas[string]("longitude") // how do null checks here in idiomatic way? if (lato == null || lngo == null) { return none } some(yellowaccount(name, uuid, lato.todouble, lngo.todouble)) } } lat/long compulsory fields in account . how do null checks in idiomatic way? you can use option type handle null values. wrap nullable value in option , can pattern match on or else. in example, think concise way combine 4 nullable values for-comprehension: import scala.util.try obj...

Is it possible to broadcast Tensorflow libraries using spark-submit -package -

i using cluster, not managed myself. tensorflow libraries not installed on cluster nodes. run spark programs using tensorflow package. not sure if possible use spark-submit --packages broadcast tensorflow packages across cluster nodes. i not sure tensorflow itself, can pass local jars using --jars , files using --files job. below example: spark-submit --master yarn-cluster --num-executors 5 --driver-memory 640m --executor-memory 640m --conf spark.yarn.maxappattempts=1000 \ --jars /usr/hdp/current/spark-client-1.6.1/lib/datanucleus-api-jdo-3.2.6.jar,/usr/hdp/current/spark-client-1.6.1/lib/datanucleus-core-3.2.10.jar,/usr/hdp/current/spark-client-1.6.1/lib/datanucleus-rdbms-3.2.9.jar \ --files /usr/hdp/current/spark-client-1.6.1/conf/hive-site.xml \ --class com.foobar.main this example of how start spark streaming job , application master , driver run on cluster spark not installed. need pass long jars , configs run.

javascript - Is there something like incomplete (partial) declarations for Flow? -

i'd incrementally add declarations external library. possible write declaration describes properties of object/interface , remaining properties omitted declaration , unchecked? for example: can following object const = {foo: 8, bar: 9} have declaration describing 1 property? declare var a: any|{foo: number} // doesn't work the intended behavior if property found in declaration type enforced. type of non-mentioned properties considered any . typescript solves problem using properties expression: interface iface { foo: number; [propname: string]: any; } type partiala = {foo:number, [key:string]: any} const a: partiala = {foo: 1, bar: 2} console.log(a.bar) this options safer following 1 since types of known properties onforced: a.foo = 'a' // causes error // 6: a.foo = 'a' // ^ string. type incompatible // 3: type partiala = {foo:number, [key:string]: any} // ^ number or type partialb =...

c++ - Passing a predicate to QWaitCondition? -

i'm writing threads in qt , can't figure out how pass predicate condition variable protect against spurious wake up. working solution in c++: std::mutex(mu); std::condition_variable cond; std::unique_lock<mutex> alpha_lock(mu); cond.wait(alpha_lock, [](){ return //some condition;}); alpha_lock.unlock(); //continue stuff... qt equivalent: qmutex mu; qwaitcondition cond; qmutexlocker alpha_lock&(mu); cond.wait(&mu, [](){return //some condition;}) error: "no matching member function call wait" any ideas on how use predicate in qt code? as compiler , @xaxxon have pointed out, there no such wait() overload in qwaitcondition . if want check condition before going on can this while (!condition()) { cond.wait(mutex); } you can of course put helper function takes qwaitcondition , qmutex , std::function if need in more places. or derive qwaitcondition adding overload doing loop above.

python 3.x - Conditional column selection in pandas -

Image
i want select columns dataframe according particular condition. know can done loop, df large efficiency crucial. condition column selection having either non-nan entries or sequence of nans followed sequence of non-nan entries. here example. consider following dataframe: pd.dataframe([[1, np.nan, 2, np.nan], [2, np.nan, 5, np.nan], [4, 8, np.nan, 1], [3, 2, np.nan, 2], [3, 2, 5, np.nan]]) 0 1 2 3 0 1 nan 2.0 nan 1 2 nan 5.0 nan 2 4 8.0 nan 1.0 3 3 2.0 nan 2.0 4 3 2.0 5.0 nan from it, select columns 0 , 1. advice on how efficiently without looping? logic count nulls in each column. if nulls in beginning, number of nulls in column should equal the position of first valid index. get first valid index slice index null count , compare against first valid indices. if equal, thats column cnull = df.isnull().sum() fvald = df.apply(pd.series.first_valid_index) cols = df.index[cnull] == fvald df.loc[:, cols] edited speed impr...

How do I make a reusable form component group with Redux-Form v6? -

i'm trying make reusable form component group (section?) use redux-form v6. ideally don't want aware of where used within form, can use anywhere within form (at root or nested). how can this? for example, have address component uses redux-form's field address1, city, state, zip, etc, this: class address extends react.component { render() { return ( <field component={myreduxforminput} name="address1" // <== how name generic case? /> ) } } here's simplified myreduxforminput : module.exports = field => { return <input {...field.input} /> } i'm creating form need collect user's address, multiple addresses professional references. so, want use address once @ root , multiple times in nested fashion. trick is, can't use address i've written above, because while work root address, won't work nested situations. shown in fieldarray example docs , name supplied field nee...

Excel VBA to split PDF files -

Image
i have pdf of 120 pages, want split pdf according following image in column b , c have page , information should split according this. example if splits page 1 6 , should save gi in column possible in excel vba if possible can me how split pdf, i'm having adobe acrobat x1 pro. with regards, yuvaraj.

datetime - pandas dataframe getting daily/weekly/hourly data -

i have pandas dataframe index = datetime.datetime(year,month,day,hour,minute) i want able use hourly/ daily /weekly data hourly data last entry corresponding every hour in frame. is there inbuilt way this? tried making cases e.g. in case of daily data, changed hour , minute entry zero, still have dataframe multiple entries same day. how can last entry corresponding each day? sample dataframe: index x y 2016-01-01 00:07:00-05:00 1.000 0.000 2016-01-01 00:10:00-05:00 1.000 0.000 2016-01-01 00:15:00-05:00 1.000 0.000 2016-01-01 00:16:00-05:00 1.000 0.000 2016-01-01 00:20:00-05:00 1.000 0.000 2016-01-01 00:21:00-05:00 1.000 0.000 2016-01-01 00:26:00-05:00 1.000 0.000 2016-01-01 00:31:00-05:00 1.000 0.000 2016-01-01 00:37:00-05:00 1.000 0.000 2016-01-01 00:40:00-05:00 1.000 0.000 2016-01-01 00:46:00-05:00 1.000 0.000 2016-01-01 00:51:00-05:00 1.000 0.000 2016-01-0...

xcode - React-Native iOS app downloaded from HockeyApp closes after opening -

i have mac build agent builds ios app xcode , pushes .ipa hockeyapp. able download app hockeyapp app closes after loading splash screen. working couple of days stopped working. not sure went wrong. diagnosing issue appreciated. the same version of application if build in dev environment , pushed hockeyapp works fine.

node.js - npm start does not open browser tab -

i learning angularjs 2.i want make first application in angularjs 2 official website.so followed here https://angular.io/docs/ts/latest/quickstart.html . in step 6 have run command 'npm start' in terminal.it gives me result in terminal like-- $ npm start > angular-quickstart@1.0.0 start d:\sadiq\res\angularjs__2\angularq > tsc && concurrently "tsc -w" "lite-server" [1] did not detect `bs-config.json` or `bs-config.js` override file. using lite-server defaults... [1] ** browser-sync config ** [1] { injectchanges: false, [1] files: [ './**/*.{html,htm,css,js}' ], [1] watchoptions: { ignored: 'node_modules' }, [1] server: { basedir: './', middleware: [ [function], [function] ] } } [1] [bs] access urls: [1] ------------------------------------- [1] local: http://localhost:3002 [1] external: http://192.168.2.93:3002 [1] ------------------------------------- [1] ui: http://localhost:3003 [...

api - How to create this XML with PHP SoapClient? -

i've been trying few days try , create xml via php soap client, no avail. i checked many topics here on stackoverflow nothing quite worked yet. response sent empty request. below request structure should like: <?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.datacontract.org/2004/07/cm.entities.services" xmlns:ns2="http://tempuri.org/"> <soap-env:body> <ns2:createlead> <ns2:contact> <ns1:address>?</ns1:address> <ns1:aditionalcontactdata> <ns1:adgroup>?</ns1:adgroup> <ns1:adid>?</ns1:adid> <ns1:carrier>?</ns1:carrier> <ns1:category>?</ns1:category> <ns1:city>?</ns1:city> <ns1:clickid>?</ns1:clickid> <ns1:device>...

spring amqp - Processing message from rabbitmq at specified rate -

we have been trying make listener read messages rabbitmq @ rate 1 msg/2 seconds. did not find such utility rabbit mq far. thought of doing db i.e. listener read messages , store db , later scheduler process @ desired rate db. if there better way of doing this, please suggest. developing our application in spring. in advance. you can't listener, can rabbittemplate ... @springbootapplication public class so40446967application { public static void main(string[] args) throws exception { configurableapplicationcontext context = springapplication.run(so40446967application.class, args); rabbitadmin admin = context.getbean(rabbitadmin.class); anonymousqueue queue = new anonymousqueue(); admin.declarequeue(queue); rabbittemplate template = context.getbean(rabbittemplate.class); (int = 0; < 10; i++) { template.convertandsend(queue.getname(), "foo" + i); } string out = (string) templa...

word 2016 vba not writing to protected excel workbook -

my task take forms (and accompanying spreadsheets) use on google docs(sheets), , transfer them our share drive. losing access google docs(sheets) (company change o365) , @ least have 1 of these things ready go lose access google docs. options limited. i'm not versed in creating pdf forms, our version of adobe isn't developers anyway. anyway, have built first form , accompanying protected spreadsheet (needed because have personal information). problem spreadsheet opening, closing without writing information. macros running without breaking in it's current form. code word document follows: sub submitbutton_click() application.screenupdating = false dim exctransfer excel.application dim excwkbk workbook dim excsht worksheet set exctransfer = new excel.application set excwkbk = exctransfer.workbooks.open("l:\30 day short term_ storage\security\security forms\vehicle registration forms\vehicle_ registration worksheet.xlsm", readonl...

How can download file in service in android -

i want download file server , want download in background such service. my codes : public class mainactivity extends appcompatactivity { button download; textview downloadcount; progressbar progressbar; future<file> downloading; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // enable global ion logging ion.getdefault(this).configure().setlogging("ion-sample", log.debug); setcontentview(r.layout.activity_main); download = (button) findviewbyid(r.id.download); downloadcount = (textview) findviewbyid(r.id.download_count); progressbar = (progressbar) findviewbyid(r.id.progress); file sdcard = environment.getexternalstoragedirectory(); file dir = new file(sdcard.getabsolutepath() + "/dir1/dir2"); if (!dir.exists()) { dir.mkdirs(); } final file file = new file(dir, ...