Posts

Showing posts from February, 2013

How to make multitenancy with pentaho -

i'm using pentaho ee 6.1, , i'd setup data source specific user, i'v seen in link https://help.pentaho.com/documentation/6.1/0r0/070/multi-tenancy don't undersand how make it. please. question not clear. had same issue sometime , sharing research , understanding. in data integration have option called parameterised connection , in way can achieve multitenancy due pentaho architecture of bi server we can't achieve same in bi server . can achieve in bi server through stored procedure 1 of way.

ios - consecutive statements on a line must be separated by '; ' swift -

hello i'm trying make app convert human years cat years , having trouble button tap show cat year. @ibaction func findage(_ sender: anyobject) { var enteredage = age.text var myint: 13 = int(enteredage) var catyears = enteredage * 7 print(age.text) } on var myint: 13 = int(enteredage) 2 errors 1 title of question , other says "expected type" running xcode 8 beta. var myint : int = int(enteredage) ; error unhelpful in swift debugging, el captain pointed out, info following : in swift should object type.

java - SELECT DISTINCT + ORDER BY in JPA 2 Criteria API -

i've class lawsuit , contains list<hearing> , each 1 date attribute. i need select lawsuit s ordered date of hearing s i've criteriaquery like criteriabuilder cb = em.getcriteriabuilder(); criteriaquery<lawsuit> cq = cb.createquery(lawsuit.class); root<lawsuit> root = cq.from(lawsuit.class); i use distinct flatten results: cq.select(root).distinct(true); i join lawsuit hearing join<lawsuit, hearing> hearing = root.join("hearings", jointype.inner); to create predicate s predicatelist.add(cb.isnotnull(hearing.<date>get("date"))); and order s: orderlist.add(cb.asc(hearing.<date>get("date"))); everything works fine if avoid distinct , if use it, complains not being able order based on fields not in select: caused by: org.postgresql.util.psqlexception: error: select distinct , order by expressions must appear in select list the list<hearing> acces

android - Access In App Purchase Plugin in Ionic 2 -

i making small ionic 2 app learning framework , want test in app purchase plugin (cordova plugin add cordova-plugin-inapppurchase). my plugin list $ ionic plugins list cordova-plugin-console 1.0.3 "console" cordova-plugin-device 1.1.2 "device" cordova-plugin-inapppurchase 1.0.0 "in app purchase" cordova-plugin-splashscreen 3.2.2 "splashscreen" cordova-plugin-statusbar 2.1.3 "statusbar" cordova-plugin-whitelist 1.2.2 "whitelist" ionic-plugin-keyboard 2.2.1 "keyboard" so seams plugin installed correctly. i've read access cordova plugins via cordova.plugins.myplugin.afunction() in controller coded following print accessible plugins: this.platform.ready().then(() => { console.log(cordova.plugins); }); when deploy app on android device holds keyboard-function. have idea how use , access in app purchase plugin? thank you. i have not tried came across may helpful yesterday. you mu

winforms - BeginInvoke() giving errors in my C# code -

i trying implement begininvoke() in code , came across part throwing error. private void showpiclensplot() { if (piclensplot.invokerequired) { piclensplot.begininvoke(new action<control, bool>(showpiclensplot, piclensplot, true)); } else { piclensplot.bringtofront(); } } the error methodname expected above source code has been converted c# vb , online tool used to this. piclensplot private system.windows.forms.picturebox piclensplot; this should work: if (piclensplot.invokerequired) { piclensplot.begininvoke(new action(() => showpiclensplot())); } else { piclensplot.bringtofront(); }

ruby - Mechanize / Nokogiri failing to parse XML with xpath -

i receive xml file api. i'm trying parse mechanize receives xml file. underlying nokogiri. whatever can't seem return xpath variables. seems recognise xml file fine i.e comes in mechanize::xmlfile , shows elements if use nokogiri. i can run. xml.at("/") and response, other .at or .search run returns nil. e.g. xml.at("//duration") an example response below. @body = "<jobsearchresults xmlns:i=\"http://www.w3.org/2001/xmlschema-instance\" xmlns=\"http://schemas.aspiremediagroup.net/jobboard/1.0/beta\"><duration>p0dt0h0m0.328s</duration><jobcount>0</jobcount><jobids /><jobs /><pagecount>0</pagecount><pageno>0</pageno><pagesize>20</pagesize><proximitystats i:nil=\"true\" /><rolesuggestions><string>adding</string></rolesuggestions><search><accountgroupids i:nil=\"true\" /><accoun

Invalid Reset Password Token ASP.NET C# -

i generate reset password token in 1 request, when want reset password in next request, says invalid token. public async task<string> getresettoken(string userid) { var token = await _usermanager.generatepasswordresettokenasync(userid); return token; } public async task<identityresult> resetpassword(string userid, string token, string newpassword) { var result = await _usermanager.resetpasswordasync(userid, token, newpassword); return result; } these 2 functions called respective api endpoints. flow of whole process is: enter email on website the api generates token , email gets sent reset link the reset link takes reset password page the page hits api again reset password everything works except step 4, because api comes invalid token. i've checked token being generated same token received in step 4.

android - BottomSheet fly away with visibility change -

Image
i have bottom sheet nestedscrollview inside (see below). when press on fab button, want make parts in nestedscrollview invisible. when change linearlayouts visibilities gone, bottomsheet fly aways top. see here: you can whole code https://github.com/tanrikut/bottomsheetexample my change visibility method: private void changevisibility() { subtitlelayout.setvisibility(view.gone); coordinatelayout.setvisibility(view.gone); timelayout.setvisibility(view.gone); } my nestedscrollview xml: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.nestedscrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" app:behavior_peekheight="120dp" app:layout_behavior=&

javascript - Replace specific part of src attribute into an iframe element -

is there way replace specific part of src attribute iframe element? i have iframe google blog working on... <iframe allowtransparency='true' id='reactions-iframe' class='reactions-iframe' expr:src='data:post.reactionsurl' frameborder='0' name='reactions' scrolling='no'/> when blog loads src attribute becomes this... src="https://www.blogger.com/blog-post-reactions.g?options=%5blike,+dislike%5d&textcolor=%23000000#http://www.blog-name.com/post-name.html" so, when blog loads want replace part textcolor=%23000000# textcolor=%23ffffff# example. how can using javascript or jquery? add onload event iframe: <iframe allowtransparency='true' id='reactions-iframe' class='reactions-iframe' expr:src='data:post.reactionsurl' frameborder='0' name='reactions' scrolling='no' onload='changesrc();'/> and in changesrc() funct

connect Braintree php sdk with yii -

how can connect braintree php sdk yii .i have placed sdk files in component folder , calling main file in controller like: include yii::app()->basepath.'/components/braintree/lib/braintree.php'; but shows error me include(braintree_configuration.php) : failed open stream: no such file or directory .can me? standard practise include third party library in yii (1.x) put code under protected/vendors directory, i.e. protected/vendors/braintree . then include file in code this. yii::import('application.vendors.*'); require_once('braintree/lib/braintree.php'); make sure have provided read permissions braintree folder.

mercurial - How do I make BitBucket recognize line breaks in commit comments? -

i work mercurial, , use long(ish), multi-line commit comments. recently, i've put project on bitbucket.org, , have noticed when commit comments appended issue pages (see this question information on how/when happens), newlines replaced spaces, while double-newlines stay double-newlines. how should mark single-newlines in commit messages bitbucket acknowledges them? i'd in least-obtrusive way when read comments command line. break paragraphs (generating <p> tags) blank line. break lines (generating <br> tag) ending first line 2 or more spaces, e.g. line one␣␣ line 2 bitbucket formats comments using markdown , has this paragraphs , line breaks : paragraphs , line breaks a paragraph 1 or more consecutive lines of text, separated 1 or more blank lines. (a blank line line looks blank line — line containing nothing spaces or tabs considered blank.) normal paragraphs should not indented spaces or tabs. the implication of "one o

javascript - jquery - add event listener to dynamically created button -

i've tried multiple solutions none worked , don't understand why... basically, have button appends new form line page, name, start , colour fields , save button. what need save form fields on save click. here's code i'm trying use it's not working: var = 0; var addcounter = $("#addcounter"); addcounter.on("click", function () { ++i; var body = $("body"); var save = $('#save-' + i); var name = $("#countername-" + i); var date = $("#counterstart-" + i); var color = $("#countercolor-" + i); var status = $("#status-" + i); var templatetoappend = '<li class="list-group-item">' + '<div class="form-inline">' + '<div class="form-group">' + '<label for="countername-' + + '">counter name</label>' + '<input t

Transfer C# array to PHP to show in browser -

hy everyone, have problem can't solve. i've searched answers haven't find usefull answer. have c# code insert mysql database values, want retrieve select. array want display web browser through php because need things array. c# code use transfer array php: while (reader.read()) { int numbers = 0; if (!reader.isdbnull(reader.getordinal("numbers"))) { numbers= reader.getint16("numbers"); } num n = new num(numbers); list.add(n); } var result = string.join(",", list); string urladdress = "http://localhost/number.php"; using (webclient client = new webclient()) { namevaluecollection postdata = new namevaluecollection() { { "result", result} }; string pagesource = encoding.utf8.getstr

Javascript array assinging to variable gets undefined -

hello trying draw few images .so @ first made group(i think function part of plugin using thats no matter) made array store name , src of several images , calling loop draw images thing got no results @ no errors nothing try alert "b.name" , "b.src" result got undefined explain me problem cuz me seems var mapgroup = new group(); var mapvillage = [ {name: "leaf", src: "js/leaf.png"}, {name: "sand", src: "js/sand.png"}, {name: "stone", src: "js/stone.png"}, {name: "cloud", src: "js/cloud.png"}, {name: "mist", src: "js/mist.png"}, {name: "rain", src: "js/rain.png"}, {name: "grass", src: "js/grass.png"}, {name: "sound", src: "js/sound.png"},

javascript - Web Audio API: Clicks on volume change with slider -

for application makes 1 able determine ones tinnitus frequency, following scenario occurs: a user 'mousedown' html5 slider -> oscillator @ frequency started. moving handle user can change volume of note. here (coffeescript-)code responsible whole audio processing: # coffescript tuner element # enables playing notes via web audio api class @tuner constructor: () -> @playing = false @whobbling = false @stopping = false @atvolumechange = false @atfadein = false @activebtn = undefined if typeof audiocontext isnt "undefined" @audioctx ?= new audiocontext() else if typeof webkitaudiocontext isnt "undefined" @audioctx = new webkitaudiocontext() else console.log "browser hat keine webaudioapi" # make sure listener set correct: listener = @audioctx.listener listener.setorientation(0,0,-1,0,1,0) listener.setposition(0,0,0) # create pannernode , set l , r @pann

r - Pvalue and Xquared is N/A in Box-Ljung test -

box-ljung test data: x-squared = na, df = 20, p-value = na. pvalues , xsquared coming n/a, data values not have zero if take example : v <- data.frame(c(12,45,48,31,12,7,78), rnorm(7, mean = 45, sd = 2), c(1,0,0,1,0,0,1), c(0,1,0,0,0,1,0), c(0,0,1,0,0,0,0), c(0,0,0,0,1,0,0)) colnames(v) <- c("col1","col2","alpha","beta","gamma","delta") box.test(v$col1, lag = 20, type = "ljung-box", fitdf = 0) we : box-ljung test data: v$col1 x-squared = na, df = 20, p-value = na now, change our lag. box.test(v$col1, lag = 1, type = "ljung-box", fitdf = 0) box-ljung test data: v$col1 x-squared = 0.30832, df = 1, p-value = 0.5787 i think lag (20) higher length of time series. let's take example : x <- data.frame(rnorm(28000, sd = 0.3), rnorm(28000, mean = 1, sd = 0.3),

excel - Use a macro for sorting VBA -

i importing data txt file excel how looks : licence: md2 approval: granted id: 42fb1010c6b1ed82-0a292138.1 client: ch-w-7000361 username:asd licence: cai approval: granted id: 42fb1010c6b1ed82-0a292138.1 client: ch-w-7000361 username:qwe so goes 1 multiple entries of same licence different approval's etc what want is: filter data , give structure should like: guidance on 'rule' how want order source data. once licence should appear licence approval (granted / not granted) id / client / username how should like: licence: edr approval: granted client: pf-w-12365 approval: not granted client: qt-b-7000361 client: c-s-7000361 i have done pivot table automate macro my code have done this sub order() dim dickey string dim dicvalues string dim dic dim data data = range("a1:d100") 'load data variable creatobject("scripting.dictionary") = 1 ubound(data) if .exists(data(i, 1)) 'test see if key e

jquery - How can I modify with css an image appended with javascript? -

i have appended image javascript using function looked this: function show_image(src) { var img = document.createelement("img"); img.src = src; document.body.appendchild(img); } now when try modify style in css: img{ //style attributes etc. } the picture not react. how can fix this? changing css in javascript solution: add css in function: function show_image(src) { var img = document.createelement("img"); img.src = src; document.body.appendchild(img); $(document).find(img).css(here add styles); } example : $(your element).css("color", "red"); reference

hadoop2 - Process multiple folders in Apache spark -

i have 100 folders. each folder contains 5 files. have executable process 1 folder. executable black box , hence cannot modified.i process 100 folders in parallel using apache spark should able span map task per folder. can give me idea? have came across similar questions hadoop , answer use combinefileinputformat , pathfilter. however, said, want use apache spark. idea?

plsql - Grant truncate privilege to some tables of different user in Oracle -

how grant truncate privilege tables of different user in oracle , same ..how can in oracle 11 g..anyone please on this create procedure can truncate table, create or replace procedure do_truncate (tab_name in varchar2) begin execute immediate 'truncate table '||tab_name||';'; end; / grant execute on do_truncate dave;

android - Espresso checking if toasts are displayed (one on top of another) -

i have problem checking if toast displayed using espresso. i'm using class: import android.os.ibinder; import android.support.test.espresso.root; import android.view.windowmanager; import org.hamcrest.description; import org.hamcrest.typesafematcher; public class toastmatcher extends typesafematcher<root> { @override public void describeto(description description) { description.appendtext("is toast"); } @override public boolean matchessafely(root root) { int type = root.getwindowlayoutparams().get().type; if ((type == windowmanager.layoutparams.type_toast)) { ibinder windowtoken = root.getdecorview().getwindowtoken(); ibinder apptoken = root.getdecorview().getapplicationwindowtoken(); if (windowtoken == apptoken) { // windowtoken == apptoken means window isn't contained other windows. // if window activity, have type

php - How to install xdebug in ubuntu 16.04 in netbeans? -

whenever try run code example@testserver:~$ sudo apt-get install php5-xdebug reading package lists... done building dependency tree reading state information... done e: unable locate package php5-xdebug i error "e: unable locate package php5-xdebug" please thanks if you're running default apt installation of php on ubuntu 16.04, should php7. if had guess php5-xdebug , i'd using command intended ubuntu 14.04 or older default php installation php5. can verify php version with: php --version this see: php 7.0.8-0ubuntu0.16.04.2 (cli) ( nts ) copyright (c) 1997-2016 php group zend engine v3.0.0, copyright (c) 1998-2016 zend technologies zend opcache v7.0.8-0ubuntu0.16.04.2, copyright (c) 1999-2016, zend technologies xdebug v2.4.0, copyright (c) 2002-2016, derick rethans at rate, should able search available packages configuration with: apt-cache search xdebug from relatively fresh ubuntu 16.04 install without added ppa's

sed delete unmatched lines between two lines with bash variable -

i need understanding weird problem sed, bash , while loop. my data looks this: -file 1- csv account,hostnames,status,ipaddress,port,user,pass -file 2- xml - sample record set 2 entries under 1 account <accountname="account"> <cname="fqdn or simple name goes here"> <field="hostname">ahostname or ipv4 goes here</field> <protocol>aprotocol</protocol> <field="port">aportnumber</field> <field="username">ausername</field> <field="password">apassword</field> </cname> <cname="fqdn or simple name goes here"> <field="hostname">ahostname or ipv4 goes here</field> <protocol>aprotocol</protocol> <field="port">aportnumber</field> <field="username">ausername</field> <field="password">apassword</field> </cname> </accountname>

php - json_encode not working with strip_tags -

i want insert input list json looks strange. use strip_tags fix memory leak. here code , outputted json code: <?php echo '<meta charset="utf-8">'; include_once('libs/simplehtmldom/simple_html_dom.php'); $html = file_get_html('https://hugo.events/event/2017'); // find links foreach($html->find('ul#eventlandinlineuplist') $element) $encoded = strip_tags($element); echo json_encode($encoded); and json has been outputted: "\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfedde le grand\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkensington\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttyphoon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsunday sun\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbl\u00d8f\n\t\t\t\t\t\t\t\t\t\t\t\t\t" i hope can me. in advance you can use trim() remove whitespace there.

How to read in OTHER file with read.csv in R, if first file is not found? -

i using r read in file, therefore use read.csv. files come dataset , tagged date. however, dates missing. date x, want read in file "x". because files missing, r gives me "error in file(file, "rt") : cannot open connection". instead, want r automatically read in file "x-1" if "x" nonexistent (or "x-2" if "x-1" nonexistent etcetera) . thus, looking kind of "iferror" statement around this. not find kind of statement, know how detect "rt" , act on it? regards, margot

database - MySQL - Display multiple rows in one field (tables with inner joins)q -

i have mysql database 3 tables, 1 table called fixturechannels, 1 called footballfixtures, , 1 called satellite. basically satellite table contains information satellite channels (name, country, channelid), footballfixtures contains (matchid, hometeam, awayteam, competition....), , fixturechannels table containing (matchid, , channelid, these linked foriegn keys satellite , footballfixtures table respectively). below further details on tables: tablelayouts i used following query below, , worked, able echo details need table "select * fixturechannels inner join footballfixtures on fixturechannels.matchid=footballfixtures.matchid inner join satellite on fixturechannels.channelid=satellite.channelid"; the code used echoing details is: <tbody><tr> <th>match id</th> <th>home team</th> <th>away team</th> <th>competition</th> <th>date</t

vb.net - Error Converting VB code to C# -

so had old vb code in winforms thought convert c# using telerik online converter. post conversion , facing issue not gettinf resolved. the vb code here private sub plotlensprofilethreadfunction() dim errorflag errorflagtype = initerrorflag() dim inmedia graphics = me.piclensplot.creategraphics dim plotref new plotlensprofilethread() try plotref.threadingrphref = inmedia plotref.threadinconcavepaths = concavepaths plotref.threadinconvexpaths = convexpaths plotref.threadplotoptions = plotoptions.profileview plotref.threadstepsixdata = jobdata.stepsixdata plotref.threadstepfivedata = jobdata.stepfivedata plotref.threadstepfourdata = jobdata.stepfourdata plotref.threadstepthreedata = jobdata.stepthreedata plotref.threadsteptwodata = jobdata.steptwodata plotref.errorflag = errorflag plotref.meridianconcave = meridianconcave plotref.meridianedge = meridianedge plo

for loop counting issue in php -

i have 2 loop fetching questions database.questions associated parameter. there 3 parameters having different number of questions. doing is- for($j=0; $j<count(parameter); $j++) { echo parameter[$j]['name']; for($m=0; $m<count($question); $m++) { echo $m.'. '$question['description']; } } its output is: location correct address , contact details of asc, in company systems, website & sms tool , matching. contactability on landline & mobile no of asc facilities ventilation, lighting, power backup & airconditioning of asc infotainment system drinking water & new paper avm look & feel, color code of asc, parameters glow sign board uniforms notice board in waiting area per latest guidelines location ,facilities,avm parameters having 2-3 questions listing 1,2 again 1,2,3 1,2,3,4 want 1,2,3,4 9 counting try below code $count = 1; for($j=0;$j<count(parameter);$j++){ echo parame

oracle - How to optimise this SQL Query -

this query taking more 4 minutes , want make run more quickly. please provide suggestions select * fact_acct zz zz.c_acctschema_id=1000000 , zz.postingtype ='a' , trunc(zz.dateacct,'dd') between to_date('2016-01-01','yyyy-mm-dd') , to_date('2016-01-01','yyyy-mm-dd') , z_id_cpt_to_val(account_id) <= z_id_cpt_to_val(1001508) , z_id_cpt_to_val(account_id) >= z_id_cpt_to_val(1001508) the function z_id_cpt_to_val () cause of problem, it's run in sql queries, take long time because if retire last 2 lines ,this sql give results in 3 secondes so, ideas optimise that thanks without plan , ddl on table assumption. first assumption you have index on fact_acct.dateacct, trunc(fact_acct.dateacct,'dd') - not use index trunc(fact_acct.dateacct,'dd') trim hour/ minutes/ seconds part. can use zz.dateacct >= between to_date('2016-01-01','yyyy-mm-dd') <to_date('2016-01-0

laravel - Calling the controller i'm in : not found -

i'm trying implement paypal api namespace app\http\controllers; use paypal; use redirect; class paypalpaymentcontroller extends controller{ private $_apicontext; public function __construct() { $this->_apicontext = paypal::apicontext( config('services.paypal.client_id'), config('services.paypal.secret')); $this->_apicontext->setconfig(array( 'mode' => 'sandbox', 'service.endpoint' => 'https://api.sandbox.paypal.com', 'http.connectiontimeout' => 30, 'log.logenabled' => true, 'log.filename' => storage_path('logs/paypal.log'), 'log.loglevel' => 'fine' )); } public function getcheckout() { $payer = paypal::payer(); $payer->setpaymentmethod('paypal'); $amount = paypal:: amount(); $amount->setcurrency('eur'); $amount->settotal(500); // simple

bash - Passing a command as a variable to a function in Unix -

can pass command variable function? if yes, syntax? my code looks like. function1(){ in $1 echo $a done } function2(){ function1 "ls -lrt folder/name | grep 'foo' | grep 'bar'" } but doesn't work. tried passing as: function1 `ls -lrt folder/name | grep 'foo' | grep 'bar'` but passes first value of command (and understand why happens). does know syntax pass command function variable? as indicated in comments, using $1 contain first parameter. instead, need use $@ . from bash manual → 3.4.2 special parameters : $@ ($@) expands positional parameters, starting one. when expansion occurs within double quotes, each parameter expands separate word. is, "$@" equivalent "$1" "$2" …. if double-quoted expansion occurs within word, expansion of first parameter joined beginning part of original word, , expansion of last parameter joined last part of original word.

Interactive output directory r -

is there function/package in r allows choose output folders going stored? wrote script reads several xlsx files , store them folders in computer. use script in several computers, cannot use path <- "c:/users/dev/desktop/test/" since change every time. tried path <- choose.dir(default = "", "choose output path") but don't output. this code: setwd(dirname(rstudioapi::getactivedocumentcontext()$path)) library(xlsx) library(tcltk) #get file names f = list.files("./") #read files dat <- lapply(tk_choose.files(caption="choose files"), function(i) { x <- read.xlsx(i, sheetindex = 1, sheetname = null, startrow = 24, endrow = null, as.data.frame = true, header = false, filters = filters[c("xlsx")]) #return columns names , colors x <- x[, c(2, 5, 7, 9, 11, 13, 15, 17, 19), drop = false] #return data x }) library(plyr) df1 <- ldply(dat, data.frame

Ionic switch between tabs with parameters -

i have app tabs, first tab show latest post , input search user can filter results. when user makes search, want switch second tab, manage search , display results. want keep first tab showing latest post. the code switching second tab is: $scope.search_posts = function() { if ( !angular.isundefined($scope.searchtext) && $scope.searchtext.length > 2 ) { $scope.searchtext = ''; $scope.show_search_box = false; $ionictabsdelegate.select($ionictabsdelegate.selectedindex() + 1); } else { $ionicloading.show({ template: 'you must write @ least 3 characters long.', nobackdrop: false, duration: 2000 }); } } ...but not know how send 'searchtext' parameter when switching. how can accomplish this? you use $rootscope store shared data: $scope.search_posts = function() { if ( !angular.isundefined($scope.searchtext) && $scope.searchtext.length &

Java Generics Type DSL with Builder Pattern -

i try create dsl java api builder pattern on generics type. i have following class: public class rule<t> { private predicate<t> condition; public conditionbuilder<t> when() { return new conditionbuilder<>(this); } //setter , getter } and following conditionbuilder class: public class conditionbuilder<t> { private rule<t> parent; public conditionbuilder(rule<t> parent) { this.parent = parent; } public conditionbuilder<t> condition1() { parent.setcondition(l -> l == 0); // integer return this; } public conditionbuilder<t> condition2() { parent.setcondition(l -> l.length() > 3); // string return this; } } i try find solution set generic type on fly integer (resp. string) condition1 (resp. condition2). is there pattern or solution avoid doing instanceof checking ? you can't member methods on conditionbuilder<t> , since you've constr

python 2.7 - Distributed TensorFlow example doesn't work on TensorFlow 0.9 -

i'm trying out this tensorflow distributed tutorial same operating system , python version on own computer. create first script , run in terminal, open terminal , run second script , following error: e0629 10:11:01.979187251 15265 tcp_server_posix.c:284] bind addr=[::]:2222: address in use e0629 10:11:01.979243221 15265 server_chttp2.c:119] no address added out of total 1 resolved traceback (most recent call last): file "worker0.py", line 7, in <module> task_index=0) file "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/server_lib.py", line 142, in __init__ server_def.serializetostring(), status) file "/usr/lib/python2.7/contextlib.py", line 24, in __exit__ self.gen.next() file "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors.py", line 450, in raise_exception_on_not_ok_status pywrap_tensorflow.tf_getcode(status)) tensorflow.python.framework.errors.internalerror: not start

c# - How do i launch media files like mp4 using my app -

Image
this question has answer here: how play .mp3 (or other) file in uwp app? 4 answers how launch media files mp4 or mp3 using uwp application, when right click on associated file mp4 file can able open app, or when double click on it....any ideas looks question how open app file association, , file format .mp3 or .mp4. to this, can refer this blog , need declare in apps manifest , handle event first in app's onfileactivated method. so when right click on associated file mp4 file can able open app since trying open file "right click", not "double click", app should shown in "open with..." options, app not shown, can find selecting "more apps", , find app , open file app. there no problem unless double click file, double clicking, open file using default app. , can set default app in settings -> default a

Invoke-Sqlcmd not working in SQL -

im using following command in sql powershell generate csv of data returned sql. invoke-sqlcmd -query "myp" -serverinstance "." | export-csv -path "d:\data\mydatabasesizes.csv" -notypeinformation the above command works fine in sql power shell. when tried run in sql using following code declare @cmd varchar(1000) set @cmd = 'invoke-sqlcmd -query "myp" -serverinstance "." | export-csv -path "d:\data\mydatabasesizes.csv" -notypeinformation' exec xp_cmdshell @cmd it give error that 'invoke-sqlcmd' not recognized internal or external command, anyone please me in running command sql. thanks xp_cmdmshell executes windows shell commands, not powershell commands. can of course call powershell within windows shell, example this: declare @cmd varchar(1000) set @cmd = 'invoke-sqlcmd -query ''myp'' -serverinstance ''.'' ^| export-csv -path ''d:\data\

multithreading - Running multiple threads concurrently in java -

i have run 2 threads concurrently 1 prints numbers 1 500 whereas prints numbers 501 1000. output must show concurrency. try below code. main thread prints numbers 1 500 , other thread prints there on 1000. public class test implements runnable{ public static void main(string[] args) throws exception { thread t = new thread(new test()); t.start(); (int = 1 ; <=500 ; i++) system.out.println("main thread printing "+i); } @override public void run() { (int i=501; <=1000 ; i++) system.out.println("thread 1 printing "+i); } }

java - Configure build-in the Jackson MapDeserializer -

i have project spring mvc , wanna invoke method "setignorableproperties" mapdeserializer globally, dont know how class objectmapper, can me? thx advice. see it, that: @override public void extendmessageconverters(list<httpmessageconverter<?>> converters) { mapdeserializer.getcontenttype(); converters.foreach(httpmessageconverter -> { if (httpmessageconverter instanceof mappingjackson2httpmessageconverter) { mappingjackson2httpmessageconverter converter = (mappingjackson2httpmessageconverter) httpmessageconverter; objectmapper mapper = converter.getobjectmapper(); mapdeserializer mapdes = mapper.(what have invoke?) ; mapdes.setignorableproperties({"@id", "@ref"}); } }); } that property not meant configured directly; need use @jsonignoreproperties annotation map -valued properties. can create convenience annotation, if want, by: @retention(retentionp

ios - Firebase: linking user UID to database -

Image
i'm trying use current users uid unique identifier store associated user data there user uid in realtime database i.e. ref.child("user/uid"): example: when user creates account added authentication section of firebase console , lets user fills in form i.e first name, last name, dob etc. how link data user uid in realtime database. when register new user need first register code: firauth.auth()?.createuserwithemail(useremail, password: userpassword, completion: { (user, error) in on success response can set user more details use dictionary , use setvalue method adding child using following code: ref.child("users").child(user!.uid).setvalue(["provider": self.txtpassword.text!,"email": self.txtemail.text!,"firstname": self.txtfname.text!,"lastname": self.txtlname.text!,"phone": self.txtphone.text!,]) here user!.uid unique user id child in main user tree. so firebase tree : and s

android - okhttp3 - how to control network usage (upload throttling) -

i trying upload image using okhttp3 library. what happens that, when upload starts, okhttp takes available bandwidth making impossible make other connection app or other app. my code is: progressrequestbody filebody = new progressrequestbody( requestbody.create(mediatype.parse(getmimetype(sourcefile)), sourcefile), new progressrequestbody.listener() { @override public void onprogress(int progress) { //update progress } }); requestbody requestbody = new multipartbody.builder() .settype(multipartbody.form) .addformdatapart("key", key) .addformdatapart("file", sourcefile.getname(), filebody) .build(); request request = new request.builder() .url(global.server_url + "upload") .addheader("authorization", global.g_userinfo.getsessionid()) .post(requestbody) .build(); response response = okhttpclient.newcall(request).execute(); responsestring = response.body().

How to start or wakeup azure webjob from sharepoint designer workflow -

i have azure web-job deployed in azure , set run on-demand. want run web-job designer workflow when field value matches. so, there approach on how trigger job sharepoint designer workflow ? thanks in advance! i not familiar capabilities of sharepoint side, assuming can make http post request, trigger webjob via webjob api: http://chriskirby.net/blog/running-your-azure-webjobs-with-the-kudu-api

c++ - Best way to do flattening of nested getter result inside getter -

sometimes have task of finding if nested getter inside value returned getter has property. classic c++ like: for (const auto& label: labels) (const auto& artist: label.artists()) if (artist.name = "arcade fire") return true; return false; what best way ranges? think may work: labels| transform (&label::artists) | join | transform(&artist::name) | join | find_if_fn([](){/*...*/}) ; but quite long, (partially because instead of .member_fn must write class:member_fn. there shorter way this? i think this: using namespace ranges; auto rng = labels | view::transform(&label::artists) | view::join; return find(rng, "arcade fire", &artist::name) != end(rng); gets job done in straightforward way. view::filter formulation: using namespace ranges; auto rng = labels | view::transform(&label::artists) | view::join | view::filter([](const artist& a){ return a.name() == "arcade fire"; }); r

location.href in double quote : Laravel 5.2 -

my code select below <select id="ddllanguages" class="form-control"> @foreach($languages $language) <option onchange="location.href = {!! url('tr/' . '/' . $language->lid) !!}" value="{!! $language->languageid !!}">{!! $language->language !!}</option> @endforeach </select> this produces below html <select id="ddllanguages" class="form-control"> <option onchange="location.href = http://localhost/learning/public/translation/1" value="1">english</option> <option onchange="location.href = http://localhost/learning/public/translation/2" value="2">french</option> </select> problem part "location.href = http://localhost/learning/public/translation/1" missing formatting in url. can guide me correct path?

sql server - Grouping and sum in sql -

Image
i trying extract following columns sql table called vouchers: date, voucherid, valueissued, valueredeemed, valueexpired that bit straight forwards , returns below data: however show them by day, by voucherid and sum values each individual voucherid produce view similar below: can point me in correct direction in regards sql code this? i using ssms 2014 it's pretty straight forward select posdate, voucherid, sum(valueissued), sum(valueredeemed) vouchers group posdate, voucherid note column dateexpired isn't correct in context. should either grouped or removed entirely (as did)

how to change element of struct in a list c#? -

this question has answer here: changing value of element in list of structs 4 answers public struct rectangle { public decimal a; } that struct , have list of struct rectangles list<rectangle> datarectangle= new list<rectangle>(); now have added structs list change value of struct present in list datarectangle[0].a=0; it says cannot modify return value ' list<form4.rectangle>.this[int] ' because not variable help why coming , there way modify a struct value type . in contrast reference type class don't pass around references instance, pass around value itself. so returned indexer datarectangle[0] not reference struct copy of struct . , it's passed on stack no variable itself. to solve this, can either declare rectangle class (which prefer mutable type: public struct rectangle { public dec

linux - split scp of backup files to different smb shares based on date -

i backup files tar files once day , grab our ubuntu servers using backup shell script , put them in share. have 5tb shares can have several. at moment need more backup 30 days worth of tar files. i need method first 10 days go share one, next ten share tow, next 11 share three currently each server vm runs following script backup , tar folders , place in folder ready grabbed backup server !/bin/bash appname=myapp.com dbname=mydb dbuser=mydbuser dbpass=mydbpass datestamp=`date +%d%m%y` rm -f /var/mybackuptars/* > /dev/null 2>&1 mysqldump -u$dbuser -p$dbpass $dbname > /var/mybackups/$dbname-$datestamp.sql && gzip /var/mybackupss/$dbname-$datestamp.sql tar -zcf /var/mybackups/myapp-$datestamp.tar.gz /var/www/myapp > /dev/null 2>&1 tar -zcf /var/mydirectory/myapp-$datestamp.tar.gz /var/www/html/myapp > /dev/null 2>&1 i grab backups using script on backup server , put them in share #!/bin/bash # # generate list of myapps gra

pandas - How to convert datetime.time columns in dataframe to string -

i've been struggling convert 2 columns in pandas. frame contains many columns, , 2 columns dates: 'datelog'(is date) , 'timeofday' (is time). column datelog string. column timeofday datetime.time() format. dateframe display folows: datelog timeofday 0 30-apr-15 14:15:43 1 30-apr-15 14:16:13 2 30-apr-15 14:16:43 3 30-apr-15 14:17:13 4 30-apr-15 14:17:43 5 30-apr-15 14:18:13 6 30-apr-15 14:18:43 7 30-apr-15 14:19:13 8 30-apr-15 14:19:43 9 30-apr-15 14:20:13 my goal concatenate these 2 column use them index timeseries. can point me in right direction? i think can use create index: df.index = df['datelog'] + ' ' + df['timeofday'].astype(str)

java - Android layout with oblique bottom -

Image
how can achieve kind of layout bottom line sideways : i have no idea how can achieved. use relativelayout . in - first place imageview of background image birds, in same relativelayout place white triangle image align parent bottom, , thats )

default values for 13 fields mysql -

so have database schema below (3 tables) , whole purpose of map nutrient fact table package. thing is, want have @ 13 fields in nutrient fact table each package should have (even if they're empty), current schema works entries contain data. how can assign 13 default component name package (along unit of measure , daily value)? create table packageid( packageid int not null primary key ); create table component( componentid int not null primary key, component_name text ); create table product_component( packageid int, componentid int, amount varchar(7), unit_of_measure varchar(7), daily_value varchar(7), foreign key (componentid) references component(componentid), foreign key (packageid) references package(packageid) );

Laravel dd() equivalent for Cake PHP -

i know if there equivalent method laravel method dd() cake php. if don't know, dd() dump given variable , end execution of script. thanks you. try adding prd() function bootstrap.php function prd($var) { pr($var); die; } source: http://debuggable.com/posts/make-your-life-easier-with-these-five-cakephp-quicktips:48170ee5-0cc0-4815-af60-7c264834cda3 you add cakephp/app/config/helpers.php