Posts

Showing posts from March, 2015

Three.js ShaderMaterial with lights on mesh imported from Blender -

i'm trying shadermaterial lights working in three.js r77. works correctly when applied mesh simple boxgeometry behaves incorrectly when applied mesh imported blender. a simple jsfiddle illustrating problem here . mesh on left created blender export. mesh on right created simple boxgeometry. both using same shadermaterial. position of light indicated directionallighthelper. the mesh on right being lit correctly, while mesh on left not. problem in shader code. assumed problem in uv map on imported mesh, not appear true. in jsfiddle example uv map copied directly boxgeometry mesh imported geometry---they're rotated relative each other because of coordinate differences between blender , three.js, lighting still working correctly on mesh on right imported uvs. the shader code is: three.testshader = { uniforms: { "udirlightpos": { type: "v3", value: new three.vector3(20, 20, 20) }, "udirlightcolor": { t

angularjs - passing ng repeat objects from one controller to other -

this question has answer here: passing data between controllers in angular js? 18 answers hi displaying data using ng repeat . displaying 3 persons in template.. when click on 1 of them. want display in detail information of person... need make new controller , new template...but know 1 way pass 1 of unique parameter mobile no controller.. changes path having mobile number controller , template.using location.path().search() .. in 2nd controller can request information again using 2nd parameter.. okay ?? i wanted pass whole persons data 1 controller other don't know how can it... use service set selected person's information , access information using routeparam user's unique id. the code structure below angular .module('app') .controller('parentcontroller', function (userservice) { $scope.onselect =

amazon web services - Wildfly 10 HA Clustering On AWS Does not work -

i trying set ha clustering on amazon web service wildfly-10. standalone-ha.xml configuration is ... <subsystem xmlns="urn:jboss:domain:jgroups:4.0"> <channels default="ee"> <channel name="ee" stack="s3ping"/> <channels> <stacks> ... <stack name="s3ping"> <transport type="tcp" socket-binding="jgroups-tcp" diagnostics-socket-binding="jgroups-diagnostics"/> <protocol type="s3_ping"> <property name="access_key"> <%= @s3_access_key %> </property> <property name="secret_access_key"> <%= @s3_secret_access_key %> </property> <property name="prefix"> <%= @s3_bucket %> </property>

javascript - Anycharts 6.2.0 - "TypeError: this.b.getSVG is not a function" -

anycharts 6.2.0 here. i'm trying implement getsvg() function, made small test, similar 1 appears in online docs: <script type="text/javascript" language="javascript"> var chart = null ; // html5 chart anychart.renderingtype = anychart.renderingtype.svg_only; chart = new anychart() ; if (chart!=null) { chart.width = '100%' ; chart.height = '100%'; chart.wmode = 'transparent' ; chart.usebrowserresize = true ; chart.setxmlfile(xmlfile); chart.write("sepchartcontainer"); alert(chart.getsvg(true)) ; } </script> but on browser web console error: typeerror: this.b.getsvg not function what i'm doing wrong?

javascript - Grouping a nested array with underscore.js -

sorry if seems duplicate, i've tried other answers , can't seem works properly. i'm building angularjs spa, , have data in following format: "folders": [ { "id": 1, "password": "wpaugor452", "year": 2013 }, { "id": 2, "password": "wpaugor452", "year": 2013 }, { "id": 3, "password": "dfgoerj305", "year": 2014 } and many many more. i want folders grouped it's this: "folders": [ "2013": [ "wpaugor452": [ { "id": 1, "password": wpaugor452, "year": 2013, }, { "id": 2, "password": wpaugor452, "year": 2013, } ] ], "2014": [ "dfgoerj305": [ { &q

c++ - Make template function to destinguish inheritors and others -

i have class ( base ) has many inheritors ( derived_i ) , other types ( other ). want have template method in class-handler ( caller ), handles inheritors of base in differ way, other types. here example code telling about. #include <iostream> using namespace std; template <typename t> class base { public: base (t val = t()) : m_val(val) {} base (const base &other) : base(other.m_val) {} virtual void base_specific_method() { cout << __func__ << " method called: " << m_val << endl; } void each_class_has_this() { cout << __func__ << " boring..." << endl; } t m_val; }; class other { public: void each_class_has_this() { cout << __func__ <<" boring..." << endl; } }; class derived_i : public base <int> { public: derived_i () : base <int> (10) {} virtual void base_spe

r - Simulate array with scatter & known relation to X -

Image
this basic r question, can't seem find right packages want. i have array 'x', n values. want simulate array, 'y', follows known relation y = alpha + beta*x. furthermore, want add intrinsic scatter y array. alpha, beta, , intrinsic scatter should input values user. can me how go doing this? thanks! here function creates deterministic part of correlation , adds noise via rnorm make_correlation <- function(alpha, beta, scatter, x){ # make deterministic part y_det <- alpha + beta*x # add noise y <- rnorm(length(x), y_det, scatter) return(y) } set.seed(20) x <- runif(20, 0, 10) answer <- make_correlation(alpha = 2, beta = 3, scatter = 2, x) plot(answer~x)

ruby - Stop reading from file when it can't read anymore using BinData -

currently i'm using bindata gem parse binary file format. works fine, except i'm not sure stop. file divided properties read using bindata records. there can anywhere between 16 , 18 properties (depending on file takes). so, if this: 16.times{ # parse data property. } that works fine when there 16 properties, however, if bump 17 following error. 'readbytes': end of file reached (eoferror) my question is, how can avoid 16 times , have read until reads properties can, stops when reaches end of file error. from examples/tcp_ip.rb : class pcapfile < bindata::record endian :little struct :head uint32 :magic uint16 :major uint16 :minor int32 :this_zone uint32 :sig_figs uint32 :snaplen uint32 :linktype end array :records, :read_until => :eof uint32 :ts_sec uint32 :ts_usec uint32 :incl_len uint32 :orig_len string :data, :length => :incl_len end

ios - UIAlertController shown on BarButtonItem not centered properly -

i using following code show uialertcontroller on toolbarbuttonitem, uialertcontroller *alertcontroller = [uialertcontroller alertcontrollerwithtitle:nil message:nil preferredstyle:uialertcontrollerstyleactionsheet]; [alertcontroller addaction:[uialertaction actionwithtitle:@"cancel" style:uialertactionstylecancel handler:^(uialertaction *action) { }]]; [alertcontroller addaction:[uialertaction actionwithtitle:@"delete selected accounts" style:uialertactionstyledestructive handler:^(uialertaction *action) { [utility showalertwithtitle:nil message:delete_account delegate:self tag:1 buttons:@[@"cancel", @"delete"]]; }]]; alertcontroller.popoverpresentationcontroller.barbuttonitem = self.morebuttonitem; [self presentviewcontroller:alertcontroller animated:yes completion:nil]; the alertcontroller shown using code appears right sided not centered. want alertcontroller appear @ center position on toolbarbut

ElasticSearch total distinct occurrences across whole data -

i new elasticsearch (version 2.3.3) , following format data. { "title": "doc 1 title", "year": "14", "month": "06", "sentences": [ { "id": 1, "text": "lorem ipsum dolor sit amet, consectetur adipiscing elit", "class": "introduction", "synth": "intr" }, { "id": 2, "text": "donec molestie pulvinar odio, ultricies dictum mi porttitor sit amet.", "class": "introduction", "synth": "abstr" }, { "id": 3, "text": "aliquam id tristique diam. suspendisse convallis convallis est ut condimentum.", "class": "main_content", "synth": "body"

cmake - Make a test depend on a file() or make_directory() call -

i have test ( add_test(name mytest command myexecutable ) run have "preparation" tasks have been done. when have 1 test depends on test, use set_tests_properties(testa properties depends anothertest) , there way can set_tests_properties(testa properties depends file(remove /path/to/file)) ? the 1 way can think of using python or other scripts test driver in following way per documentation : add_test(name test_req_some_ops_before command testdriver.py --config $<configuration> --exe $<target_file:myexe> --path <here path delete>) which should whatever want

preg match all - PHP check if two keywords occur in String -

my challange explained on following example: keyword combination "gaming notebook" given. i want check whether 2 keywords occur in string. challange string this: "nice gaming notebook" "notebook gaming" "notebook extreme gaming" i want function return true of 3 strings. there tolerance of 3-4 words can between word combination , examples show, want work if keywords switched. so approach following, not seem work: $keyword = strtolower("gaming notebook"); $parts = explode(" ", $keyword); $string = strtolower("which notebook gaming performance"); //point end of array end($parts); //fetch key of last element of array. $lastelementkey = key($parts); //iterate array $searchexpression = ""; foreach($parts $k => $v) { if($k != $lastelementkey) { $searchexpression .= $v . "|"; } else { $searchexpression .= $v; } } if(preg_match_all('#\b('. $searchexpre

dependency injection - ASP.NET Identity and Unity -

i using asp.net identity , unity in project implement di. there wrong signinmanager. can't use in constructor because has error. please me. usermanager , rolemanager working properly. how can use signinmanager interface. this autherscontroller : private readonly usermanager<applicationuser> _usermanager; private readonly rolemanager<identityrole> _rolemanager; private readonly applicationsigninmanager _signinmanager; public authorscontroller(iuserstore<applicationuser> usermanager, irolestore<identityrole, string> rolemanager, iauthenticationmanager signinmanager) { _usermanager = new usermanager<applicationuser>(usermanager); _rolemanager = new rolemanager<identityrole>(rolemanager); _signinmanager = new signinmanager<applicationsigninmanager>(signinmanager); } public applicationsigninmanager signinmanager { { return _signinmanager ?? httpcontext.

CMD operations through Java -

i'm trying run command line operations through java. 1 of command requires enter pressed complete. don't know how pass enter through java in middle of command execution. import java.io.bufferedreader; import java.io.inputstreamreader; public class commandlinemethods { public static string executecommand(string []command) { stringbuffer output = new stringbuffer(); process p; try{ p=runtime.getruntime().exec(command); p.waitfor(); bufferedreader br = new bufferedreader(new inputstreamreader(p.getinputstream())); string line = ""; while((line=br.readline())!=null) { output.append(line + "\n"); } } catch(exception e) { e.printstacktrace(); } return output.tostring(); } public static void main(string...args) { string scriptspath ="c:\\bip_autochain\\win64_x64\\scripts"; string scriptname="lcm_cli.bat";

win universal app - How to get video file stream from embed url in c# -

i tried below code video not playing. var httpclient = new httpclient(); var data = await httpclient.getbytearrayasync(new uri("http://www.youtube.com/embed/irfe-skop4i")); var file = await knownfolders.musiclibrary.createfileasync("myfile.mp4", creationcollisionoption.replaceexisting); var targetstream = await file.openasync(fileaccessmode.readwrite); await targetstream.asstreamforwrite().writeasync(data, 0, data.length); await targetstream.flushasync(); targetstream.dispose(); any 1 please me how save download..thankyou i agree @x..., if want download video youtube, need install youtubeextractor . but same code can't download different website videos. i tested code video download uri " http://video.ch9.ms/ch9/9b56/4f2d0b4d-ea37-4525-8833-128ad6e69b56/uwp01seriesintro.mp4 ", works fine. actually want download openload.co/embed/ehmdelqnx94 video there possibility.. i took @ video, find web named openload, , web service

sql server - Searching for strings in files using sql -

i have set @file = 'aaaa,bbbb,cccc,dddd,eeee,ffff' select substring(@file,charindex(',',@file)+1, charindex(',',@file,charindex(',',@file)+1) -charindex(',',@file)-1) my_string this print out my_string ---------------- 1| bbbb how make print? my_string ------------ 1| bbbb 2| cccc 3| dddd 4| eeee try code.,(refered turning comma separated string individual rows ) declare @file varchar(max) set @file = 'aaaa,bbbb,cccc,dddd,eeee,ffff' ;with tmp(dataitem, data) ( select left(@file, charindex(',',@file+',')-1), stuff(@file, 1, charindex(',',@file+','), '') union select left(data, charindex(',',data+',')-1), stuff(data, 1, charindex(',',data+','), '') tmp data > '') select dataitem tmp

sql - AJAX - looped variables, only first result being passed -

i loop data sql query , put form. 3 variables being retrieved sql each data set: betid , bethome , betaway . now i'd alter data within form , pass through ajax. problem : first data set being altered, others remain untouched. any idea wrong javascript code? <script type="text/javascript"> $(document).ready(function(){ $("#betting").click(function(){ var val1 = $("#betid").val(); var val2 = $("#bethome").val(); var val3 = $("#betaway").val(); $.ajax({ type: "post", url: "betting-ajax.php", data: { betid: val1, bethome: val2, betaway: val3 }, success: function(html){ $("#hide").hide(); $("#new").html(html); } }); return fa

html - Validation of textbox in javascript based on option selected -

i using javascript validate text box based on option selected not able process new http requests after processing text box validation page. don't understand issue script.code seems lengthier.i have new frame used new http request after processing page not able open new http page in side menu bar of new frame. find problem when dumped code in our embedded device.can u please me in solving problem? <script type="text/javascript"> var txtbox=new array("destip","frms"); var txtbox2=new array("destip","frms"); function chkipv4() { var x;if(document.getelementbyid(txtbox[0]).value.length==0){alert(document.getelementbyid(txtbox[0]).name+" not valid");document.getelementbyid(txtbox[0]).focus();return false;}for(x=0;x<1;x++){obj=document.getelementbyid(txtbox[x]);name=obj.name;val=obj.value;len=val.length;if(len<=15){var i;var ascii1=0;var decvalue=0;var decvalueflag=0;var dotcount=0;var dotflag=0;v

ssis - Importing flat file and Creating reports sql server -

i have ragged right flat file has 168 columns. type of flat file daily , need create various reports , send these reports various departments of company. task load flat file sql server database reporting purposes. 168 columns should go 22 different tables , when storing in different ttables, should in correct datatypes can suggest process this. i need covert column before loading each table. and table, create reports. thank time ! i worked similar type of project , here scenario , did if helps you. scenario files dumped via ftp @ midnight, file should processed , generate report everyday [early first hour]. solution fixed folder dump file everyday , designed ssis import large table [168 columns table on our case] i.e.table importstaging, had column dateimported , filename keep track file , date imported. , had procedure populated other tables. , ssrs report on place. now designed sql job, step 1: import using ssis package step 2: ssis package move

C# Service Request -

i stack on apple gsx api request in c# project. ok cannot response api. certificates done, static ips have whitelisted. return error when request " https://gsxapiut.apple.com/gsx-ws/services/emea/asp " {"an error occurred while making http request https://gsxapiut.apple.com/gsx-ws/services/emea/asp . due fact server certificate not configured http.sys in https case. caused mismatch of security binding between client , server."} request function : public void authenticate() { try { basichttpbinding binding = new basichttpbinding(basichttpsecuritymode.transport); binding.security.transport.clientcredentialtype = httpclientcredentialtype.certificate; endpointaddress endpoint = new endpointaddress("https://gsxapiut.apple.com/gsx-ws/services/emea/asp"); var sslcertfilename = "test.p12"; var sslcertpassword ="xxxx

What is API call limit to jet.com APIs? -

how many request calls can api integration make per second jet.com rest apis? not find in documentation on burst size , leak rate(in requests/sec) . as per jet developer team , there isn't limits on number of api calls made

javascript - google chrome extension rejected http request -

i've prepared chrome extension rejected published because of issues (they haven't specified wrong exactly). below message recieved them rejection: your item "[name of extension]" [here kind of id] being taken down violates section of developer program policy relating malicious products obfuscating part of code. per our policies, possible, make of code visible in package can. if of app's logic hidden , appears suspicious, may remove it. to have item reinstated, please make necessary changes ensure: of files , code included in item’s package. code inside package human readable (no obfuscated or minified code). avoid requesting or executing remotely hosted code (including referencing remote javascript files or executing code obtained xhr requests). most don't part of code $.get('http://mydomain/catalogue/message.php?date=' + today, function() {}) .done(function(responsemessage) { chrome.notifications.create( &#

coreos - Docker: private registry access -

i'm trying push image docker private repository: docker pull busybox docker tag busybox living-registry.com:5000/busybox docker push living-registry.com:5000/busybox docker tells me: the push refers repository [living-registry.com:5000/busybox] https://living-registry.com:5000/v1/_ping : read tcp 195.83.122.16:39714->195.83.122.16:5000: read: connection reset peer these commands being performed on coreos. in machine, i've started registry using command: docker run -d -p 5000:5000 --restart=always --name registry \ -v /root/docker-registry/auth:/auth \ -e "registry_auth=htpasswd" \ -e "registry_auth_htpasswd_realm=registry realm" \ -e registry_auth_htpasswd_path=/auth/htpasswd \ -v /root/docker-registry/certs:/certs \ -e registry_http_tls_certificate=/certs/registry.crt \ -e registry_http_tls_key=/certs/registry.key \ -v /root/docker-registry/data:/var/lib/registry \ registry:2 everything seems right: # netstat -

python - Why isn't kv binding of the screen change working? -

i've defined 2 buttons: 1 in kv , 1 in python. located in different screens , used navigate between them. found strange button defined in python switched screen, while 1 defined in kv did not. perhaps i'm not accessing app class method properly? here code of issue: from kivy.app import app kivy.lang import builder kivy.uix.screenmanager import screen, screenmanager kivy.uix.button import button builder.load_string(''' <myscreen1>: button: id: my_bt text: "back" on_release: app.back ''') class myscreen1(screen): pass class testapp(app): def here(self, btn): self.sm.current = "back" def back(self, btn): self.sm.current = "here" def build(self): self.sm = screenmanager() s1 = screen(name = "here") bt = button(text = "here", on_release = self.here) s2 = myscreen1(name = "bac

c# - How to track incoming post URL in MVC controller -

i defined httppost method in asp.net mvc controller below , post url http://mydomain/home/ebook [httppost] public actionresult ebooks(string email) { //insert email database return redirecttoaction("incoming url"); } and submitting php form declaring post action mvc controller’s httppost method in php website, php website page url http://myphpsitedomain/downloads.php <form id="ebook" action="http://mydomain/home/ebook" method="post"> <label for="email">email</label> <input type="email" name="email" id="email" required="required" /> <input type="submit" value="submit" /> </form> how track php web page url when php form (above)submitted asp.net mvc httppost method? i'd post comment don't have sufficient reputation. how hitting action method? assuming you're following mvc c

r - No graph output when using googleVIS in jupyter -

using works in r console: plot(g) but when typed cell in jupyter get: starting httpd server ... done and no graph. here did. anaconda 2.7.11, installed r essentials conda install -c r r-essentials started jupyter notebook jupyter installed needed reqs, xml , googlevis, typing cell options(repos=structure(c(cran="https://cloud.r-project.org/"))) install.packages('googlevis') install.packages('xml') typed code cell suppresspackagestartupmessages(library(googlevis)) library(googlevis) library(xml) url <- "http://en.wikipedia.org/wiki/list_of_countries_by_credit_rating" x <- readhtmltable(readlines(url), which=3) levels(x$rating) <- substring(levels(x$rating), 4, nchar(levels(x$rating))) x$ranking <- x$rating levels(x$ranking) <- nlevels(x$rating):1 x$ranking <- as.character(x$ranking) x$rating <- paste(x$country, x$rating, sep=": ") g <- gvisgeochart(x, "count

javascript - A shorter class initialisation in ECMAScript 6 -

every time create class, need same boring procedure: class { constructor(param1, param2, param3, ...) { this.param1 = param1; this.param2 = param2; this.param3 = param3; ... } } is there way make more elegant , shorter? use babel, es7 experimental features allowed. maybe decorators can help? you can use object.assign : class { constructor(param1, param2, param3) { object.assign(this, {param1, param2, param3}); } } it's es2015 (aka es6) feature assigns own enumerable properties of 1 or more source objects target object. granted, have write arg names twice, @ least it's lot shorter, , if establish idiom, handles when have arguments want on instance , others don't, e.g.: class { constructor(param1, param2, param3) { object.assign(this, {param1, param3}); // ...do param2, since we're not keeping property... } } example: ( live copy on babel's repl ): class { constructor(param1, param2, param3) {

r - Cumulatively apply function in dplyr -

consider following data: df <- data.frame(names = sample(letters[1:5], 20, replace = t), numbers = 1:20) for have function cumsum , such each row in group, computes cumulative sum of numbers row library(dplyr) df %>% group_by(names) %>% mutate(cumsum_numbers = cumsum(numbers)) i wish apply general function my_fn cumulatively in same manner cumsum . my_fn has general form: my_fn <- function(vector){ # stuff vector return(x) # x numeric scalar } that is, takes vector of previous values row, , returns scalar. the following code not work: df %>% group_by(names) %>% mutate(cumsum_numbers = my_fn(numbers)) # apply my_fn # each group in numbers, returning # same value each grouping level so guess want like: df %>% group_by(names) %>% mutate(cumsum_numbers = cum_my_fn(numbers)) note example function mean calculating cumulative mean. interestingly dplyr has implement

osx - Cocoa / Core Animation: everything jumps around upon becomeFirstResponder() -

the gist: have bunch of views nested in 1 mainview . when call becomefirstresponder() on nstextfield that's nested in 1 of views, every view within mainview jumps semi-arbitrary older position. the actual cause 1 of number of things, leading among i've been writing cocoa week. here's actual structure: mainview: nsview ├ contacttile: nsview (layer-backed) | └ /* several calayers */ ├ contacttile ├ … ├ contacttile └ statustile: nsview (layer-backed) ├ searchicon: nsview (layer-backed) | └ searchiconlayer: calayer └ nstextfield i've backed core business logic reactivecocoa, async dispatches main ui thread doing drawing-related operations. the statustile initialized , added subview when mainview created, , position set top-right area of screen. contacttiles created , added dynamically — creation , subview adding happens in 1 reactivecocoa observer (leaving initial position (0, 0) ), , in "relayout" observer contacttile s sta

Get GPS Coordinates on mouse tap/click on ArcGIS Esri Map in Windows Runtime Apps (Windows 8.1) -

how gps coordinates (longitude, latitude) of clicked/tapped point in arcgis esri map? i tried mapviewtapped event like: private void mymapview_mapviewtapped(object sender, mapviewinputeventatgs e) { var x = e.position.x; //e.location.x; var y = e.position.y; //e.location.y; } both gives large unexpected values. you're using mapviewinputeventargs.position property - gives screen coordinates - see sample code show mouse coordinates . use location property map coordinates, shown in sample. worth noting it's map using web mercator coordinate system - e.g. if have created mapview using default esri basemaps. if so, map coordinates reported in meters, approximately in range -20,000,000 +20,000,000. the coordinate system wgs84 gives latitude , longitude in degrees, , used gps systems. convert point coordinate system (e.g. spatialreference of mapview, if different that), can 'project' point - use project method on geometryengine class, , pass in map

C# selenium - WebDriver wait not waiting -

i'm using page object model design selenium tests. i'm having few issues wait code in keywords below. when call keyword in nunit test using code such below trys click on button before ready. if paste same wait code in nunit test waits expected , clicks button. preference have keywords implement take care of waits , not have write in test. missing here? nunit test public void quotespagetest() { //loginto crm loginpage loginpage = new loginpage(); loginpage.userlogin(); //select quotes tile pgcommon mymenu = new pgcommon(); mymenu.gotomenu("quotes"); //click new pgquotes quotespage = new pgquotes(); keywords.dosendkeys(quotespage.btnnew); } keywords.cs using openqa.selenium; using openqa.selenium.support.ui; using system; using system.collections.generic; using system.linq; using system.text; using system.threa

Cannot run asp.net core, angular 2, server side rendering project in server -

i use "aspnet-spa" generator ( http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/ ) generate project. run locally success in server iis return error. unhandled exception occurred while processing request. win32exception: system cannot find file specified startcore > system.componentmodel.win32exception: system cannot find file specified @ system.diagnostics.process.startcore(processstartinfo startinfo) @ system.diagnostics.process.start() @ system.diagnostics.process.start(processstartinfo startinfo) @ microsoft.aspnetcore.nodeservices.outofprocessnodeinstance.<ensureready>d__16.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.aspnetcore.nodeservices.httpnodeinstance.<invoke>d__7`1.movene

c# - This site can’t be reached in IIS Windows 7 -

Image
i have simple site using asp.net. have deployet using iis manager in windows 7, here it's binding config : when open hisoka.poipo.com using laptop, got error message : weell... have been reading articles error, of them said have allow port 80 in firewall , have set port 80 opened, error still showing up. have tried hisoka.poipo.com/page.aspx but site still can't reached. have missed here...??? please help... in advance... :) did register hisoka.poipo.com in local hosts file? here %windir%\system32\drivers\etc\hosts add: 169.254.224.121 hisoka.poipo.com

javascript - Need from PHP code to create Ajax -

i need creating ajax, not familiar with. this actual php code works: $channels = array("channel1","channel2"); $arrlength = count($channels); for($x = 0; $x < $arrlength; $x++) { $ch = curl_init("somemyapiurl".$channels[$x]); curl_setopt($ch, curlopt_returntransfer, 1); $kanal = curl_exec($ch); $kanal_decode= json_decode($kanal); $ch_name= $kanal_decode ? 'true' : 'false'; echo "<button type='button' id= '".$channels[$x]."' class='btn btn-success'>"$channels[$x]."</button>&nbsp"; echo "<script> if($ch_name == false) { document.getelementbyid('$channels[$x]').classname='btn btn-danger'; } </script>";}} so here every value in $channels , checking api , create button on page, default class success. if api returns value false , script changing button class. until now, doing refresh of page interval, want page dynami

python - How to join three tables with Django ORM? -

my models are: class profiles(models.model): first_name = models.charfield() last_name = models.charfield() email = models.charfield() class meta: db_table = 'users' class products(models.model): title = models.charfield() content = models.charfield() price = models.bigintegerfield() user = models.foreignkey(profiles, related_name="product_owner") # user_id class meta: db_table = 'products' class userfollows(models.model): profile = models.foreignkey(profiles, related_name='profile_following') # profile_id following = models.foreignkey(profiles, related_name='profile_is_following') # following_id class meta: db_table = 'user_follows' to want, query raw sql query below: select * products, users, user_follows products.user_id=users.id , user_follows.following_id=products.user_id , user_follows.profile_id=12345; but need django orm. can join 'use

Connecting Spark streaming to streamsets input -

i wondering if possible provide input spark streaming streamsets. noticed spark streaming not supported within streamsets connectors destination https://streamsets.com/connectors/ . i exploring if there other ways connect them sample poc. the best way process data coming in streamsets data collector (sdc) in apache spark streaming write data out kafka topic , read data there. allows separate out spark streaming sdc, both can proceed @ own rate of processing. sdc microbatches defined record count while spark streaming microbatches dictated time. means each sdc batch may not (and not) correspond spark streaming batch (most spark streaming batch have data several sdc batches). sdc "commits" each batch once sent destination - having batch written spark streaming mean each sdc batch need correspond spark streaming batch avoid data loss. possible spark streaming "re-processes" committed batches due processing or node failures. sdc cannot re-process commi

angularjs - How to Add icon on dialogue in angular-material -

i using angular-material in project. want show dialogue using var confirm = $mddialog.confirm() .title(modalobject.header) .content(modalobject.text) .ok(modalobject.control) $mddialog.show(confirm).then(function () { var status = 'you decided rid of debt.'; }, function () { status = 'you decided keep debt.'; }); my requirement have icon header or inside body anywhere show dialogue what. eg : error, warning , success but not able achieve this. can please tell me how can resolve it. you'll have include in function.. like.. $scope.showconfirm = function (ev){ var confirm = $mddialog.confirm() .title(modalobject.header) .content(modalobject.text) .ok(modalobject.control) $mddialog.show(confirm).then(function () { var status = 'you decided rid of debt.'; }, function () { status

json - Using json4s-native library in a Spark cluster -

i trying process data in aws emr spark cluster. that, have scala application reads in raw json data s3, parses map[string, any] scala's native scala.util.parsing.json.json library , parsefull method. then have recursive function, flattens nested json (so map[string, any] not contain maps inside it) , want convert json-formatted string create spark dataframe object. for parsing map object json string, found this solution mohit. unfortunately, had problems org.json4s.native library in intellij , said cannot resolve dependency. (in hindsight, know problem of not refreshing project after updating .sbt file correct dependency. in intellij json4s.native library , functions work.) so @ first, used org.json4s.jackson.json instead. the json(defaultformats).write(m) line resulted in string integer numbers converted doubles , not correct. so got intellij working json4s.native library , result converted numbers correctly. now, however, having problems using library in sp

javabeans - Java: Trouble with wildcards/generics -

this question has answer here: what pecs (producer extends consumer super)? 8 answers i struggling using wildcards/generics. i'm trying create filemanager utility class can accept custom java beans , write read/write bean file. give example imagine have interface called data implemented recipedata , demographicdata . i'm using super csv convert csv file java bean. here read method based on tutorial code found super csv . public interface data { method declarations } public class recipedata implements data { class stuff goes here } public class demographicdata implements data { class stuff goes here } final public class filemanager { public static void parsecsvfile(string filename, cellprocessor[] processors, string[] namemappings, list<? extends data> container) { icsvbeanreader beanreader = null; try { beanreader

java - ListView overlaps Application Bar - Android -

my listview go on application bar @ edge of page, have problem in layout file. (i've used default android studio activity contain navigation drawer, application bar,...) i've used framelayout use parent sub-activity , show navigation drawer in sub-activity. nav_header_main.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="@dimen/nav_header_height" android:background="@drawable/side_nav_bar" android:gravity="bottom" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:theme="@style/themeoverlay.appcompat.dark"> <imageview

javascript - Meteor Mongo, and Flow Router -

i started using meteorjs (required job), , i'm having issue meteor mongo , flow router working together. when load page externally fetches data mongo returns empty, if go route through links internally on application (after inserting stuff mongo) doesn't return empty. i'm using auto publish, don't think subscription issue. please <3 flowrouter.route('/assessment/:token/:admin', { action: function(params, queryparams) { var test = tests.find({token: params.token}).fetch(); if(test[0] === undefined) return blazelayout.render('app', {content: '404'}); // if admin page if(params.admin && test[0].admin === params.admin) { var scores = scores.find({assessment: test[0].token}, {sort: {createdat: -1}}).fetch() , sum = 0; scores.foreach(s => sum += s.score); var mean = sum / scores.length; session.set('scores.list

c# - Making a game - What is the advantage of the secure variables? -

i have made game in unity , contains lots of public , private varibles , functions. wanted game secure , bought anti cheat toolkit unity asset store https://www.assetstore.unity3d.com/en/#!/content/10395 .so question need secured private variables ? if yes, use of private variables? advantages have (in security terms) ? do need secure private variables ? no, both public , private variables have same security defences (or rather no security defences). if attacker can view or modify public variable, can view or modify private variable. access modifiers there programmer convenience , architectural decisions.

How to bind a mouse to a key in AHK language? -

i new ahk. know how bind key key (a::b), possible bind key mouse click? it depends on key want bind. can use a::click ; of keys `;::click ; escaping special characters such ";" required

mongodb .net driver V2: How to do array operations -

i'm totally lost on doing crud , other operations on array elements in embedded array in mongodb using c# drivers. given have following classes (simple example): public class child { public objectid id; public datetime dateofbirth; public string givenname; } class family { public objectid id; public string name; public list<child> children; } my collection should store family documents. how i: add new child family delete child update 1 child count children of 1 family get youngest child of family load 1 specific child without loading whole family object although i'm taking part in mongo university class mongo.net i'm lost , documentation on working arrays not existing. i know got answers 1-4: //add child families.updateone(builders<family>.filter.where(x=>x.name=="burkhart"), builders<family>.update.addtoset("children", new child() {dateofbirth = new datetime(2