Posts

Showing posts from August, 2015

Django jquery ajax remote validate returns TypeError: Cannot read property 'apply' of undefined -

i trying validate 1 field of form using jquery & validate.js in django. i've read many posts, regardless of various examples, fails on same error. simply use remote method included in plugin. last 1 hit , simplest code sample, same result: jquery.validate.js:1594 uncaught typeerror: cannot read property 'apply' of undefined. exception occurred when checking element id_client_code, check 'remote' method. @ function.$.ajax (jquery.validate.js:1594) @ $.validator.remote (jquery.validate.js:1529) @ $.validator.check (jquery.validate.js:777) @ $.validator.element (jquery.validate.js:492) @ $.validator.onfocusout (jquery.validate.js:300) @ htmlinputelement.delegate (jquery.validate.js:423) @ htmlformelement.dispatch (jquery-3.2.1.slim.min.js:3) @ htmlformelement.q.handle (jquery-3.2.1.slim.min.js:3) @ object.trigger (jquery-3.2.1.slim.min.js:3) @ object.simulate (jquery-3.2.1.slim.min.js:3) here views.py section remote, returns false expected when called...

android - Picasso, image not shown -

i using class implements googlemap.infowindowadapter. i want show image loaded internet inside info window: @override public view getinfocontents(final marker m) { //carga layout personalizado. view v = inflater.inflate(r.layout.info_windows_origen, null); string info = m.gettitle(); string direccion = m.getsnippet(); string url = m.getsnippet(); ((textview)v.findviewbyid(r.id.info_window_nombre)).settext("punto de partida"); ((textview)v.findviewbyid(r.id.info_window_placas)).settext(info); ((textview)v.findviewbyid(r.id.info_window_estado)).settext(direccion); imageview imgprofile =(imageview)v.findviewbyid(r.id.info_window_imagen); sharedpreferences prefs = getapplicationcontext().getsharedpreferences(misdatos, context.mode_private); string imagen = prefs.getstring("imagen", "por_defecto@email.com"); log.d("boton origen ...

python - Imgur API: Dictionary values magically turns into None? -

i know voodoo magic isn't cause of - sure seems it! i have following code snippets, making use of imgur api. imgur object client imgur api uses , contains attribute credits displays number of access credits user has on website. imgur = imgurpython.imgurclient(client_id, client_secret) calling: imgur.credits returns credits normal, i.e.: {'clientlimit': 12500, 'userreset': 1503185179, 'userlimit': 500, 'userremaining': 0, 'clientremaining': 12000} however when attempt call dictionary in later function: def check_credits(imgur): ''' receives client - , if there not credits left, wait until credit refills - i.e. pause program ''' credits = imgur.credits credits_remaining = credits['userremaining'] reset_time = credits['userreset'] if credits_remaining < 10: print('not enough credits, remaining: %i' % credits_remaining) ...

php - Can access WSDL only with proxy. Straight access does not work -

i getting error: fatal error: uncaught soapfault exception: [wsdl] soap-error: parsing wsdl: couldn't load ' http://217.194.255.193:8080/work/ws/ws1.1cws?wsdl ' : failed load external entity when try access wsdl in browser cyclic authorization issue if password doesnt fit. i have tried use several anonymizers, of them act browser itself, 1 of anonymous services worked , managed see file. anybody has ideas can cause such problem? here code using: ini_set("soap.wsdl_cache_enabled", "0"); header('content-type: text/html; charset=utf-8'); $client = new soapclient("http://217.194.255.193:8080/work/ws/ws1.1cws?wsdl", array( 'login' => 'log', 'password' => 'pass', 'trace' => true, 'features' => soap_use_xsi_array_type, ) );

angularjs - Running mocha tests by file not by folder -

Image
i wanted implement unit testing framework on angular1 codebase , trying analyze best way organize unit test files. have decided use mocha js testing framework. documented in mocha js reads off tests 'test' folder. wanted make able read off based on filename, because designed folder structure keep related components together, , better include unit test file related components. possible?? attached image of folder strucutre. wanted make "page_test.js"

c# - how can we configure null removable components(object field) of a class? -

suppose have class components(object fields) of them can null(removed) suitable create new class without (component) field or use interface handle it. suppose have several components can removed objects thx in advance public class class1{ component1 component1; component2 component2; component3 component3;//can null (removed) component4 component4;//can null (removed) } public class class2{//removed component3,component4(new class) component1 component1; component2 component2; } public class class3{//removed component3(new class) component1 component1; component2 component2; component4 component4; } public class class4{//removed component4(new class) component1 component1; component2 component2; component3 component3; } or use interface public interface icomponent1{ } public class component1:icomponent1{ } public class nocomponent1:icomponent1{ } public interface icomponent2{ } public class component2:icomponent2{ ...

javascript - Parse Facebook Login Error: "You must initialize FacebookUtils before calling logIn" -

i trying use facebook login on parse cordova. $cordovafacebook.login(['email'], function(response) { parse.facebookutils.login('email', { success: function(user) { console.log('success fb login') // handle successful login }, error: function(user, error) { // handle errors , cancellation console.error(error) } }); }, function(error) { console.error(error) }); and in .run block on app.js , have window.fbasyncinit = function () { parse.facebookutils.init({ appid: fbappid, autologappevents: true, xfbml: true, status: true, cookie: true, version: 'v2.4' }); fb.appevents.logpageview(); console.log('parse fb loaded') // loadparse() }; however, on logger when run app on ios device, never see "parse fb loaded". when run on browser, do see "parse fb loaded". whenever try login via facebook on device, error you must initialize facebookutils before...

node.js - how Caching handlebars.js using service worker -

i want ask service workers. made web application , try implement services worker. i'm using .hbs views layout , when cache static files can't cache .hbs, .css , .js files. this how save file: public/ css/ style.css js/ app.js manifest.json service-worker.js views/ home.hbs partial/ header.hbs when deploy app fails cache home.hbs, style.css , app.js file; cant access web offline. what should fix it? this app.js : if ('serviceworker' in navigator) { navigator.serviceworker .register('./service-worker.js', { scope: './service-worker.js' }) .then(function(registration) { console.log("service worker registered"); }) .catch(function(err) { console.log("service worker failed register", err); }) } var = function(url) { return new promise(function(resolve, reject) { var xhr = new xmlhttprequest(); xhr.onreadystatechange = function() { if (xhr.readystate === xmlhttp...

spring - Multiple SpringBoot apps with same data source -

i have 2 spring boot application deployed on same tomcat , both application have same datasource. i instancealreadyexistsexception: org.apache.tomcat.jdbc.pool.jmx:name=datasourcembean,type=co‌​nnectionpool . i have set endpoints.jmx.domain=myapp endpoints.jmx.uniquenames=true. but still error. suggestions this how solve problem. https://github.com/spring-cloud/spring-cloud-config/issues/118 endpoints.jmx.domain=dev endpoints.jmx.unique-names=true spring.jmx.default-domain=dev spring.application.name=dev endpoints.jmx.domain=dev2 endpoints.jmx.unique-names=true spring.jmx.default-domain=dev2 spring.application.name=dev2

java - Deserialize. Store only unique property values -

i use spring boot 1.5.6 + jackson, , when deserialize json : { "places": [{"name": "place1"}], "zone_id": 1 }, { "places": [{"name": "place2"}], "zone_id": 2 }, { "places": [{"name": "place1"}], "zone_id": 3 } i following response: { "places": [{"name": "place1", "place_id": 1}], "zone_id": 1 }, { "places": [{"name": "place2", "place_id": 2}], "zone_id": 2 }, { "places": [{"name": "place1", "place_id": 3}], "zone_id": 3 } but value "place1" duplicated, , don't want store copy in storage. Аdvise, pleace, how following response: { "places": [{"name": "place1", "place_id": 1}], "zone_id": 1 }...

sum - how to add for loop inside the function in javascript? -

i woul add loop inside function. appear final rating not fill of each textboxes. example if place 80 in first grading,automatically appear final rating. how can ? html code <table border="0" class="table table-bordered" > <tbody> <tr class="bg-primary"> <th rowspan="2">learning areas</th> <th colspan="4">periodic rating</th> <th colspan="2">final rating</th> <th rowspan="2">remarks</th> </tr> <tr align="center" class="bg-primary"> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>des</td> <td>num</td> </tr> <tr> <td>filipino</td> <td align='center'><input class="text" size="10" type="number" min="65...

javascript - View not updating in AngularJS -

i implementing infinite-scrolling in angularjs. below function gets called on successful ajax call, takes place when: the user scrolls end of screen. the selects filters, , hits "search" button. in first case, data fetched ajax call appended existing list. in second case, intend empty existing data in list, , display new data. here code that: $scope.successcallback=function(data){ $('#spn-model-buffering-image').hide(); //hide loading spinner icon if($scope.providerslist === null) { $scope.providerslist = []; /* init if null */ } if($scope.scrolled === 'true'){ /*if scroll-end event, append new data existing one*/ array.prototype.push.apply($scope.providerslist, json.parse(data.serviceproviderlist)); //push new data existing list } else{ /*if user clicks on "search providers" button, new data fetched, , occupy entire list view*/ $scope.providerslist=[]; $scope.providerslist=json.parse(data.serviceproviderlist); } viewtobedisplayed...

printing 'date' in unix -

the command echo date gives output : sun aug 20 08:14:50 2017. want date format in : aug 20. tried command : echo date |awk '{print $2, $3}' , outputs want: aug 20 is there other method? if date man page, you'll see it's quite capable of delivering want without passing output through textual filter - can use + specify output format, such as: pax> date +"%b %d" aug 20

php - receive get parameters in url in wordpress -

i make ul menu in wordpress this: <li><a href="<?php get_page_link(); ?>?show=game" class="android-prim-menu-active">بازی ها</a></li> <li><a href="<?php get_page_link(); ?>?show=app">app</a></li> <li><a href="<?php get_page_link(); ?>?show=request">request</a></li> <li><a href="<?php get_page_link(); ?>?show=report">report</a></li> <li><a href="<?php get_page_link(); ?>?show=last">live</a></li> now, every of these links send get request current page , want handle content received values get request. how use get method in wordpress? can use $_get["show"] , receive values? thanks... use $_get["show"] method , can echo $_get["show"] , value

powershell - i am sending document with all version and meta data across site collection -

$ver = $host | select version if($ver.version.major -gt 1) {$host.runspace.threadoptions = "reusethread"} if(!(get-pssnapin microsoft.sharepoint.powershell -ea 0)) { write-progress -activity "loading modules" -status "loading microsoft.sharepoint.powershell" add-pssnapin microsoft.sharepoint.powershell } ## #set static variables ## try{ #sourceweburl url of web contains source list $sourceweburl = "http://bp1amsapt229:14146/agt/sangrcs/" $destinationfilepath="http://bp1amsapt229:14146/agt/scprcs/scp_ctrld/_tobedeleted/test.docx" #destinationweburl url of web in want transfer documents $destinationweburl = "http://bp1amsapt229:14146/agt/scprcs/" $web = get-spweb $sourceweburl #retrieve destination web using parameter provided $dweb = get-spweb $destinationweburl $targetfolder="http://bp1amsapt229:14146/agt/scprcs/scp_ctrld/_tobedeleted/" $sourcefile="http://bp1amsapt229:14146/agt/sangrcs/serenja...

numpy - Selection of second columns data based on match of first column with another text file in python -

i have little knowledge of numpy arrays , iterations. have 2 input files. first columns of both files represents time in milliseconds. input file 1 reference or simulated value. input file 2 obtained test value. want compare(plot second vs first ) second column of input-2 file second column of first file if , if when there match of time in first column in corresponding files. trying through iterations not find proper results yet.how find index when there match? import numpy np my_file=np.genfromtxt('path/input1.txt') sim_val=np.genfromtxt('path/input2.txt') inp1=my_file[:,0] inp12=my_file[:,1] inpt2=sim_val[:,0] inpt21=sim_val[:,1] xarray=np.array(inp1) yarray=np.array(inp12) data=np.array([xarray,yarray]) ldata=data.t zarray=np.array(inpt2) tarray=np.array(inpt21) mdata=np.array([zarray,tarray]) kdata=mdata.t i=np.searchsorted(kdata[:,0],ldata[:,0]) print my inputfile-2 & inputfile-1 0 5 0 5 100...

r - Attempting barplot -

Image
hi trying create beside barplot bars not in correct spaces appear overlapping. barplot(counts, main ="2011 vs 2016 men volunteering", ylim=c(0,320000), xlab="age (years)", ylab = "frequancy", names.arg = c("15-19", "20-24", "25-34", "35-44", "45-54", "55-64", "65-74", "75-84", "84 , over"), col=c("red","green"), beside=true) legend("topright", legend = c("2011", "2016"), fill = c("red", "green")) outputting this: when in reality want this: i have tried using ncol = 2 can't work, how implement it? like this, barplot(counts, main ="2011 vs 2016 men volunteering", ylim=c(0,320000), xlab="age (years)", ylab = "frequancy", names.arg = c("15-19", "20-24", "25-34...

react-native error when going over tutorial at react native site -

Image
i complete beginner, please provide explanation. i following react-native tutorial @ https://facebook.github.io/react-native/releases/0.19/docs/tutorial.html i run command init project, call movies instead of awesomeproject tutorial explains. then copied complete code bottom of tutorial index.ios.js, save project , refreshed emulator , error error: bundling failed: "transformerror: /users/dinob/reactnativework/movies/index.ios.js: unexpected token ) (while processing preset: \"/users/dinob/reactnativework/movies/node_modules/ babel-preset-react-native/index.js\")" react-native-cli: 2.0.1 react-native: 0.47.1 react: 16.0.0-beta.2 what can see is, tutorial you're following rn 0.19 while newest stable version 0.47. examples codes inside use older es5 syntax , not newer class based syntax came in es6/es2015 firstly, please make sure you're following newest tutorial version , code. can here. https://facebook.github.io/react-native/doc...

ios - why status bar behaves differently - swift -

Image
i'm using tabbar controller , in each tab, have uiview controller embedded in navigation controller. in each view of mt view controllers, have scroll view. same when run it, different appears status bar. why happening? first tab: second tab: notice white background color in second tab not exist in first tab. causes sth this?

python - matplotlib not displaying the graph bars -

i'm trying plot show on graph not show reason. have imported matplotlib library, getting values function , when pass values function want plot shown displays blank image. show getting correct values have used print along plotting commands values getting printed not plot here's code. able plot correct using def getcounts(data): return (data['sex'].value_counts()) def get_plot(points): _x1 = points[0] _x2 = points[1] _y = (_x1 + _x2) - 200 print('male' + ' ' + str(_x1) + '\n','female' + ' '+ str(_x2), _y) plt.bar(height = _x1, tick_label = 'male', left = _x1) plt.xlabel('counts of people according sex') plt.ylabel('number of people') plt.show() counts = getcounts(titanic) get_plot(counts) i'm trying 2 bars placed in there 'male' , 'female' , not sure how able to. , code above able put 1 of it. please in advance. you may want revisit p...

trading view - How to draw MACD and EMA in one script ( Pine Editor)-Tradingview -

i want draw macd , ema in 1 script . implement below : //@version=3 study("example of alertcondition") fast = 12, slow = 26 fastma = ema(close, fast) slowma = ema(close, slow) macd = fastma - slowma src = input(close) ma_2 = ema(src, 36) plot(ma_2, color=red) plot(macd, color=blue) but don't draw anything. if remove plot(ma_2, color=red) so script draw macd.if remove plot(macd, color=blue) so script draw ema. why can not draw 2 indicators in case ? can me . thanks

vi:set tabstop=4 doesn't work outside vi -

i've created 2 files named tab1 , tab2. tab1, i've used normal tab using 8 space default. meanwhile tab2, i've changed using :set tabstop=4 command. i've tried :set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab it working fine in vi, instead of having 8 blank spaces, have 4 blank spaces tab. inside vi 123456789 2 ~ :set tabstop=4 however, when view files again cat command, seems both commands didn't @ all. please let me know how make changes persistent outside vi when viewing using other utilities such cat . outside vi 123456789 user@host:~# cat tab1 1 user@host:~# cat tab2 2 user@host:~# my goal have 4 spaces when using tab permanently outside vi editor this. please let me know if have solution this. thanks 123456789 user@host:~# cat tab1 1 user@host:~# cat tab2 2 user@host:~# 1234...

node.js - Multiply drawText from array with node-gm -

Image
have array this: var myarray=[ { title: 'some title', time: 'some time'}, ... ]; and node-gm code: gm('bg.png') .fill("#ffffff") .font("phenomena-bold.otf", 27) .drawtext(225, 75, "some text") .write("result.png", function (err) { if (!err) console.log('done'); }); need add each item myarray .drawtext() shifting y-axis 45px. ideas? you've asked, wrote , tested it. take (: const gm = require('gm'); const myarray = [ { title: 'some title', time: 'some time'}, { title: 'second title', time: 'second time'} ]; const image = gm('bg.jpg') .fill('#ffffff') .font('arial', 27) // didn't wanted play fonts, used normal default thing (: .drawtext(225, 75, "some text"); let x = 225; let y = 75; for(const text of myarray) { y += 45; image.drawtext(x, y, t...

sql - Selection of table values based on record -

i have 3 tables following structure: table1: cat fields: cat0 cat1 record 1: record 2: b record 3: c record 4: d table2: catb fields: option record 1: x record 2: y table3: catd fields: option record 1: 1 record 2: 2 cat1 should lookup catb, if cat0 has b in record cat1 should lookup catd, if cat0 has d in record the output expected is: table1: cat fields: cat0 cat1 record 1: null record 2: b x or y (combo box) record 3: c null record 4: d 1 or 2 (combo box) i using lookup values in ms access. the following code doesn't work in lookup of cat1: select * cat inner join catb b on b.option = a.cat0 a.cat0 = "b" union select * cat inner join catd d on d.option = a.cat0 a.cat0 = "d"; how can achieved? thanks. i never set lookups in table, on forms. correct union statement in query named options: select "b" cat, option catb union select "...

c# - Xamarin CarouselView Not Displayed -

i attempting use carouselview first time , kind of struck it. have xaml defined follows <?xml version="1.0" encoding="utf-8" ?> <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:prism="clr-namespace:prism.mvvm;assembly=prism.forms" prism:viewmodellocator.autowireviewmodel="true" xmlns:cv="clr-namespace:xamarin.forms;assembly=xamarin.forms.carouselview" x:class="csixty.xam.views.mainpage" title="mainpage"> <contentpage.content> <stacklayout> <label text="name" horizontaloptions="center" verticaloptions="centerandexpand"/> <cv:carouselview itemssource="{binding zoos}"> <cv:carouselview.itemtemplate> <datatemplate...

this - System.out.println(super) in java -

this question has answer here: how super implemented in java? 5 answers this in java works reference variable, super not, why? example: can system.out.println("this: " + this); can never system.out.println("super: " + super); class base { public base() { system.out.println("base constructor"); } } class child extends base { public child() { system.out.println("child constructor"); system.out.println("this: " + this); //system.out.println("super: " + super); } } the reason think of is, when use new keyword memory allocated in heap , reference id of memory saved in this . there no memory space allocation parent in heap there no reference id stored in super . am wrong? or there missing with. can this reference variable & super not? ...

python 2.7 - why '^(?[0-P<id>9]+)/$' is not a valid regular expression in django? -

i created new different url , view.after error showing.. newly created url , views following url(r'^$', views.deletecontent, name="delete"), view : def deletecontent(request, id): if not request.user.is_authenticated(): return redirect('accounts:login') todo = get_object_or_404(todo, id=id) todo.delete() return render(request,"index.html") your regex not invalid in django, invalid anywhere. think have mistyped it. the regex ^(?[0-p<id>9]+)/$ totally invalid, drop in regex101.com , @jonrsharpe said, , see says: (? incomplete group structure ) incomplete group structure you can have @ the docs : url(r'^articles/(?p<year>[0-9]{4})/$', views.year_archive) this sample url regex year. see how formatted. you should write regex in order make valid: ^(?p<id>[0-9]+)/$ it means id parameter, numeric ( [0-9]+ ) edit: or can use \d+ instead of [0-9]+ , more straight...

openerp - Why account payable showing negative amount when I want to pay my supplier? -

Image
i using openerp v7 , tried make payment supplier. this product , account setup (the expense account asset account, changed expense account end result still same). below supplier , account payable setup this how invoice shown on system if continue make payment invoice cash debited wrong. did setup wrong here ? please advise.

php - Convert my Javascript to Ajax -

im having hard time figuring out on how can convert javascript code ajax everytime ill click on link, details of view change. thanks example: if ill select crop modal pop out details of specific crops. here js file $(document).on("click", ".fetchccropid", function () { var myccropid = $(this).data('id'); alert(myccropid); console.log(myccropid); $(".modal-body #crop_cultivated_id").val(myccropid); }); and receiving end one: <input type="text" name="crop_cultivated_id" id="crop_cultivated_id" value="0" /> <?php $q_update_cc = $this->db->query("select * cultivated_crops cc_id=".$cc_id_from_js ) ?> there no problem when pass myccropid textbox. problem when i'll pass myccropid value php can query. i dont know how pass value js php $cc_id_from_js have value. i'm thinking if there possible way pass value without using ajax. thanks in adv...

mysql - php show specific site menu based on user login name -

i have site has menu non members , 1 members shown depending on if user logged in or logged out know how have additional menu show specific user upon login using user email address determine user shown third menu. thanks in advance try out! <?php if (isset($_session['logged']) && $email == "email@example.com") { //show special menu example: admin menu } else if (isset($_session['logged'])) { //show members menu here } else { //show normal menu code } ?> happy help!

java - Does subclass use always super-class's default constructor? -

this question has answer here: why constructor of super class invoked when declare object of sub class? (java) 18 answers why subclass not able use own default constructor? when bike extends vehicle class, why bike using vehicle's constructor creating bike object? that seems okay use parent's class constructor when bike object having more additional members doesn't exist in parent class using super class decrease writing additional duplicate code initialize. looks okay.(might wrong). public class vehicle { vehicle() { system.out.println("vehicle created"); } } public class bike extends vehicle { public static void main(string[] args){ bike hondabike = new bike(); } } output: vehicle created new bike() invokes parameter-less constructor of class bike , invokes parameter-less constructor...

java - Mybatis enum select by id -

my mybatis code doesn't load enum type (version: 3.4.4). at mysql database have table cartype field int(11) type. in java created enum handling car types: public enum cartype { sedan(1), limusin(2), wagon(3); private int id; cartype(int id) { this.id = id; } public int getid() { return this.id; } car mapper xml looks (contains no data): <select id="selectcar" parametertype="car" resultmap="carresultmap"> select * cars car_name="#{carname}"; </select> <resultmap id="carresultmap" type="car"> <id property="id" column="car_name"/> <result property="cartype" column="cartype"/> </resultmap> finally bean followings: public class car { private integer id; private cartype cartype; } the bean contains getters , setters too. when try car in java thorws following exception: caused by: java.lang.illegalargumentexception: no enum constan...

android - Pull JSONObject from JSONArray? -

i'm trying pull "price" object "current" array, have been @ hours no luck, appreciated! :) try { url url = new url("http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=2"); httpurlconnection urlconnection = (httpurlconnection) url.openconnection(); try { bufferedreader bufferedreader = new bufferedreader(new inputstreamreader(urlconnection.getinputstream())); stringbuilder stringbuilder = new stringbuilder(); string line; while ((line = bufferedreader.readline()) != null) { stringbuilder.append(line).append("\n"); } bufferedreader.close(); return stringbuilder.tostring(); } { jsonarray nu1 = jobj.getjsonarray("current"); jsonobject jobj = nu1.getjsonobject(0); string price = jobj.ge...

javascript - Passing a string value to JS funtion code on submit -

i'm sending user input (string) third party api, should expect json results in <p class="score"> nothing happens! userinput not passed javascript it's accessible via alert can please let me know if there's problem syntax? var myurl = 'https://apiv2.coolcompany.io/sentiment'; var api_key = 'xxxxxxxxxxxxxxxxxxxxxxx'; function apirequest() { var mydata = document.getelementbyid('userinput').value; $.post( myurl, json.stringify({ 'api_key': api_key, 'data': mydata, }).then(function(sent) { var s = sent var obj = json.parse(s) $('.score').append(obj.results) }); <input placeholder="i love writing code!" id="userinput"> <button onclick="apirequest()" id="submit">try it</button> <p class="score">score : </p> ...

c# - Keep process running forever -

this question has answer here: long-running background process in asp.net - application_start or separate process? 2 answers how should perform long-running task in asp.net 4? 5 answers i have dummy webisite want run task in while(true) loop , want run forever. i'm in school project soccer bets , need (sort of) cloud website automatically update games , results me everyday, insert them in database , send emails, depending on eacher users bets (if gots points in game or not). although, can't seem keep alive. code: private static string ligacaobd = @"connectionstring"; private static apimethods sportradar = new apimethods(); private static jogo jogo = new jogo(ligacaobd); private static list<sportradar.classescliente.jogo> jogos; private static l...

xml - XSL:template & Combination of two match conditions to select outer node -

given following (part of a) xml file: <span deltaxml:deltav2="a!=b"> <deltaxml:attributes deltaxml:deltav2="a!=b"> <dxa:class deltaxml:deltav2="a!=b"> <deltaxml:attributevalue deltaxml:deltav2="b">lof</deltaxml:attributevalue> </dxa:class> </deltaxml:attributes> text </span> ... want / need match <span> nodes in <xsl:template match=".."> statement target spans with the span having deltaxml:deltav2 attribute ' a!=b ' value , the exact deltaxml:attributes/dxa:class/deltaxml:attributevalue child structure inner-most deltaxml:attributevalue node having deltaxml:deltav2 attribute set ' b ' value , containing ' lof ' value / text basically need match exact condition shown above later select / use 'some text' part.. that's easy thing once matched <span> node(s) in input xml.. far i've b...

architecture - How to scope ViewModels properly? -

i trying wrap head around new android architecture components, viewmodel. my impression fragment should not know activity or fragment owned by, can used in different contexts of application. examples seem contradict declaring viewmodel scope directly in fragment, rather fragment owner: viewmodel = viewmodelproviders.of(getactivity()).get(someviewmodel.class); i able use fragment in master/detail configuration, both share same state (i.e. viewmodel instance), inside viewpager, fragments require separate state (i.e. separate viewmodel instances). expect fragment owner dictate scope, not seem supported approach. a workaround came optionally pass in configured viewmodelprovider explicitly broaden scope of viewmodel if necessary (e.g. in master/detail configuration) , have separate viewmodels default: final viewmodelprovider viewmodelprovider; if (viewmodelprovideroverride != null) { viewmodelprovider = viewmodelprovideroverride; } else { viewmodelprovider = viewmodelp...

c# - Stop page refresh after button click -

it not repeat post, have checked answers present on net , nothing working me i'm posting here. please find code. <form runat="server"> <div class="card"> <ul class="nav nav-tabs main-menu" role="tablist"> <li role="presentation" class="active"><a href="#enabled" class="element" style="font-size: 20px;" aria-controls="home" role="tab" data-toggle="tab">check box - enabled</a></li> <li role="presentation"><a href="#disabled" class="element" style="font-size: 20px;" aria-controls="profile" role="tab" data-toggle="tab">check box - disabled</a></li> </ul> <div class="tab-content"> <div role="tabpanel"...

video - ffmpeg unable to find a suitable output format for '\' -

i trying following command concatenate 4 mp4 video files using ffmpeg concat filter, gives error: unable find suitable output format '\' command: f:\partition c backup\downloads\compressed\ffmpeg-20170817-92da230-win64-shared\ ffmpeg-20170817-92da230-win64-shared\bin>ffmpeg -i "long name spaces 1.mp4" -i "long name spaces 2.mp4" -i "long name spaces 3.mp4" -i "long name spaces 4.mp4" \ -filter_complex "[0:v:0] [0:a:0] [1:v:0] [1:a:0] [2:v:0] [2:a:0] [3:v:0] [3:a:0] concat=n=4:v= 1:a=1 [v] [a]" \ -map "[v]" -map "[a]" e:\ffmpeg.mp4 please me find wrong syntax in command.

Rails How to link an email form with Sendgrid? -

i able create contact form when user clicks submit - send email , receive in inbox. have email sent via sendgrid can analyze analytics. looked @ gorails sendgrid course , able send email via sendgrid don't know how apply contact form. have listed code below, amazing. thank much! new.html.erb (contact form sends email regularly when user clicks submit) <div align="center"> <h3>send message us</h3> <%= form_for @contact |f| %> <div class="field"> <%= f.label :name %><br> <%= f.text_field :name, :required => true %> </div> <div class="field"> <%= f.label :email %><br> <%= f.email_field :email, :required => true %> </div> <div class="field"> <%= f.label :message %><br> <%= f.text_area :message, :as => :text, :required => true %> </div> <div class="actions"> ...

Graphviz and Weka only generates empty trees -

Image
i downloaded graphviz , installed package weka 3.9, created props file indicated on https://github.com/fracpete/graphviz-treevisualize-weka-package content: executable="c:\program files (x86)\graphviz2.38\bin\dot.exe" (tried , without quotation marks) and generate empty trees through plugin->visualize tree (graphviz). i'm in bit of stress because need deliver project night , discovered error last moment, can please help? can deliver without trees, theyd major help. thanks in advance! first of all, bringing useful weka plugin notice! think it's written 1 of weka developers fwiw, not authors of graphviz. to answer question, although it's late deadline sorry, sure have created props file correctly? in particular, format specifying executable path shown on project page linked (for example): executable=c:/program files (x86)/graphviz2.38/bin/dot.exe i.e. forward slashes path separator, on windows. when replaced forward slashes backslashe...

dictionary - Java nested lists in map returns an error when passing a list of lists to Map values -

i've class called zipclass holds 2 static methods: - ziptolist() put 2 lists of same size lists of lists; , - ziptomaplist() put list of values keys , lists of lists values keys. first method works fine: public static <t> list<list<t>> ziptolist(list<t> list1,list<t> list2) { list<t> tuple = new arraylist<>(); //a list pair of values from same columns (fields) list<list<t>> tuples = new arraylist<>(); // list of lists if(list1.size() == list2.size()) //check size of lists same { for(int idx = 0; idx < list1.size(); idx ++ ) { //feed tuple pair of values tuple.add(list1.get(idx)); tuple.add(list2.get(idx)); //feed list of lists list of paired values tuples.add(copylist(tuple)); //clear pair next iteration tuple.clear(); } } else system.out.println("lists must of same size...

cypher - How to write a below query in neo4j? -

how can write below sql query in neo4j cypher? select t1.empno, t1.lastname, t1.birthdate, t2.empno, t2.lastname, t2.birthdate employee t1, employee t2 t1.birthdate = t2.birthdate , t1.empno <> t2.empno it depends on model equivalent form : match(t1:employee),(t2:employee) t1.birthdate = t2.birthdate , t1.empno <> t2.empno return t1.empno, t1.lastname, t1.birthdate, t2.empno, t2.lastname, t2.birthdate hope helps. regards, tom

Livy Batch submission for Spark Scala job in Azure HDInsight without providing Cluster credentials in Code for Basic authentication -

i trying submit spark scala (.jar) job via .net azure hdinsight using livy batch submission.i have followed link https://docs.microsoft.com/en-us/rest/api/hdinsightspark/hdinsight-spark-batch-job#create-a-new-batch-job .in need provide basic authentication cluster credentials, username , password mentioned in code.is there secured way avoid providing credentials , use kind of tokens authentication.

Perl 5: Cannot get file handle descriptor -

test.pl: #!/usr/bin/perl use warnings; begin { *core::global::close = sub (;*) { @args = @_; $fileno = fileno($args[0]); print $fileno, "\n"; core::close(@args); }; } use lib '.'; use test; test.pm: package test; open(xxx, 'test.pl'); close(xxx); 1; when run program ( perl test.pl ), get: use of uninitialized value $fileno in print @ test.pl line 10. close() on unopened filehandle 1 @ test.pl line 11. where error? you're passing entire @args array core::close , not file handle. need pass in correct element of array. here's example takes filename command line, , right thing: use warnings; use strict; begin { *core::global::close = sub (;*) { @args = @_; $fileno = fileno($args[0]); print $fileno, "\n"; # next line issue core::close($args[0]); }; } die "need file param" if ! @argv; $file = $argv[0]; open $fh, $file or die $!; close $f...

eager loading - How to correctly use includes to solve N+1 rails -

i have 3 models: 1)contenttype (parent) 2)recenttools (last 3 childs of contenttype, model tool, recent_tools association using scope of tool) 3)tooltranslation (child of tool) i want solve n+1, , write includes this. right im stucked: contenttype.includes(recent_tools: :tool_translation) this should work guess accorting guides, includes always returns me full list of tools, instead of recent_tools, , of translations them. this tool.rb class tool < applicationrecord has_one :tool_translation, -> { where(locale: i18n.locale) }, dependent: :destroy belongs_to :content_type scope :recent, ->(number){ limit(number) } end and content_type model: class contenttype < applicationrecord has_many :tools, dependent: :destroy has_many :recent_tools, -> { recent(3) }, class_name: "tool" end where missing? can explain? maybe bad logic recent tools(it needed because need 3 last tools of content_type on main page)? how should write includ...

html - RegEx match open tags except XHTML self-contained tags -

i need match of these opening tags: <p> <a href="foo"> but not these: <br /> <hr class="foo" /> i came , wanted make sure i've got right. capturing a-z . <([a-z]+) *[^/]*?> i believe says: find less-than, then find (and capture) a-z 1 or more times, then find 0 or more spaces, then find character 0 or more times, greedy, except / , then find greater-than do have right? , more importantly, think? you can't parse [x]html regex. because html can't parsed regex. regex not tool can used correctly parse html. have answered in html-and-regex questions here many times before, use of regex not allow consume html. regular expressions tool insufficiently sophisticated understand constructs employed html. html not regular language , hence cannot parsed regular expressions. regex queries not equipped break down html meaningful parts. many times not getting me. enhanced irregular regular expressions used...