Posts

Showing posts from January, 2011

c# - How to compute the angles between 2 vectors, to proceed to a rotation? -

i have 2 vectors same origin, , rotate 1 match other. however, can't find math able compute x angle, y angle , z angle (world coordinates) between two. work angles in local coordinates, don't know if helps rotation around forward vector (local y) can doesn't matter. need object facing right direction. how ? there many ways approach this. let me first suggest cross product , easier understand alternatives (like quaternions) , might point in right direction. basically cross product between 2 vectors ( a , b ) results in third vector ( c )which perpendicular both. interesting note, length of third vector length(a)*length(b)*sin(theta) , theta angle between a , b . here looks like: c.x = a.y * b.z - a.z * b.y c.y = a.z * b.x - a.x * b.z c.z = a.x * b.y - a.y * b.x a simple formula. now trick is, normalize a , b . means set length 1. done taking vector , dividing each component it's length length_a = sqrt(a_old.x * a_old.x + a_old.y * a_old.y +

reactjs mobx without decorators not working -

i trying incorporate mobx react . since spawned application using create-react-app , can't use decorators given mobx. given can use mobx without decorators per documentation: https://mobxjs.github.io/mobx/best/decorators.html here's component created: import react, { component } 'react'; import observer 'mobx-react'; export const testcomponent = observer(class testcomponent extends component { render() { return <div>just test component!</div> } }); here's simple calling of above component: import react, { component } 'react'; import './app.css'; import auth './auth' import { testcomponent } './test' import muithemeprovider 'material-ui/styles/muithemeprovider'; import appbar 'material-ui/appbar'; import authstore './stores/store' class app extends component { constructor(props) { super(props); this.state = { } } render()

vba - Loop through dependent list selections and print out -

i have data validation drop down list 77 different selections need monthly report. vba newbie found code prints out selected option in folder, selection cell a1 (aka"strategy"). add loop through code automatically prints different selections seperate pdfs same folder. current code is: sub pdfactivesheet() dim ws worksheet dim myfile variant dim strfile string dim sfolder string on error goto errhandler set ws = activesheet 'enter name , select folder file ' start in current workbook folder strfile = ws.range("a1").value & " strategy output " & ws.range("j1").value sfolder = getfolder() if sfolder = "" msgbox "no folder selected. code terminate." exit sub end if myfile = sfolder & "\" & strfile ws.exportasfixedformat _ type:=xltypepdf, _ filename:=myfile, _ quality:=xlqualitystandard, _

javascript - Script 105 Unterminated string constant -

i have following code: $( "td.cell" ).hover(function() { if(condition) $(this).append($("<span> cell disabled </span>"));}, function() {$(this).find("span:last").remove();}); basically want span shown when cell table disabled. weird stuff on 1 computer working ff, on different computer ie , ff giving unterminated string constant. tried concatenate span "../sp"+"an.." doesn't work. when inspect element code looks this: $( "td.cell" ).hover(function() {if(true) $(this).append($("<span> cell disabled //--></span>"));}, function() {$(this).find("span:last").remove();});

c# - Convert a Bitmap to a Texture2D in Unity -

i'm in scenario i'm manipulating bitmaps using aforge.net in unity. however, bitmap can't applied texture in unity, visibly can see output, how done? i believe have use memorystream, in fashion unknown me. i managed achieve using memorystream, i.e.: memorystream msfinger = new memorystream(); bitmapcurrentframered.save(msfinger, bitmapcurrentframered.rawformat); redcamera.loadimage(msfinger.toarray()); redfilter.getcomponent<renderer>().material.maintexture = redcamera; with bitmapcurrentframered being bitmap, redcamera being texture2d , redfilter being gameobject(plane) used view output.

sencha touch - Visa Checkout Cordova Plugin -

the visa checkout sdk available native apps (ios & android). can find visa checkout cordova plugin integrating hybrid mobile apps ? i suggest use visa checkout javascript sdk: https://github.com/visa/samplecode/wiki/visa-checkout

How to list filenames from a folder using Jquery and AJAX -

i had googled lot topic , got code solution. when i'm running code in browser error part running , alert being generated. success part never runs. i'm running code on browser no servers or localhost installed on system. i had required folders used in code , file. code follows: <!doctype html> <html lang="en"> <head> <title>load demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"> </script> <script type = "text/javascript" language = "javascript"> $(document).ready(function () { var fileextension=".jpg"; var dir="images/"; $.ajax({ type: 'get', url: dir, async:false, success: function (data) { $("#filenames").htm

c++ - Exception safety of std::vector implementation shipped with Visual Studio 2015 -

consider following program: #include <iostream> #include <vector> #include <type_traits> struct x { int state; x() : state(0) {}; x(int x) : state(x) {}; x(x const& y) noexcept : state(1) {} x(x&& y) noexcept(false) : state(y.state != 8 ? 2 : throw 1) { y.state = 0; } x& operator =(x const&) = default; x& operator =(x&&) = default; }; int main() { std::vector<x> a; a.reserve(2u); a.emplace_back(6); a.emplace_back(8); try { // #### std::cout << 'a' << a.front().state << a.back().state; } catch (...) { std::cout << 'b' << a.front().state << a.back().state; } return 0; } at position // #### different statements may employed, each giving different output on g++/clang++ versus msvc. statement g++ msvc expected 1 a.resize(10u, x{}); a11 b08

c# - An unhandled exception occured when updating ObservableCollection list -

im trying load data webservice sfdatagrid using parameters onnavigatedto first loads dummy row grid because can´t data onnavigatedto yet runs onnavigatedto , gets data webservice , gose adding data observablecollection grid has itemssource set to using prism.commands; using prism.mvvm; using prism.navigation; using system; using system.collections.generic; using system.collections.objectmodel; using system.componentmodel; using system.linq; namespace prismunityapp2.viewmodels { public class hovedsideviewmodel : bindablebase, inotifypropertychanged , inavigationaware { mobileservice.vaksserviceclient ws = new mobileservice.vaksserviceclient(); inavigationservice _navigationservice; public event propertychangedeventhandler propertychanged; private datetime selecteddate; public datetime selecteddate { { return selecteddate; } set { if (selecteddate != value) { selecteddate = value;

AngularJS: Iterating over object properties and two way binding -

i want loop on object's property. also, there should two-way data binding change change object well. both key , value of object property can changed ui , should reflect in object's structure. i able object's value ng-model="contents[index]" but how object property key e.g. interface in object change if change on ui. $scope.contents = { "interface": "gigabitethernet", "interfacenumber": "1", "bgpneighborip": "00.0.112.499", "bgpremoteas_[1]": "701", "bgpneighborip_[2]": "8.3.112.170", "bgpremoteas_[2]": "702" } <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <tbody> <tr ng-repeat="(index, p1) in contents"> <td> <input class="form-control" type

php - password reset table column name override laravel 5 -

hello friends have modified password reset table column name 'created_at' instead of 'created'. if changing column name 'created' on migration, getting error column not found 'created_at'. \vendor\laravel\framework\src\illuminate\auth\passwords\databasetokenrepository.php protected function getpayload($email, $token) { return ['email' => $email, 'token' => $token, 'created_at' => new carbon]; } this file coming column name 'created_at' can override function please suggest me.. i think i've found way without touching vendor directory. for laravel 5.2 create class extends illuminate\auth\passwords\databasetokenrepository overwrite getpayload() method there create class extends illuminate\auth\passwords\passwordbrokermanager overwrite resolve() method return new passwordbroker token repository step 1 open config/app.php , comment out passwordresetserviceprovider providers arra

javascript - Very slow loop in angularjs -

i use loop create map markers (1000 points): var markers = {}; (var = 0; < items.data.data.length; i++) { latval = items.data.data[i].lat; lngval = items.data.data[i].lng; ikona = icons.infost; message = "<b>" + items.data.data[i].name + "</b>"; markers[i] = {'group': 'cmp', 'lat' : eval(latval), 'lng' : eval(lngval), 'icon' : ikona, 'message' : message}; } $scope.markers = markers; how can improve loop speed in angularjs (currently takes 10s)? there few things can improve code speed avoiding eval , caching loop variables , arrays well. caching values, reduce bunch of operations member access , unecessary calculations. var items = { data: { data: [] }}; var icons = { infost: 'infost'}; (var = 0; < 1000; i++) { items.data.data.push({ lat: ''+i, lng: ''+i, name:''+i }); } console.time('time'); /// code starts

php - WooCommerce Subscriptions - Action hook not triggered on renewal -

i have made custom function adds account funds (£40) user's account when subscription payment successful. the problem have hook doesn't seem trigger, when renewell happens funds not added account. i enabled debugging in woocommerce , pushed renewal manually within cron management, when function works , funds added account. here function (functions.php); add_action('processed_subscription_payment', 'custom_add_funds', 10, 2); function custom_add_funds($user_id) { // current user's funds $funds = get_user_meta( $user_id, 'account_funds', true ); // add £40 $funds = $funds + 40.00; // add funds user update_user_meta( $user_id, 'account_funds', $funds ); } ----- solved ----- i needed memory limit on wordpress, ipn url fatal errored/exhausted you should try different approach using 2 different hooks (and $subscription object representing subscription has received payment) : the first hook

r - how to ensure libsbml.pc is in PKG_CONFIG_PATH -

i'm trying install biggr bioconductor package. got following errors, i'm unable resolve: could not detect libsbml (>= 3.0) via pkg-config. rsbml requires libsbml http://www.sbml.org/software/libsbml/. please ensure libsbml.pc in pkg_config_path. failed find parsemessage.h indicating libsbml 2.x not installed. specify include path manually use --with-libsbml-include or libsbml_include. please me out. thanks you kiran whole script: bioclite("biggr") bioc_mirror: https://bioconductor.org using bioconductor 3.4 (biocinstaller 1.24.0), r 3.3.2 (2016-10-31). installing package(s) ‘biggr’ installing dependency ‘rsbml’ trying url 'https://bioconductor.org/packages/3.4/bioc/src/contrib/rsbml_2.32.0.tar.gz' content type 'application/x-gzip' length 634510 bytes (619 kb) ================================================== downloaded 619 kb trying url 'https://bioconductor.org/packages/3.4/bioc/src/contrib/biggr_1.10.0.tar.gz' c

java - How to exclude a jar from changing the name given by ivy retrieve pattern? -

i have following ivy retrieve pattern: <ivy:retrieve pattern="${ivy.lib}/[module]-[type]-[revision].[ext]"/> which adding "jar" every jar name after downloading. like, findbugs-1.3.7 , make findbugs-jar-1.3.7 . cobertura jar, don't want change name. , don't see "exclude" tag in tag. there way it?

javascript - Start html5 video within an owl.carousel -

i'm building males fashion site slider have both images , video in it. i'm using owl.carousel slider. video plane html5 video tag. i'm trying start video whith jquery this: $('#video')[0].play(); it works when video outside slider/carousel, how start inside? codepen link i codepen. after few tests, saw 2 containers class video-slider video tag same id "video" inside. (check debug console on render view , jquery code $(".video-slide").children() ). you can start videos jquery code $(".video-slide").children().each(function() { this.play(); }); before need find , why blocks duplicated. i hope helps

r - Vector Autoregressive Models for Multivariate Time Series : Trend and Seasonality -

i have 3 time series , want predict future values each of them. using vars ! package in r. so approach: decompose multiplicative time series , take out trend, seasonality, , random part. time_series1_components = decompose(time_series1,type="mult") do time series. apply var model on random parts , predict future values: random_part1 = time_series1_components$random random_part2 = time_series2_components$random random_part3 = time_series3_components$random merged_df = ts.union(random_part1, random_part2,random_part3, dframe = true) merged_mat <- data.matrix(merged_df) merged_mat = na.exclude(merged_mat) checklag = varselect(merged_mat) estimatemodel=var(merged_mat, p = 2, type = "const", season = null, exogen = null) summary(estimatemodel) roots(estimatemodel) predict(estimatemodel)` now, should combine predicted values of random part trend , seasonality. , plot graph showing past values , predicted values (highlighted separately). how can achi

SQL Server 2012 Ansi Warnings and SSRS -

when query or stored procedure run form ssrs, ansi warnings setting off - connection takes defaults values server properties. is there way determinate ansi warnings on current user (not entire server) define in connections ? sql server 2012

Installing existing jar to local maven repository using maven-ant-task -

i want install old library local maven repository using maven-ant-task. while mvn install:install-file -dfile=path/to/lib/a2jruntime.jar -dgroupid=ki -dartifactid=a2jruntime -dversion=x -dpackaging=jar terminal working fine , mvn clean package succeed. the following ant-task fails with: install-libs-to-maven-repo: [artifact:mvn] [info] build successful create-metadataeditormodule-jar: [artifact:mvn] [info] building ktidodo-metadata 0.1-snapshot [artifact:mvn] [info] ------------------------------------------------------------------------ [artifact:mvn] downloading: http://repo1.maven.org/maven2/ki/a2jruntime/x/a2jruntime-x.pom [artifact:mvn] [warning] pom ki:a2jruntime:jar:x missing, no dependency information available [artifact:mvn] downloading: http://repo1.maven.org/maven2/ki/a2jruntime/x/a2jruntime-x.jar [artifact:mvn] [info] ------------------------------------------------------------------------ [artifact:mvn] [info] build failure [artifact:mvn] [info] --------------

java - Spring cloud stream to support routing messages dynamically -

i want create common project (using spring cloud stream) route messages different (consumer) projects dynamically according message content. (rabbitmq message broker) does spring cloud stream support it? if not, proposed way accomplish that? thx you can achieve setting spring.cloud.stream.dynamicdestinations property list of destination names (if know name beforehand) or keeping empty. binderawarechannelresolver takes care of dynamically creating/binding outbound channel these dynamic destinations. there out of box router application available similar thing.

dns - Linking domain via cloudflare to google cloud -

oke here situation: i have bought domain registrar(hostnet) , hosting on google cloud. now want link domain bought hostnet via cloudflare google cloud. i changed nameservers of registrar use cloudflares nameservers. , on cloudflare changed records point google cloud external ip-address. the site works fine on google pagespeed insight see 'delay in server response' i'm thinking im doing wrong. haven't done on google cloud seems more redirect(slow) rather correct implementation. that mean link domain name ip address.. seems off. what correct way connect domain hostnet google cloud via cloudflares cdn.

javascript - HTML-Bootstrap: How to make collapsible text appear under its own button -

i using bootstrap use collapsible text. using 2 button collapsing , corresponding collapsible text. problem text appearing @ end of buttons instead of appearing after respective buttons. here trying when clicking buttons (text appear below button): ------------ | button-1 | ------------ text button-1 ------------ | button-2 | ------------ text button-2 but here getting: ------------ | button-1 | ------------ ------------ | button-2 | ------------ text button-1 here code have written: <h2>simple collapsible</h2> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#text1">button-1</button><br/> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#text2">button-2</button> <div id="text1" class="collapse"> text should appear under butt

php - How to write a python script to call a API and print the results retrieved from the API -

i beginner , new coding. have api in php gives meteo data retrieved meteo station. want have python script call api , print results api in file. please suggest me right coding approach. api is: http://ewodr.wodr.poznan.pl/doradztwo/swd/meteo_api.php?dane= {"token":"pcss","id":303,"operacja":"odczyt_doba"} use urllib2 library (for python 2) fetch data api. this: import urllib2 import csv # api url url = "your api url" # open api url response = urllib2.urlopen(str(url)) data = response.read() # write results in csv file open('file.csv', 'wb') f: f.write(data) or if json import json import urllib2 # api url url = "your api url" # open api url response = urllib2.urlopen(str(url)) data = json.load(response) # write results in csv file open('file.tx

How can I transfer the keys to the NPM program -

i have in package.json "scripts": { "webplugin_default": "export node_env=default&& export node_minified=false&& webpack", "webplugin_custom": "export node_env=custom&& export node_minified=false&& webpack", }, but want convenience not run $ npm run webplugin_default # or $ npm run webplugin_custom i want to $ npm run webplugin --theme custom # or $ npm run webplugin # set default theme how can that?

rest - Axis 1.7.2 and restful webservices -

i have developed soap based webservices using axis2 1.7.2. have used pojo methodology. requirement support standard crud methods restful webservices. due legacy support, supporting both soap based webservices restful webservices . i able support crud operation using following tutorial : http://wso2.com/library/3726/ this article archieved. have following questions in regard : a) there latest updated crud support restful webservices in axis 2 1.7.2 or later ? b) if have follow, above article methods, have generate wsdl pragmatically , edit it. great if can leads on this. c) please suggest better way in axis2 ( cannot throw away axis2 )

c# - WCF Service - Return Class Object With Class Name -

i creating wcf web service below interface [operationcontract] [webinvoke(method = "post", uritemplate = "documentdispatchpolicyno", responseformat = webmessageformat.json, bodystyle = webmessagebodystyle.wrappedrequest)] list<dispatchdocument> documentdispatchpolicynopost(string correlationid, string policynumber); my function in svc file is public list<dispatchdocument> documentdispatchpolicynopost(string correlationid, string policynumber) { list<dispatchdocument> rinfo = new list<dispatchdocument>(); ..... return rinfo; } my output is { "add": "ashirwad-59 4th floor, flat 4-b tc road, new ali pur kolkata 700053 pin-west benga", "chequeamount": "0.00", "chequedate": "", "chequenumber": "", "dept": "pos", "dispatchdate": "

mbaas - buddy platform - implementing a friend system -

i'm making simple app uses 'buddy platform' backend (mbaas) the platform allows user creation via api call: buddy.createuserasync(username, password); i have 'friend' relationship between users, if user 'a' has user 'b' friend, can send them information. is supported 'buddy platform'? or should manually developped around regular services?

unit testing - How to make NUnit 3 test adapter and console runner read a specific application config file -

i have couple of test assemblies depends on shared configuration file. in nunit 2.6 possible load "x.nunit" project file in console runner after console runner load "x.config" automatically. apparently not happen in nunit 3.5 - how can force console runner use specific config file? the same applies test adapter: in nunit 2.6 possible load "x.nunit" project file in gui-runner. not possible nunit 3.5 project files not (yet) supported in gui. apparently way go use vs 2015 test adapter run tests inside visual studio - have same problem again of not being able load right configuration file. there way specify specific configuration file when running tests inside vs?

spring cloud stream - Custom jdbc driver for jdbc-source-XXX application -

i'm trying use ms sql driver jdbc app local data flow server jdbc --url='jdbc:sqlserver://server' --driver-class-name=com.microsoft.sqlserver.jdbc.sqlserverdriver as expected, driver not in classpath , cannot load driver class: com.microsoft.sqlserver.jdbc.sqlserverdriver when deploying stream. i tried invoke data flow server -cp argument: java -cp "c:\path\to\msjdbc.jar " -jar spring-cloud-dataflow-server-local-1.0.1.release.jar - same result. can resolve ? thanks the local dataflow server spawns app in separate process , doesn't use classpath resources app. hence, think need add driver jdbc app path. or, can try setting classpath local deployer deployment property app when deploying stream. when specifying spring.cloud.deployer.local.classpath property, property spring.cloud.deployer.local.main needs specified. stream create a1 --definition "time | jdbc" stream deploy a1 --properties "app.jdbc.spring.cloud

java - How to generate ContextMenu Items Dynamically at run time? -

Image
i'm creating music player app , want display names of available playlists when user want add song playlist, in contextmenu . so whole scenario is: when user long presses on song, contextmenu having 1 of options named add playlist shown. when user clicks menu item, contextmenu having options create new playlist , names of playlist available (if any) shown. snap shot: now problem is, show names of stored playlists, think have generate menu items dynamically @ run time. code of adding menu items is: @override public void oncreatecontextmenu(contextmenu menu, view v, contextmenu.contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); if(contextmenuflag){ menu.setheadertitle(songtodisplay); menu.add(menu.none, play_song, menu.none, "play"); menu.add(menu.none, add_to_play_list, menu.none, "add playlist"); } else{ contextmenuflag = true; menu.setheadertitle("add

c# - How to save data from an array -

i'm making simple application save school grades , displays when requested. how can save data not have reenter every time application run? split problem lesser ones: how save item to string in file how read ( parse ) item from string (line) of file? in case school grades int s: int[] grades = new int[] {2, 3, 4, 5, 2}; the answers questions above can item.tostring() , int.parse(line) , can put file .writealllines(@"c:\mydata.txt", grades .select(grade => grade.tostring())); and int[] grades = file .readlines(@"c:\mydata.txt") .select(line => int.parse(line)) .toarray();

ios - Xcode error ITMS-90168 "The binary you uploaded was invalid" -

i updated xcode (8.1), application loader (3.0). tested app in iphone 7 (ios 10.1.1) , worked perfectly. i validated on xcode , when try upload application loader, attached error shown. i don’t anymore. need launch app! 1 package(s) not uploaded because had problems: /var/folders/f0/ty8cz9t14l7dmc3nqzt5l_xh0000gn/t/ab062b43-adf0-47ba-a0cf-40353441cdab/1167082332.itmsp - error messages: error itms-90168: "the binary uploaded invalid." the problem aplication loader; version old; uninstal xcode , reinstall last version , send again app

Setting minOccurs and maxOccurs in XSD based on value of other XML field? -

i have xsd validate xml file. structure follows: <root> <child> <size>2</size> <childelement>element 1</childelement> <childelement>element 2</childelement> </child> </root> the number of childelement s dependent on size provided i.e. if size set 3, not more 3 childelement s can added. i have tried using xs:alternative not seem work: <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="root"> <xs:complextype> <xs:sequence> <xs:element name="child" minoccurs="1" maxoccurs="unbounded"> <xs:complextype> <xs:sequence> <xs:element name="size" type="xs:integer" maxoccurs="1"/> <xs:element name="c

java - Three specific letters random generated from array -

i want make class can generate 3 random letters array 12 times. i'm having trouble random requesting int instead of char. help! :) first, need define alphabet string alphabet = "aabb..." , contains valid characters. code can this: public char generaterandomletterfromalphabet(string alphabet) { random random = new random(); return alphabet.charat(random.nextint(alphabet.length())); } here, nextint(alphabet.length()) returns random index between 0 , length of alphabet string, random character of alphabet returned generaterandomletterfromalphabet . note random generates pseudo-random numbers. of course, alphabet can defined array, too. here have function generate specified number of random characters alphabet character array: public char[] generaterandomlettersfromalphabet(char[] alphabet, int numberofletters) { if (numberofletters < 1) { throw new illegalargumentexception( "number of letters must

objective c - How to get the Topleft, TopRight coordinates (corners) of a CIImage in iOS (Obj-C) -

i try value of topleft of ciimage, impossible see is... when print ciimage, can see informations : (i print value in self.cameraview.lastcorrecteduiimage in irlscannerviewcontroller). <ciimage: 0x170009440 extent [0 0 768 502]> crop [0 0 767.499 501.021] extent=[0 0 767.499 501.021] warpkernel _perspectivecorrection(a1=[0.320876 -0.610103 0.683767],a2=[1.48175 0.21446 0.259627],a3=[0.183574 -0.0464235 1],rect=[0 0 767.499 501.021]) extent=[-112.259 -138.573 1060.3 864.268] color_matrix r=(0.24225 0.815556 0.082194 0) g=(0.24225 0.815556 0.082194 0) b=(0.24225 0.815556 0.082194 0) a=(0 0 0 1) bias=(-0.07 -0.07 -0.07 0) extent=[0 0 750 1000] affine [1 0 0 -1 0 1000] extent=[0 0 750 1000] colormatch "quicktime 'nclc' video (1,1,6)"-to-workingspace extent=[0 0 750 1000] iosurface 0x170008d70 bgra8 extent=[0 0 750 1000] i like, @ least, access perspectivecorrection...

wit.ai - The wit/number entity appears for almost all numbers, without a role, even though only wit/numbers with roles are defined -

it seems if allow wit/number in app, wit/number show when don’t want to. in no cases (out of 1,000 expressions) have set or want wit/number without role, keeps suggesting wit/number without role, when want number part search query. should give , create new role wit/number called “wit/number:inches” , add in part of search_query; or there way keep 98” part of search_query? here's image example query , training set

ruby - Python - Round Robin file move -

i trying create python script moves files in round robin dir has least amount of files in files equally distributed source dir 2 target dir's. for example: if c:\test contains: test_1.txt test_2.txt test_3.txt test_4.txt i want these test_1.txt , test_3.txt moved c:\test\dir_a , test_2.txt , test_4.tx moved c:\test\dir_b. i have been able in ruby, when try in python when script runs moves files dir least least amount of files in instead of distributing them in round robin. here ruby example: require 'fileutils' def check_file watchfolder_1 = 'f:/transcoder/testing/dir_a/' watchfolder_2 = 'f:/transcoder/testing/dir_b/' if !dir.glob('f:/transcoder/testing/prep/*.txt').empty? dir['f:/transcoder/testing/prep/*.txt'].each |f| node_1 = dir["#{watchfolder_1}"+'*'] node_2 = dir["#{watchfolder_2}"+'*'] nc_1 = node_1.count nc_2 = node_2.count load

java - ArrayIndexOutOfBoundsException:-1 -

i'm coding rl behaviors on pacman bot , messed things 1 of lists in 1 of functions arg_allmax or chooseaction here code of class: package rl; import java.util.arraylist; import java.util.hashtable; public class qlearn { private double epsilon = 0.1; // epsilon parameter epsilon greedy strategy private double alpha = 0.2; // alpha parameter: used influence o refresh of q private double gamma = 0.9; // used notice or not feedback of next action ; if =0 -> no feed private int actions[]; private hashtable< tuple<integer,integer>, double> q; // q(s,a) : hashtable : <state,action> -> value of q public qlearn(int[] actions) { this.actions = actions; q = new hashtable< tuple<integer,integer>, double>(); } public qlearn(int[] actions, double epsilon, double alpha, double gamma) { this.actions = actions; this.epsilon = epsilon; this.alpha = alpha; this.gamma = gamma; q = new hashtable< tuple<int

html - Google adsense-div size not match with official size -

i want use google adsense in website. size of div 240*240,and ad of google 250*250. wondering how when ad size not match div. thank helping me. most of google ads fits in parent div, don’t wonder fix div size google ads can perform better to earn revenue use following ad units 300x250, 300x600, 336x280 or 728x90 don’t waste time , effort in less performing ad units

r - Trying to create a function for a 3-component normal mixture distribution -

i trying create r function generate samples 3-component normal mixture distribution 3 different parameters keep getting error messages. here current code normal.mixture = function(n, mu1, sig1, w1, mu2, sig2, w2, mu3, sig3, w3) { p = c(w1, w2, w3) x=vector(mode="numeric", length=n) (i in 1:n) { j = sample(c(1,2,3), 1, prob=p) if (j==1) { x[i] rnorm(1, mu1, sig1) } else if (j==2) { x[i] = rnorm(1, mu2, sig2) } else { x[i] = rnorm(1, mu3, sig3) } } x } think you're missing equals sign if (j==1) { x[i] = rnorm(1, mu1, sig1) }

python - Kafka consumer: AttributeError: 'list' object has no attribute 'map' -

i want read messages kafka queue in python. example, in scala it's quite easy do: val ssc = new streamingcontext(conf, seconds(20)) // divide topic partitions val topicmessages = "mykafkatopic" val topicmessagesmap = topicmessages.split(",").map((_, kafkanumthreads)).tomap val messages = kafkautils.createstream(ssc, zkquorum, group, topicmessagesmap).map(_._2) messages.foreachrdd { rdd => //... } i want same in python. current python code: from pyspark.streaming import streamingcontext pyspark.streaming.kafka import kafkautils ssc = streamingcontext(sc, 20) topicmessages = "mykafkatopic" topicmessagesmap = topicmessages.split(",").map((_, kafkanumthreads)).tomap messages = kafkautils.createstream(ssc, zkquorum, group, topicmessagesmap) however error @ line topicmessagesmap = topicmessages.split(",").map((_, kafkanumthreads)).tomap : attributeerror: 'list' object has

java - Not able to make click event in android data binding -

view.java package com.espresso.mvvmtestproject; import android.content.context; import android.databinding.databindingutil; import android.support.v7.app.appcompatactivity; import android.os.bundle; import com.espresso.mvvmtestproject.databinding.activitymainbinding; public class view extends appcompatactivity implements viewcontract.requiredmethods{ viewmodel mmodel; activitymainbinding binding; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //setting layout binding = databindingutil.setcontentview(this, r.layout.activity_main); mmodel=new viewmodel(getcontext()); binding.setuser(mmodel); binding.sethandlers(new myhandlers()); } @override public void ondestroy() { super.ondestroy(); } @override public context getcontext() { return view.this; } } viewcontract.java public interface viewcontract { inte

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. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need