Posts

Showing posts from July, 2010

Ant to add workspace folder in classpath as a dependent project -

i have 1 ant project xyz , want, when put project 1 random workspace, , when build xyz automatically add workspace folder config (already present in workspace) , task (already present in workspace) classpath dependent project. well, if projects in workspace follow same standard classfile folder, let's project/build : project1/ build/ class files... project2/ build/ class files... project3/ build/ class files... xyz/ build.xml .. set classpath in xyz/build.xml this: <project basedir="."> <path id="my.classpath"> <dirset dir=".." includes="**/build"/> </path> <javac classpathref="my.classpath"> ... </javac> </project> in way, of .class files produced in every project else in workspace included in compilation of xyz. in case know projects want include in xyz's classpath, have set this: <projec

java - Replacing a string parameter with a List for a recursive method -

i struggeling simple problem last 3 hours. rewrote class , replaced 2 string parameters lists. problem is, when calling rekursive method add 1 character first string parameter. , when length of parameter hits length of 7 prints out. string never gets longer 7. replaced integer list since string consisted of numbers. list though keeps getting longer , longer , have no idea why. hope explained properly. if not, ask me please. the question super easy answer guys. here first class, works. package uebung4; public class permall_alt { static int counter = 0; private static void permutation(string word, string str) { int n = str.length(); // system.out.println(str + " str"); // system.out.println(word + " word"); if (n == 0) { if ( (integer.parseint(word.substring(0, 1))) > (integer.parseint(word.substring(1, 2))) && (integer.parseint(word.substring(1, 2))) < (integer.parseint(word.substring

c# - How can i convert a float number to a string? -

how can convert float number string? for (float = 1000000000; < 10000000000; i++) { //temp never change , it's value 1000000000 string temp = convert.toint64(i).tostring(); } this number big , want save string on file like 1000000001 1000000002 1000000003 how can convert float number string? obviously: i.tostring() . see the documentation learn how apply formatting in order achieve desired output. however, couple notes: a variable named i commonly indicates int , not float . iterating for , variable of type float obscure. are sure want use floating-point data type, when treat integer? consider using long or decimal . temp never change , it's value 1000000000 float 's precision not enough store number big 1000000000 , discards least significant places. wikipedia : “all integers 6 or less significant decimal digits can converted ieee 754 floating point value.” that's why result seems same. side effect, for c

c - Conversion to ‘int’ from ‘float’ may alter its value -

my code: #inlcude <math.h> #include "draw.h" /*int draw(int x, int y)*/ draw(rintf(10 * x), rintf(8 * y)); i warning: conversion ‘int’ ‘float’ may alter value. i can't change draw float, since need draw points. rounding inevitable. ideas? the return type of rintf float produces warning. can either explicitly cast int suppress warning (i.e., (int) rintf(10 * x) , or use way of rounding (e.g., if values known non-negative, (int) (10.0f * x + 0.5f) ) or lrint (preferably tgmath.h ), although returns long may cause warning depending on compiler , settings.

java - Picasso fails to load an image but provides no error message? -

i'm running issue on devices (non-nexus devices) on varying versions of android (kitkat , marshmellow) throwing error when try use picasso load image image view. have no idea i'm doing wrong, provides no error message other calling "onerror" method. things i've checked: the image string non-null , points valid string on device. picasso non-null. switching on logging see if relevant shows there (it doesn't). the code: picasso.setloggingenabled(true); picasso.load(msourceimageurl) .resize(mwidthpx, mheightpx) .centercrop() .error(r.drawable.shape_rounded_rectangle_gray) .placeholder(r.drawable.shape_rounded_rectangle_gray) .into(imageview, new callback() { @override public void onsuccess() { system.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& onsuccess");

user - Instagram Sandbox Invites page redirects to the developer register page -

i have app in sandbox mode , have sandbox user pending . (it has been @ least day since user added). user can use app , has given authorization; however, user's likes returns empty response (i know can access liked media other authorized sandbox users, user has liked media account set admin). instagram api documentation states user may go developer site , accept/decline sandbox invites sandbox invites tab except user shown developer register page instead. know going on/how fix this? instagram made sweeping changes it's api , way accessed recently. result of lockdown sandbox invite process glitchy @ best. myself ran issue of invites not showing up. it seems, moment, way access invite fill out developer form(i used http://localhost:8000 url , random phone number not exist, although try without 1 might not necessary). should automatically forward invite page invited user can accept or decline sandbox invite. it's bit of mess , lack of documentation / ind

multithreading - how to control process in python? -

i want run several process in parallel without giving cpu work cpu can other jobs. in python, use os.system call binary. , theses call independent , can parallel. these binary may run different length of time. what want example, keep 8 of them run in parallel, if 1 exit early, start one. what doing this: count = 0 f in files: count = count + 1 cmd = exe if (count != 8): cmd = cmd + " &" else: count = 0 os.sytem(cmd) but not ideal if cmd without & runs long or short. i tried multiprocessing module, p=pool(8) print(p.map(f,list_of_args)) but in case not running 8 processes in parallel of time. since of them exit early. there no need synchronization. i have 16 cpu cores , want half of them(8 processes runs in parallel) you'd better not use os.system subprocess.popen more powerful , safe. subprocess.popen not block on call don't need append '&' @ end of command. for question it

ios - Getting an error with Interstitial Ads (iAd and Spritekit) -

i keep getting error within section of code: // interstitial iad -(void)showfullscreenad { // check if requesting ad if (requestingad == no) { interstitial = [[adinterstitialad alloc] init]; interstitial.delegate = self; self.interstitialpresentationpolicy = adinterstitialpresentationpolicymanual; [self requestinterstitialadpresentation]; nslog(@"interstitialadrequest"); requestingad = yes; } } -(void)interstitialad:(adinterstitialad *)interstitialad didfailwitherror:(nserror *)error { interstitial = nil; requestingad = no; nslog(@"interstitialad didfailwitherror"); nslog(@"%@", error); } -(void)interstitialaddidload:(adinterstitialad *)interstitialad { nslog(@"interstitialaddidload"); if (interstitialad != nil && interstitial != nil && requestingad == yes) { //[interstitial presentfromviewcontroller:self]; //[interstitial p

android - View of Endless Width and Height with Camera Operations . -

how can create custom view mapfragment users can scroll , pinch ,zoom in zoom out , camera specific operations. want view of endless width , endless height, invisible @ beginning rendered user requests navigating . possible , if , how ?? you tackling wrong way, view not endless- it's size of screen, data "endless". want create view response gestures user , redraw depend on position , zoom level. here example

swift - how to wait for requestLocation before proceeding? -

i'm requesting user location when button pressed triggers api call. don't want make api call before latitude/longitude values obtained requestlocation() call. thought poll while loop checking if optional variables latitude == nil || longitude == nil , sits in while loop forever. need have kind of waiting values because if don't send nils api call, since takes few seconds location. make sure api request isn't called until latitude/longitude values set requestlocation() call? call api delegate method of cllocationmanagerdelegate func locationmanager(manager: cllocationmanager, didupdatelocations locations: [cllocation]) { locationmanager.stopupdatinglocation() let location = locations.last! cllocation latittude = string(format: "%f", location.coordinate.latitude) longitude = string(format: "%f", location.coordinate.longitude) // call api here } hope you. thanks

Excel VBA: Loop through two columns in sheet1, look for specific names, paste rows with matching value to sheet2 -

context: new vba task: have contact list in worksheet1 contains columns: lastname, firstname, email, phone #, , several more. have second contact list in worksheet2 (formatted same) contains approximately 500 of 1,000 names found in worksheet1 contact list updated contact information (email, phone #, etc.). i'm trying write code find names in both worksheets, , names, copy email, phone#, etc. worksheet2 (updated information) , paste corresponding location in worksheet2. code: have far. not work. sub updatecontacts() dim reference string dim range range dim contactlist worksheet dim updatedcontacts worksheet contactlist = activeworkbook.sheets("contact list") updatedcontacts = activeworkbook.sheets("updated contacts") reference = contactlist.range("b5", "c5").value j = 5 = 5 updatedcontacts.cells(rows.count, 1).end(xlup).row if updatedcontacts.range(cells(i, 2), cells(i, 3)).value = reference updat

java - libgdx ashley ecs framework - Should I use MovementSystem with PhysicsSystem? -

if movementsystem behavior this. public class movementsystem extends intervaliteratingsystem { private vector2 temp = new vector2(); public movementsystem() { super(family.all(transformcomponent.class, movementcomponent.class).get(), constants.time_step); } @override protected void processentity(entity entity) { transformcomponent transform = mappers.transform.get(entity); movementcomponent movement = mappers.movement.get(entity); vector2 acceleration = temp.set(movement.accel).scl(0.5f); movement.velocity.add(acceleration); vector2 acceleratedvelocity = temp.set(movement.velocity).scl(0.5f); transform.position.add(acceleratedvelocity); } } while on physicssystem behavior. public class physicssystem extends intervaliteratingsystem { @override protected void processentity(entity entity) { physicscomponent physics = mappers.physics.get(entity); tran

python - logout and login with different twitter account using ( Django + Allauth ) -

i using allauth login twitter in django app. have problem logout existing account login different one. i make logout in function logout in views.py , within tried call: from django.contrib import auth auth.logout(request) but didn't work. i tried expire session using this: request.session.set_expiry(1) to expire session after 1 second, didn't work. by way use own signup , login (i save mail , password) so ideas? all auth takes care of it, jut build url to: /accounts/logout/ no need write own view. if want know override view.

java - How i can create button as shown in picture? -

Image
how can create dynamic component shown in picture? component image change @ run time. component border , backgrond color should changable @ run time. you can create button below, jbutton button = new jbutton(); try { image img = imageio.read(getclass().getresource("resources/water.bmp")); button.seticon(new imageicon(img)); } catch (ioexception ex) { //catch exceptions } you can call button.seticon(new imageicon(img)); to change button image @ run time. you can call button.setbackground() to change background @ runtime. have @ jbutton documentation more information.

javascript - How to set Caller ID with area code matching using RingCentral WebRTC? -

when using ringcentral webrtc, possible set caller id (clid) outbound voice? have set of 1000+ phone numbers various area codes company want able use caller id when dialing out. have number of different agents making calls need multiple agents able use same caller id simultaneously. i'm using ringcentral webrtc javascript sdk , didn't see caller id option. after asking , trying things out figured out following: (1) assigning caller id (clid) phone numbers to load multiple clid phone numbers ringcentral account, add them company numbers can done in online account portal admin account under: home > phone system > company numbers , info > add number i assigned of these auto-receptionist . once these numbers loaded company numbers, should available users use clid. verify this, retrieve list of clid numbers available user calling following rest api endpoint after user has authorized app: /restapi/v1.0/account/~/extension/~/phone-number the

r - Append a column of NA values: lit() and withColumn() giving error -

i trying append column of null values sparkr dataframe following code: w <- rbind(3, 0, 2, 3, na, 1) z <- rbind("a", "b", "c", "d", "e", "f") x <- rbind(3, 3, 3, 3, 3, 3) d <- cbind.data.frame(w, z, x) b <- as.dataframe(sqlcontext, d) b1 <- sample(b, withreplacement = false, fraction = 0.5) b2 <- except(b, b1) col_sub <- c("z", "x") b2 <- select(b2, col_sub) b2 <- withcolumn(b2, "w", lit(na)) but, last expression returns error: error in fun(x[[i]], ...) : unsupported data type: null . have used lit operation produce column of null values before, i'm not sure why won't work time. also, has been discussed on se before, see this question . i'm clueless why expression yields error. reference, i'm using sparkr 1.6.1. no matter if works or not adding column way not practice. since practical reason add column contains undefined values

ruby on rails - The delete http request for microposts in Figure 13.54 of Michael Hartl's tutorial has no route matches? -

from following excerpt of section: test "should redirect destroy wrong micropost" log_in_as(users(:michael)) micropost = microposts(:ants) assert_no_difference 'micropost.count' delete micropost_path(micropost) end assert_redirected_to root_url end the following line delete micropost_path(micropost) was giving me following error: actioncontroller::urlgenerationerror: no route matches {:action=>"/microposts/583546149", :controller=>"microposts"} comparing action: portion snippets had seen online of typical delete http requests clued me in inherently wrong. had curiously noted, too, in tutorial michael hartl used following syntax deleting resources: delete :destroy, id: micropost just clear, latter seems work expected. question, then, twofold: are both supposed valid? what's difference? that test make sure micropost(:ants) cannot created because method micropost(:oranges). why gave error , redi

php - Proper use of updateOrCreate method -

i have onetoone relationship between insurances table , confirmations table. here migration confirmations: $table->increments('id'); $table->integer('insurance_id')->unsigned()->index()->unique(); $table->boolean('status'); $table->timestamps(); $table->foreign('insurance_id')->references('insurancenumber')->on('insurances'); i want make status updatable. there form 2 buttons of reject , accept , controller this: public function confirmation(){ $confirm_button = request::get('confirm_button'); $reject_button = request::get('reject_button'); if (isset($confirm_button)){ $status = true; }else if (isset($reject_button)){ $status = false; } confirmation::updateorcreate(['insurance_id' => session('insurance_id')],['status'=> $status]); } } i want if confirmations row same insur

java - GWT Node or Element listen to onAttach event -

is there way handle sort of onattach event in gwt node? suppose this: node mydiv = dom.creatediv(); magic.setonattacheventlistener(mydiv, new eventlistener() { @override public void onevent(event event) { // ... } } the handler should invoked when this, parent.appendchild(mydiv); given parent attached itself, i.e., displayed in current window. i post second answer know can't change way how divs added parent. after searching found mutation events . allow listen domnodeinserted event: js: mydiv.addeventlistener("domnodeinserted", function (ev) { alert('added'); }, false); in gwt need use jsni method: private native void addlistener(element elem) /*-{ elem.addeventlistener("domnodeinserted", function (ev) { $wnd.alert('added'); }, false); }-*/; it works, but... it's deprecated. should use mutationobserver instead. unfortunately mutationobserver don't have nodeinserted event

php - Is there a secure method to temporarily store password to update on other systems? -

i have php based web application manages several other systems including active directory , google apps. whenever user edited changes synced of our other systems. several of systems require password set on system our system. currently changes synced synchronously during single page request have background process sync changes. there reasonably secure way store password in retrievable format background process sync , delete it? unfortunately active directory , of our other systems don't provide way send hashed copy of password set password.

Youtube v3 api login android -

i cant find related login in here: https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/package-summary i want subscribe channels android app, guess need logged in user youtube account, how can that? or should use google sign in: https://developers.google.com/identity/sign-in/android/ thanks guidance,

node.js - MEAN-stack, organize structure for game logic -

i’m trying make simple card game (like hearthstone) using mean stack , socket.io game process. but have no idea how better organize structure of server-side . i have following structure: server/ models/ (database schema models) player.js card.js deck.js controllers/ player.js card.js deck.js routes/ (rest api) player.js card.js deck.js server.js (main) here has implemented manipulation players', cards' , decks' data using http-requests. but can't understand, have realize logic of game. have following questions: where should implement game logic player , cards, example, actions occur when 1 card attacking another? where should implement main part of game logic, includes player interaction (using socket.io), change of game state , on? upd: or (and) share github projects. thank , sorry english. you have implement logic in controllers. after action in front-end perform call server-side routes call function in control

Jumbotron padding of Bootstrap overriding my CSS -

the image in jumbotron has spaces around. when reduce padding in css, being overridden bootstrap css. !important not working. css file after bootstrap css. trying out lot on this! please help! thanks in advance html part: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link rel="stylesheet" href="css/styles.css"> <link href='https://fonts.googleapis.com/css?family=lora' rel='stylesheet' type='text/css'> <body> <header> --- navbar part </header> <div id="main-

Using Replace in Mysql with Regex -

i discovered # of records in table field seems have carriage returns. found them using: select field table field regexp "\r\n" i'd remove them using regex in replace did not work: update table set field=replace(field,regexp "\r\n",'') field regexp "\r\n" as aside have found several fields did not match regex query still show in memo field broken e..g queen anne vs queen ann is there other regex character should adding can search on any/all combinations , replace not getting space? you want replace() : update table set field = replace(field, '\r\n', '') field regexp '\r\n'; mysql should recognize '\r' , '\n' in string (see here ).

asp.net - Excel download date format changing in different time zone -

how, can keep date format same of excel @ time of download in different-2 time zone? my downloaded file contains date column format mm-dd-yyyy. issue that, while downloading excel file in region not converting dates different formats, while downloading same file in uk region, converting dates dd-mm-yyyy. date 12-01-2015 converting 01-12-2015. i want keep date format of excel file mm-dd-yyyy in regions. generating file using asp.net c#. thanks in advance. this because excel selecting different date format based on program's locale setting. imagine options are: a: change cell format need in each location, e.g. in vba code selection.numberformat = "m/d/yyyy;@" b: store date data in text format. literally text string in mm-dd-yyyy format. still parse later.

java - How to calculate the distance in meters between a geographic point and a given polygon? -

Image
first of all, i'm new gis, pardon mistakes. need discover distance between latitude , longitude point , latitude/longitude polygon (regular or not). precisely, need discover minimal distance given point point in polygon's boundary, illustrated below. in example, closer distance point p polygon d . note: don't need point, minimum distance. after reading, i've come following minimum working example using geotools api. however, think i'm messing in output. can enlight me on how minimum distance between point , polygon in mteres? mwe.java: import com.vividsolutions.jts.geom.coordinate; import com.vividsolutions.jts.geom.geometry; import com.vividsolutions.jts.geom.geometryfactory; import com.vividsolutions.jts.geom.point; public class mwe { public static void main(string[] args) throws exception { geometryfactory gf = jtsfactoryfinder.getgeometryfactory(); coordinate[] c = new coordinate[5]; c[0] = new coordinate(-49.242986, -

kernel - insmod: page allocation failure -

i'm trying experiment aimed @ measuring code execution times on generic linux. however, after insmod , dmesg , see insmod: page allocation failure , unable allocate memory times [25] . can give me idea? what's wrong code? seem gets trouble when tries malloc. #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/hardirq.h> #include <linux/preempt.h> #include <linux/sched.h> #include <linux/slab.h> #define size_of_stat 100000 #define bound_of_loop 1000 #define uint64_max (18446744073709551615ull) void inline measured_function(volatile int *var) { (*var) = 1; } void inline filltimes(uint64_t **times) { unsigned long flags; int i, j; uint64_t start, end; unsigned cycles_low, cycles_high, cycles_low1, cycles_high1; volatile int variable = 0; asm volatile ("cpuid\n\t" "rdtsc\n\t" "mov %%edx, %0\n\t"

c++ - QtGui5 not loaded -

i developing application in c++ , winapi , qt . application communicates through serial com ports. user can open multiple pairs of ports , opened port listens other port constantly. implement functionality use windows threads.there method named startread() reads other port , changes text area. void sendandreceive::startread(){ dword numread = 0; std::string hex; while (1) { char *buffer = (char *)malloc(sizeof(char) * 500); bool ret = readfile(porthandler, buffer, 500, &numread, 0); if (!ret) { std::string errormessage = ""; } buffer[numread] = '\0'; std::string receiveddata(buffer); qstring qdata(receiveddata.c_str()); if (ui->checkbox->ischecked()) { std::string receiveddata(buffer); hex= stringtohex(receiveddata); qstring qdata1(hex.c_str()); emit ashex(qdata1); } qstring qd

jquery - I want to change the + into - minus when related accordion -

hi want change + - when square clicked please see the js fidddle! https://jsfiddle.net/vklhfpxt/ $('.work-detail2, .work-detail3').hide(); $('.work-1').addclass('squar-active') $('.work-1').click(function(){ $('.work-1').addclass('squar-active'); $('.work-2,.work-3').removeclass('squar-active'); $('.work-detail1').show(500); $('.work-detail2, .work-detail3').hide(500); }); $('.work-2').click(function(){ $('.work-1,.work-3').removeclass('squar-active'); $('.work-2').addclass('squar-active'); $('.work-detail2').show(500); $('.work-detail1, .work-detail3').hide(500); }); $('.work-3').click(function(){ $('.work-1,.work-2').removeclass('squar-active'); $('.work-3').addclass('squar-active'); $(

python - Implement classes Square and Triangle as subclasses of class Polygon -

it overload constructor method init takes 1 argument(side length) , override method area computes area. came program, keeps saying "undefined name polygon". class square(polygon): 'square class' def __init__(self, s): 'constructor initializes side length of square' polygon.__init__(self, 4, s) def area(self): 'returns square area' return self.s**2 math import sqrt class triangle(polygon): def __init__(self, s): 'constructor initializes side length of equilateral triangle' polygon.__init__(self, 3, s) def area(self): 'returns triangle area' return sqrt(3)*self.s**2/4 if want inherit polygon , have define before define other classes inherit it. class polygon: def __init__(self): pass def area(self): raise notimplemented class square(polygon): 'square class' def __init__(self, s): 'c

ios - Swift - Preload other tab views from App Delegate -

so trying preload tab views app delegate save time on loading once user switching between tabs. i have tried running in view controller file uitabbarcontroller (specifically in viewdidload ) have had no luck. missing something? let = self.view if let viewcontrollers = self.viewcontrollers { viewcontroller in viewcontrollers { let = viewcontroller.view } } try instantiating view controller... first set storyboard id of view controller then: let storyboard = uistoryboard(name: "main", bundle: nil) let vc = storyboard.instantiateviewcontrollerwithidentifier("someviewcontroller") note: possible if put code in app delegate, view controller uninstantiated. if case, try putting code in first view controller.

algorithm - Find running minimum and Max in R -

i have vector of stock prices throughout day: > head(bidstock) [,1] [1,] 1179.754 [2,] 1178.000 [3,] 1178.438 [4,] 1178.367 [5,] 1178.830 [6,] 1178.830 i want find 2 things. algorithm goes through day. want find how far current point historical minimum , maxim throughout day. there function called 'mdd' in 'stocks' package finds maximum draw down throughout day (i.e. lowest value corresponds point being farthest historical maximum of day). however, don't want lowest value, want vector. have come code below that. however, need way how far point running historical minimum well. mddvec<-rep(na,1) (i in 1: length(bidstock)){ mddvec[i]<-mdd(bidstock[1:i]) } finally, typical price calculated (max(day) + min(day) + closing price)/3. there way make work running average using running historical min , max throughout day. thanks in advance you need cummmin , cummax cumulative minima , maxima, can calculate how far o

java - Why can't you place a print statement after a for loop with no parameters? -

this question has answer here: while(true); loop throws unreachable code when isn't in void 4 answers why can't place print statement after type of loop? don't understand what's going on. understand not standard way write loop. experimenting code because saw code somewhere. don't understand why can't place print statement @ end. public class test{ public static void main(string [] args){ for( ; ; ) { int x = 0; if (x < 5) { system.out.print(x + " "); x++; } } system.out.println("the end"); //this line not compile. } } for( ; ; ) same while(true) , since not breaking loop anywhere created infinite loop. so code placed after such loop never executed (will unreachable/dead code) , compiler informs problem since such situation wasn't inte

Delete option values in select block in HTML with Javascript -

i need delete option value tags inside select elements this: <select name="name"> <option value="something1">first</option> <option value="something2">second</option> </select> so need find way delete value="something" javascript, end : <select name="name"> <option>first</option> <option>second</option> </select> how javascript? find options using queryselectorall to remove attribute use removeattribute var options = document.queryselectorall('[name="name"] option'); for (var = 0, ilen = options.length; < ilen; i++) { options[i].removeattribute('value'); } <select name="name"> <option value="something1">first</option> <option value="something2">second</option> </select>

python - Multiple Count and Median Values from a Dataframe -

i trying perform several operations in 1 program @ same time. have data-frame has dates of have no clue of start , end , want find: total number of days data-set has total number of hours median of count write separate output median per day/date. if possible median-of-median in possible simple way. input: few rows large file of gb size 2004-01-05,16:00:00,17:00:00,mon,10766,656 2004-01-05,17:00:00,18:00:00,mon,12223,670 2004-01-05,18:00:00,19:00:00,mon,12646,710 2004-01-05,19:00:00,20:00:00,mon,19269,778 2004-01-05,20:00:00,21:00:00,mon,20504,792 2004-01-05,21:00:00,22:00:00,mon,16553,783 2004-01-05,22:00:00,23:00:00,mon,18944,790 2004-01-05,23:00:00,00:00:00,mon,17534,750 2004-01-06,00:00:00,01:00:00,tue,17262,747 2004-01-06,01:00:00,02:00:00,tue,19072,777 2004-01-06,02:00:00,03:00:00,tue,18275,785 2004-01-06,03:00:00,04:00:00,tue,13589,757 2004-01-06,04:00:00,05:00:00,tue,16053,735 the start , end date not known. edit: expected output:1 have 1 row of results

javascript - I need help finding an alternative to synchronous jQuery ajax -

i have complex form contains multiple tabs. each tab contains unique plupload instance (for uploading multiple images). form allows user upload medical image 'case' each case made of multiple imaging 'studies' (e.g. ct scans) , each study contains multiple images. when user clicks 'submit' button, intercept click jquery because need following: check required fields entered [easy] get unique id number server. id number required each plupload instance know directory upload to. in function called upon form submission have following code snippet: var case_id; // code check required fields entered .... // case id number server $.get('ajax/unique-case-id').done(function(data){ case_id = data; }); // case_id , other things. must happen after ajax call .... // if there problem uploading images, stop form submitting if (problem_occured) { return false; } with current logic, need script pause until gets case_id. possible before jquery

php - Using the event-manager with multiple 'attachments' -

i'm trying use zend event-manager , have attachments 2 classes. try trigger events , go thru every attached function. somehow i'm able receive 1 event , never other events. can please point me in right direction? // create event-manager public static function geteventmanager() { if(!self::$eventmanager) { self::$eventmanager = new \zend_eventmanager_eventmanager(); } return self::$eventmanager; } // attach event item\plugin::geteventmanager()->attach("item.getprovider", function($e) { $item = $e->getparam("item"); return $this; }); // attach event in class item\plugin::geteventmanager()->attach("item.getprovider", function($e) { $item = $e->getparam("item"); return $this; }); // events attached $results = self::geteventmanager()->trigger("item.getprovider", null, array("item" => $item), function($v) { return ($v instanceof item); }); if($results->st

swift - Accessing/Updating Nested Dictionary through Segues -

i'm having problem. i'm making app using swift choose continent through buttons on main view controller. takes second view controller countries of continent , populations show on text view. later add country , population third view controller using text fields, add information previews text view. adding respective continents. i have nested dictionary in first view controller. how add information third view , show on second view when data model on first view? this data model: var dictionary : [string: [string: int]] = [ "north america" : ["country1" : 0, "country2" : 0, "country3" : 0], "asia" : ["country1" : 0, "country2" : 0, "country3" : 0], "south america" : ["country1" : 0, "country2" : 0, "country3" : 0], "africa" : ["country1" : 0, "country2" : 0, "country3" : 0], "europe"

javascript - Webpack Babel loading error - Uncaught SyntaxError: Unexpected token import -

this question has answer here: babel file copied without being transformed 5 answers i'm new webpack , running problem following this tutorial . it seems webpack.config.js isn't setting babel-loader correctly i'm not sure.in console see following error: bundle.js:49 uncaught syntaxerror: unexpected token import which refers line import sortby 'lodash/collection/sortby'; of index.js . assume it's babel transpiling problem(not allowing import syntax of es6?) here complete index.js file import sortby 'lodash/collection/sortby'; import {users} './users'; import {user} './user'; sortby(users, 'name') .map(user => { return new user(user.name, user.age); }) .foreach(user => { console.log(user.display); }); and webpack.config.js looks this: module.exports = {

magento - Product model not returning description -

which reasons can have, when product model not returning description attribute? i tested several approaches: mage::getmodel('catalog/product')->loadbyattribute('sku', 'p001')->getdata(); mage::getmodel('catalog/product')->loadbyattribute('sku', 'p001')->getdata('description'); mage::getmodel('catalog/product')->loadbyattribute('sku', 'p001')->getdescription(); the getdata() method returns short_description, not description. think can't code fault, because in local environment , it's working. via git, have same codebase on stage server , it's not working anymore. can have edited attribute settings cause problem? (i couldn't find differences between short_description , description cause problem in opinion. edit: on stage page, descriptions shown in articles. to product details loading sku, use below code <?php $product_sku = "p001"; $pro

shell - Is it possible to use so = shellout("linux cmd") outside of Chef in ruby script? -

i'm curious, there possibility use shellout in ruby scripts outside of chef? how set this? gem install mixlib-shellout and in ruby script require 'mixlib/shellout' cmd = mixlib::shellout.new('linux cmd') cmd.run_command # , optionally, raise exception if command fails shell_out!() cmd.error! eta: if want avoid creating instance yourself, dump wrapper fucntion in scripts use it: def shellout(cmd, ok_exits = [0]) run = mixlib::shellout.new(cmd) run.run_command if run.error? || !ok_exits.include?(run.exitstatus) puts "#{cmd} failed: #{run.stderr}" exit 2 end run.stdout end

uwp - Get info about a line using Win2d C# -

Image
i'm drawing line win2d , c# uwp. infomation line such line length , list of points used create line. i've tried know , can't figure out solution. maybe i'm approaching wrong angle? can help? if have information start , end, can't apply this? length = (y1 - y2)^2 + (x1 - x2)^2

pouchDB retrieve allDocs original query -

i attempting load local pouchdb results website. once results loaded locally, don't want bother downloading them again. to avoid this, list of files exist, , test see if i've loaded in past before fetching it. function downloadfile($fname){ $query = { include_docs: false, attachments: false, startkey: ['run',$fname].join(','), endkey: ['run',$fname,'\uffff'].join(',') }; db.alldocs($query).then(function (result) { if ( result.rows.length !== 0 ) return; $url = './rundb/' + $fname + '/results.xml'; $.ajax({ url: $url, type: "get", datatype: "xml", contenttype: "text/xml", async: true, success: function (results,status,xhr) { app.parseresults($fname,results)

Matching Data from Different columns / dataframes - Working in R -

here sample data dataset id name reasonforlogin 123 tom work 246 timmy work 789 mark play dataset b id name reasonforlogin 789 mark work 313 sasha interview 000 meryl interview 987 dara play 789 mark play 246 timmy work two datasets. same columns. uneven number of rows. i want able 1)"i want of id numbers appear in both dataseta , datasetb" or 2)"i want know how many times 1 id logs in on day, day 2." so answer 1) list [246, 789] 2) data.frame "header" of ids, , "row" of login numhbers. 123, 246, 789, 313, 000, 987 0, 1, 2, 1, 1, 1 it seems easy, think non-trivial large data. planned on doing loops-in-loops, i'm sure there has term these kind of comparisons , packages similar things. if have a first data set , b second, , id character

c++ - Is there a C++11 strncmp alternative that performs as well? -

i want prefix in string. have been using this: if (s.substr (0, 7) == "prefix_") ... while works, relatively slower strncmp , shown test: #include <iostream> #include <chrono> #include <string> #include <string.h> int main () { std::string s = "prefix_this passing test match"; auto t0 = std::chrono::high_resolution_clock::now (); (int = 0; < 1000000; i++) if (s.substr (0, 7) == "prefix_") ; auto t1 = std::chrono::high_resolution_clock::now (); (int = 0; < 1000000; i++) if (! s.compare (0, 7, "prefix_", 0, 7)) ; auto t2 = std::chrono::high_resolution_clock::now (); (int = 0; < 1000000; i++) if (! strncmp (s.c_str (), "prefix_", 7)) ; auto t3 = std::chrono::high_resolution_clock::now (); std::cout << "[1] s.substr (0, 7) == \"prefix_\" " << std::chrono::duration_cast<std::chrono::micro

css - Flex direction: row-reverse in react-native -

Image
how can reproduce flex-direction: row-reverse in react-native? when in element' style i'm doing: flexdirection: 'row-reverse' i'm getting error: invalid prop flexdirection of value row-reverse supplied stylesheet update: added it in version 0.29.0 :) update as of v29, react native provides support reverse flex directions in android , ios. https://github.com/facebook/react-native/releases/tag/v0.29.0 original answer there no row-reverse or column-reverse in react-native. see table of supported attributes : https://github.com/facebook/css-layout

Django Registration Redux: Add Fields To User Profile error -

i trying add extended fields user, save user info not field in new table. this model: class userprofile(models.model): field = models.charfield(max_length=3) user = models.onetoonefield(user, unique=true) here form: class userprofileregistrationform(registrationformuniqueemail): field = forms.charfield() regbackend.py class userregistrationview(registrationview): form_class = userprofileregistrationform def register(self, request, form_class): new_user = super(userregistrationview, self).register(request, form_class) new_user.field = form_class.cleaned_data['field'] new_user.save() user_profile = new_user.get_profile() user_profile.field = form_class.cleaned_data['field'] user_profile.save() return user_profile and urls.py urlpatterns = patterns('', url(r'^$', index_view), url(r'^accounts/register/$', regbackend.userregistrationview.as_view()

vb.net - load data from datagridview with ms access -- Always get same information -

i have problem loading data datagridview ms access : dim dt datatable = new dbconnect().selectdata(string.format("select client.clientid, client.clientname, client.clientaddress, client.clientphone, client.clientcredit client ", datagridview1.selectedrows)) this code gets information on first item in access database file . i need that, when click on row gives me information , not information of item.

android - How do you run react-native app in production mode? -

i thought react-native run-android --dev=false , doing doesn't stop developer menu showing when shake phone , request url packager has dev=true in url params. it's in dev menu under settings option. key have reload js. can verify in packager output dev=false .

Double google anaylatics on my template? -

i'm not coder though i've learned alot board. friend set template me work from. there 2 versions of google anaylatic script in there , i'm not sure use? <script> (function(b,o,i,l,e,r){b.googleanalyticsobject=l;b[l]||(b[l]= function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new date; e=o.createelement(i);r=o.getelementsbytagname(i)[0]; e.src='//www.google-analytics.com/analytics.js'; r.parentnode.insertbefore(e,r)}(window,document,'script','ga')); ga('create','ua-xxxxx-x','auto');ga('send','pageview'); </script> or.... <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]|| function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date(); a=s.createelement(o), m=s.getelementsbytagname(o)[0]; a.async=1;a.src=g;m.parentnode.insertbefore(a,m)

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. although there portions of answer apply usage of the mail() function itself, many of these troubleshooting steps can applied php mailing system. th