Posts

Showing posts from May, 2015

git - Cannot connect to gitlab.com or github.com from openshift-jenkins -

i installed latest openshift origin, , created jenkins project provided templates, cannot seem ping git repos (gitlab.com or github.com) jenkins instance. jenkins instance has respective plugins installed , seems working fine otherwise. doing "oc rsh " pod, , pinging gitlab.com, timeouts, though i'm not sure if expected or not. i'm guessing i'm missing obvious, cannot figure out is.

python - How to get value of pixels which are at a certain angle from another pixel? -

i'm trying implement method have obtain values of pixels forms line @ angle through pixel (i, j) consider following code snippet sum = image.getpixel(((i - 7), (j + 2))) + image.getpixel(((i - 6), (j + 2))) + image.getpixel( ((i - 5), (j + 1))) + image.getpixel( ((i - 4), (j + 1))) + image.getpixel(((i - 3), (j + 1))) + image.getpixel(((i - 2), (j + 1))) + image.getpixel( ((i - 1), j)) + image.getpixel((i, j)) + image.getpixel(((i + 1), j)) + image.getpixel( ((i + 2), (j - 1))) + image.getpixel(((i + 3), (j - 1))) + image.getpixel(((i + 4), (j - 1))) + image.getpixel( ((i + 5), (j - 1))) + image.getpixel(((i + 6), (j - 2))) + image.getpixel(((i + 7), (j - 2))) avg_sum = sum / 15 now in above code know pixels relative i, j forms line @ angle 15 degrees. hence able values of pixels. now there easy way because code find sum of grey level of 15 pixels forms line @ 15 degree through i, j. want code flexible can find sum of line of length 15 pixels or 13 p

model - Use of the auto.arima function with external regressors -

i new r , i´ve been having trouble following: i want possible combinations (up 3 independent variables in example) arimax model. suppose have thefollowing sample data: library(forecast) airpassengers_1<-ts(airpassengers, start = c(1949,1), frequency = 12, end =c(1960,12)) nottem_1<-ts(nottem, start = c(1949,1), frequency = 12, end = c(1960,12)) sunspots_1<-ts(sunspots, start = c(1949,1), frequency = 12, end = c(1960,12)) sunspot.month_1<-ts(sunspot.month, start = c(1949,1), frequency = 12, end = c(1960,12)) base<-cbind(airpassengers_1,nottem_1,sunspots_1,sunspot.month_1) i going use airpassengers_1 variable dependent variable , others independent variables. next create matrix possible combinations of explanatory variables going included in auto.arima formula (forecast package). cant_variables<-dim(base)[2]-1 cant_regresores<-3 x=c(1:cant_variables) if(cant_regresores==1){ v<-t(combn(x, 1)) v<-cbind(v,matrix(0,nrow(v),2)) h<

r - resolve metaMDS error : "veg_distance" not available for .C() for package "vegan" -

i keep getting following error when trying run metamds() vegan package: my_mds <- vegan::metamds(df_species, distance="bray", k=2, trymax=1000, autotransform=true) error in .c("veg_distance", x = as.double(x), nr = n, nc = ncol(x), d = double(n * : "veg_distance" not available .c() package "vegan" i have tried: 1. searching online error - yields 0 results 2. reducing size of data frame 17 rows , 12 columns 3. clearing packages global environment eliminate potential package conflicts 4. specifying vegan::metamds nothing has worked. can provide solution error? example data here: structure(list(species_1 = c(68.75, 51.4583333333333, 67.1666666666667, 36.3333333333333, 37.1666666666667, 45, 34.25, 20.9583333333333, 41.75, 85.7272727272727, 63.5, 27.1666666666667, 59.5, 76.75, 50.1666666666667, 35.25, 42), species_2 = c(21.3333333333333, 26.2916666666667, 32.7083333333333, 36.6666666666667, 26.25, 24.7

postgresql - ERROR: current transaction is aborted, commands ignored until end of transaction block --- export data from Aqua studio -

i trying export 1 table aquastudio csv file. table has approximately 4.4 million rows. when trying use export window function in aqua studio, facing following error: error: error: current transaction aborted, commands ignored until end of transaction block i not understanding problem is. read few articles regarding error , found happening due error in last postgresql command. did not use sql commands export , dont know how debug this. unable view log files. you shouldn't exporting millions of rows through jdbc/odbc connection, redshift. for redshift, please use unload command documented here . you'll have unload file s3 , download there. for postgres, use copy to documented here .

python - Data scraping basketball data using beautiful soup -

i want return names of these 3 players (in url).. current code returns name, team, , basketball association. there can specify in code return names? data scraping here : import requests bs4 import beautifulsoup def bball_spider(str): source_code = requests.get(str) plain_text = source_code.text soup = beautifulsoup(plain_text, "html.parser") # players elements in soup.find('table' , {'id' : 'stats'}).findall('a'): names = elements.string print(names) str = input("enter query result url ") bball_spider(str) you there, first let me mention since seems new python: shouldn't name variable str , because shadows built-in str class, that's modified in code shown below. important modification changed .findall('a') .findall('td',{'class':'left active'}) , inspecting element can see names of players in <td> tag class left active . changed iterating

javascript - access to elements of an array in js vs hashtable in c++ or c# performance? -

js uses hash table access elements of array. slower method of accessing array elements in c++ or c# languages? var arr=[]; arr[0]=23; arr[1]=12; arr['2tr5']=54; is algorithm accesses elements of array in js same hashtable in c++ or c#? how can speed access elements directly , why doesn't js use dense array fast access elements.

python - How to correctly use Numpy's FFT function in PyTorch? -

i introduced pytorch , began running through library's documentation , tutorials. in "creating extensions using numpy , scipy" tutorial ( http://pytorch.org/tutorials/advanced/numpy_extensions_tutorial.html ), under "parameter-less example", sample function created using numpy called "badfftfunction". the description function states: "this layer doesn’t particularly useful or mathematically correct. it aptly named badfftfunction" the function , usage given as: from numpy.fft import rfft2, irfft2 class badfftfunction(function): def forward(self, input): numpy_input = input.numpy() result = abs(rfft2(numpy_input)) return torch.floattensor(result) def backward(self, grad_output): numpy_go = grad_output.numpy() result = irfft2(numpy_go) return torch.floattensor(result) def incorrect_fft(input): return badfftfunction()(input) input = variable(torch.randn(8, 8)

Understanding kwargs in Python -

what uses **kwargs in python? i know can objects.filter on table , pass in **kwargs argument.   can specifying time deltas i.e. timedelta(hours = time1) ? how work? classes 'unpacking'? a,b=1,2 ? you can use **kwargs let functions take arbitrary number of keyword arguments ("kwargs" means "keyword arguments"): >>> def print_keyword_args(**kwargs): ... # kwargs dict of keyword args passed function ... key, value in kwargs.iteritems(): ... print "%s = %s" % (key, value) ... >>> print_keyword_args(first_name="john", last_name="doe") first_name = john last_name = doe you can use **kwargs syntax when calling functions constructing dictionary of keyword arguments , passing function: >>> kwargs = {'first_name': 'bobby', 'last_name': 'smith'} >>> print_keyword_args(**kwargs) first_name = bobby last_name = smith the python

java - Casting return type from interface -

i making lrucache app. i've got interface. cannot change it. implements methods , don't know how return cache instead of interface type. in method getitem() instead of returning specific value can return whole map. public class lrucache<k, v> extends linkedhashmap<k, v> implements cache view{ private static final long serialversionuid = 1l; private int limiter; private lrucache<string, object> lruinst; private lrucache(int size) { super(size, 0.75f, true); this.limiter = size; } @override protected boolean removeeldestentry(map.entry<k, v> eldest) { return size() > limiter; } public static<string,object> lrucache<string,object> newinstance(int size) { return new lrucache<>(size); } @override public cacheitem getitem(int index) { list<string> keylist = new arraylist<string>(lruinst.keyset()); (int = 0; < lruinst.size(); i++) { string key = keylist.get(i); obje

Managed ElasticSearch Hosting vs Self-Hosting -

i weighing benefits/drawbacks using self-hosted es vs elasticco hosted es vs aws hosted es , appreciate insight has. lot of have found through googling out-of-date. my use-case regular search-functionality start, plan on building out scalable, large-batch targeting. from understand: managed es abstracts lot of server maintenance pain while sacrificing fine-tuning granularity. managed es gives built in security managed es have pay additionally support (or suffer) aws managed es: comes automated backups s3, monitoring instances , patching software powers amazon elasticsearch instance has aws access-control issues(this might out-dated) must purchase additional support - cannot ssh box elastic.co managed es: has recent version must purchase expensive additional support easy scale clusters self-hosted es: gives greater control on configuration need build own security enhancements requires ops server-maintenance/management/upgrades

init variable in c++ -

i encountered strange problem, @ times, @ no. when read data file insert map, data read file attached struct type traderecord , insert map. when init object order_tmp don't assign value 0 have field in traderecord don't have in file assign junk value c++ compiler. //struct traderecord struct traderecord { int order; // order ticket int login; // owner's login char symbol[12]; // security int digits; // security precision int cmd; // trade command int volume; // volume //--- __time32_t open_time; // open time int state; // reserved double open_price; // open price double sl,tp; // stop loss & take profit __time32_t close_time; // close time int gw_volume; // gateway order v

session - How could I redirect a user to a pre-filled cart in other pages? -

i know how can redirect users different pages carts pre-filled ¿anyone has idea? examples in pages like: https://www.walmart.com.mx/ https://www.superama.com.mx/ http://www.chedraui.com.mx/

php - get the request domain on file_get_contents -

i have simple app other websites can use using file_get_contents file_get_contents( 'http://example.com/data-center-request/' ); is there anyway track or domain/ip requester? without letting them specify on url parameters? the $_server['http_referer'] undefined. thanks.

nvidia - Installing cuDNN on elementry os gives segmentaion fault -

i'm installing cudnn official nvidia site. installed cuda. following commands used during installtion: tar -xzvf cudnn-9.0-linux-x64-v7.tgz sudo cp cuda/include/cudnn.h /usr/local/cuda/include sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 sudo chmod a+r /usr/local/cuda/include/cudnn.h everything fine upto here. when run command: /usr/local/cuda/lib64/libcudnn* it gives me segmentaion fault. can't figure out problem !

javascript - Distribute an JS Exell add-in offline using Office JS API -

i want make add-in team populate information using rest. found out office js api excel 2016, unclear how add-in distributed. the company work huge, , security big thing. has on prem. don't want want go through trouble of hosting on web server since have approval etc. is there way give team add-in , install way? or option host somewhere? an excel add-in uses office js apis web application must hosted on web server or in cloud-based web application hosting service. if team using windows computers, in theory each enable mini-iis web server on computers , host web application in own computers. they'd have remember start server every time wanted use add-in. bug fixes , updates have distributed too. think lot less trouble web server.

authentication - How can i authenticate Windows User Credentials in VB.NET -

i trying authenticate windows user in vb.net without domain, since computers not in specific domain. i have used code following link authenticate in domain, getting no luck in authentication without domain. verifying user details , auto-login windows can me sort out?

c# - asp.net jit multiple core slow -

using iis i'm running asp.net 4.5 , trying find way improve jit times on machine multiple(8) cores. test use timing 100 different pages. machine i'm testing on 4 core, 8 logical processors. the maximum see csc or w3p 13% appears it's using 1 core. i've read since asp.net 4.5 multicore jit on default. ok sure, it's still 13%. read ngen trying on dll's in bin dir. didn't have affect on timing perfview seems have done something. antivirus off @ time of testing. test timings: peformed after first page has loaded cold prejit (first run) 10.25 min hot run (second run) 2.32 min ngen first run 10.24 min perfview jitstats cold prejit -process cpu time: 161,038 msec -total number of jit compiled methods : 13,193 -total msec jit compiling : 2,630 -jit compilation time percentage of total process cpu time : 1.6% process not use background jit compilation ngen first run -process cpu time: 144,152 msec -total number of jit compiled met

amazon web services - Exception with Table identified via AWS Glue Crawler and stored in Data Catalog -

i'm working build new data lake of company , trying find best , recent option work here. so, found pretty nice solution work emr + s3 + athena + glue. the process did was: 1 - run apache spark script generate 30 millions rows partitioned date @ s3 stored orc. 2 - run athena query create external table. 3 - checked table @ emr connected glue data catalog , worked perfect. both spark , hive able access. 4 - generate 30 millions rows in other folder partitioned date. in orc format 5 - ran glue crawler identify new table. added data catalog , athena able query. spark , hive aren't able it. see exception below: spark caused by: java.lang.classcastexception: org.apache.hadoop.io.text cannot cast org.apache.hadoop.hive.ql.io.orc.orcstruct hive error: java.io.ioexception: org.apache.hadoop.hive.ql.metadata.hiveexception: error evaluating audit_id (state=,code=0) i checking if serialisation problem , found this: table created manually (configuration): input f

html - can i change the width of image, that put by content in css -

Image
i making round tabs form steps, have change image when link active. it's changing size of changed image different. should this? css: li.active span.round-tabs.two { border: 2px solid #ddd; color: #febe29; background: blue !important; content: url('../images/round-tap-icons/round-tab-icon-3.png'); } <ul class="nav nav-tabs" id="mytab"> <div class="liner"></div> <li class="active"> <a href="#home" title="welcome"> <span class="round-tabs one" onclick="showtabimg()"> <img src="images/round-tap-icons/round-tab-icon-1.png" /> <img src="images/round-tap-icons/round-tab-icon-1-white.png" style="display:none" /> </span> </a> <h3>order</h3> </li> <li> <a href="#wallet" data-toggle="t

php - Full Calendar double events if i change to month -

i have full calendar script default view on agendaweek. reason when change month calls get-events again , don't know why, doubles events. here script. don't see in cod calling calendar again if change view. when submit form store events in database call events again see them on calendar without refreshing , if press on month after calls get-events again, causing double events. how can stop getting events again when change month view? <script> $( "body" ).on('change','#trotineta',function() { var trotineta=$( "#trotineta" ).val(); var url='php/get-events.php?trotineta='+ trotineta; $('#calendar').fullcalendar( { defaultview: 'agendaweek', header: { left: 'prev,next today', center: 'title', right: 'month,agendaweek,agendaday

Cannot change the location of a gradleReference in a Cordova plugin for Android -

Image
i'm using cordova / ionic 2 / android . i have 1 plugin following plugin.xml file: <?xml version="1.0" encoding="utf-8"?> <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-hash-generator" version="0.0.1" > <name>hash generator</name> <js-module name="main" src="www/hash-generator.js"> <clobbers target="hashgenerator" /> </js-module> <platform name="android"> <config-file parent="/*" target="res/xml/config.xml"> <feature name="hashgenerator"> <param name="android-package" value="com.tophtml.plugins.hashgenerator" /> </feature> </config-file> <source-file src=&qu

uivisualeffect view ios swift navigation bar -

Image
hi iam getting blue color visualeffectview on navigation bar on running. didnt changed background colour .how fix issue please help. code navigate viewcontroller mainviewcontroller let storyboard = uistoryboard(name: commonstoryboard.list, bundle: nil) let vc = storyboard.instantiateviewcontroller(withidentifier: commonnavigationcontrollers.listviewcontroller ) self.show(vc uiviewcontroller, sender: vc)

javascript - How to inserting json stringify object into database with php mysqli -

hi guy's need help. try create function inserting data json stringify object mysql database use php mysqli. the json stringify data got code $(document).ready(function(){ $("#submit-file").click(function(){ var myfile = $("#files")[0].files[0]; var json = papa.parse(myfile, { skipemptylines: true, complete: function(results) { var serialize = json.stringify(results); $.ajax({ type: "post", url: "../php/tagihan/save_data.php", data: {array:serialize}, cache: false, success: function(data) { console.log(data); } }); } }); }); }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/papaparse/4.3.5/papaparse.min.js&qu

swift - Use of undeclared type 'BackendlessCollection' -

hi new backendless. please help. getting error use of undeclared type 'backendlesscollection' while using in ios . swift i have written function retrieveblurbs() in home view controller.i have created 1 more object medicinelist class this class medicinelist : nsobject { var objectid : string? var name : string? var desc : string? var created : nsdate? var updated : nsdate? } func retrieveblurbs() { var backendless = backendless.sharedinstance() let query = backendlessdataquery() // use backendless.persistenceservice obtain ref data store class backendless.persistenceservice.oftable(medicinelist.ofclass()).find(query, response: { ( medicinelist : backendlesscollection!) -> () in let currentpage = medicinelist.getcurrentpage() print("loaded \(currentpage.count) medicinelist objects") print("total restaurants in backendless starage - \(medicinelist.totalobjects)") medicinelist

java - Vaadin 8.1 generating description tooltip for Tree items -

is there way add different tool tip items in vaadin 8.1 tree? vaadin using description tooltip. vaadin using description tool-tip. can not find description related item. tree component has description no description each item. idea? tree.setitemdescriptiongenerator removed in vaadin 8, there issue github.com/vaadin/framework/issues/9803 , delivered commit: https://github.com/vaadin/framework/commit/5ef925daa91b1253f170f244e2a992f4f92979e1

javascript - How to make canvas elements reach the center of the canvas -

i'm populating canvas arcs @ random position want them move center of canvas, jump center of canvas , not moving center. road far <canvas id="mycanvas"></canvas> <script> var mycanvas = document.getelementbyid("mycanvas"); var c = mycanvas.getcontext("2d"); mycanvas.style.backgroundcolor = "#000"; mycanvas.width = 600; mycanvas.height = 600; var myarr = []; var firstcircle; function circledraw(x, y, r) { this.x = x; this.y = y; this.r = r; this.draw = function() { c.beginpath(); c.arc(this.x, this.y, this.r, 0, math.pi * 2); c.fillstyle = "#fff"; c.fill(); } this.update = function() { this.x = mycanvas.clientwidth/2; this.y = mycanvas.clientheight/2; } } for(var =0; < 10; i++){ var x = math.random() * mycanvas.clientwidth;

sql server - sql query for logins for days -

my question table: userid logintime logouttime 1 1/8/17 10am 1/8/17 9pm 2 1/8/17 9am 1/8/17 10pm 3 1/8/17 11am 1/8/17 6pm 1 2/8/17 11am 2/8/17 7pm 2 2/8/17 6am 2/8/17 4pm 3 2/8/17 8am 2/8/17 3pm 1 3/8/17 4am 3/8/17 1pm 2 3/8/17 11am 3/8/17 11pm 3 3/8/17 5am 3/8/17 5pm i need sql query time gap between user 1st day second day example answer table: userid logintime logouttime timegap 1 1/8/17 10am 1/8/17 9pm 25 hours 1 2/8/17 11am 2/8/17 7pm time gap userid=1 1/8/17 10am 2/8/17 11am 25 hours below use common table expression (cte) on existing table increments userid , ordered logintime earliest last, join joining on row number +1 with cte as( select userid, logintime, logouttime, row_number() on (p

python - use inverse transformed values as label in plot -

i have categorical data , have used 1 hot encoder follows: lb_make = labelencoder() df["column_name"] = lb_make.fit_transform(df["column_name"]) i using prophet() library component data. , not able use inverse_transform() data labels in plot. idea how achieve ? regards, vk

javascript - Express route handle for admin and admin/* with same routes -

my admin/whatever url rendering admin file when try hit admin show 404 not go in route. can create separate route url/admin other option. manage single route . app.get('/admin/*', function (req, res, next) { res.render('admin'); }); remove / after admin can match route app.get('/admin*', function (req, res, next) { res.render('admin'); });

http status code 403 - 403 forbidden issue in Jmeter -

i have jmeter test following configuration: thread name: thread group 1-1 sample start: 2017-08-18 12:45:02 ist load time: 304 connect time: 0 latency: 304 size in bytes: 209 headers size in bytes: 206 body size in bytes: 3 sample count: 1 error count: 1 data type ("text"|"bin"|""): text response code: 403 response message: forbidden unfortunately fails following response headers: http/1.1 403 forbidden content-type: application/octet-stream date: fri, 18 aug 2017 07:15:03 gmt server: openresty/1.9.3.1 x-vcap-request-id: c9307775-0897-4fbd-5d45-e2e7c11cb1b1 content-length: 3 what missing? in advance. this issue can have lot of causes: missing content-type header missing authentication token missing csrf token failing authentication before access url ... can show request send ?

jmeter - Load generator machine (windows) reaching to 100% CPU -

Image
i running 2250 users test aws windows vm, following details. windows ram: 32gb cpu: 8 core once test reaches 600 concurrent users cpu going 100% utilization. action taken resolve this,(using jmeter test) increased heap size (heap=-xms512m -xmx12288m) removed lisners test. running test non gui mode. still load generator machine reaching 100%. whould best solution fix issue. first check follow best practices in test: http://jmeter.apache.org/usermanual/best-practices.html http://www.ubik-ingenierie.com/blog/jmeter_performance_tuning_tips/ then better use linux machine instead of windows scales better. finally try increasing machine type give more cpus.

ios - SpriteKit detecting multiple collision instead of once ( Swift 3) -

there 3 skspritenode in skscene class. 1 of them player , other ones gold , unvisible finish object such when player touch it, game finished. problem when player collide gold, gold budget should increase 50 gold. however, xcode detect multiple collision , gold budget increasing multiple times. 50-60 collision detected instead of 1 collision. researched how solve problem. found should use bool, tried set bool didn't solve problem. there can me how detect 1 collision? here gamescene class codes : import spritekit import gameplaykit class level3: skscene, skphysicscontactdelegate { let playerfilename = "player" let starfilename = "50gold" let goalfilename = "goal" let playercategory : uint32 = 0x1 << 1 let goalcategory : uint32 = 0x1 << 2 let starcategory : uint32 = 0x1 << 3 override func didmove(to view: skview) { super.didmove(to: view) physicsworld.contactdelegate = self

javascript - jQuery overlapping div wont nullify the hidden onclick of div -

jquery('#warning').click(function() { console.log('clicked @ warning'); }); jquery('#content').click(function() { console.log('clicked @ content'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="warning"> <div id="content">this content</div> dsfdfsdsfdsfdsfdsfdsfdsf </div> fiddle: https://jsfiddle.net/73jykhj0/ unfortunatly clicking @ content triggers clicking @ warning too. how eliminate clicking @ warning ? prevent event bubbling using event.stoppropagation() jquery('#warning').click(function() { console.log('clicked @ warning'); }); jquery('#content').click(function(event) { event.stoppropagation() console.log('clicked @ content'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">&

windows - Hide the redirected drives -

when redirecting local drive rds ts , using "net use drive_letter share_name" end 2 entries each redirected drive in computer: 1) share_name on computer_name 2) share_name (drive_letter) for example, if redirect directory named "kingston" computer named "archer" get: 1) kingston on archer after using command net use g: \tsclient\kingston i 2 enrties: 1) kingston on archer 2) kigston (\tsclient) (e:) is there way hide first entry avoid confuse users? so far tried: 1) erase share name in registry https://discussions.citrix.com/topic/300387-hiding-mapped-client-drives-content-redirection/ but leaves system folder each "removed" share not @ all 2) make appropriate folder hidden. tried set hkcu\software\classes{clsidxyz}\shellfolder\attributes 0xf008000 according https://msdn.microsoft.com/ru-ru/library/windows/desktop/bb762589(v=vs.85).aspx sfgao_hidden 0x00080000 but still see share notes: folder option

Office Add-in are not showing on Outlook for IOS Add-in list -

we have outlook add approved ios. https://store.office.com/en-001/app.aspx?assetid=wa104380464 in cases add-in showing in add-in list on outlook ios. add-in list however, tenant shows default add-ins. no other add-ins deployed on exchange online add-in catalog has ios support showing. tried different accounts , devices on these tenants. nothing happens add-in not showing. question is. is there setting on exchange online or office 365 disable this? or why showing on tenant , other not? hope quick response, thanks. for add-in visible on outlook mobile has have mobile form factor , should either side-loaded or approved outlook mobile. iplanner pro has mobile form factor not approved outlook mobile. reason not visible until , unless side-loaded. you can uninstall addin management screen in settings , reset account , confirm if addin still appears. if not, sideloaded you. thing add installing addin not approved iplanner pro store not make visible on mobile.

Can android.graphics.pdf.PdfRenderer handle the embed links in pdf pages (or simply provide the position and url of the link in pdf pages)? -

question i'm using android.graphics.pdf.pdfrenderer convert page bitmap, show imageview. i want support clicking on links in page. how can accomplish this? ref: https://developer.android.com/reference/android/graphics/pdf/pdfrenderer.html https://github.com/googlesamples/android-pdfrendererbasic/issues/13 https://github.com/googlesamples/android-pdfrendererbasic https://developer.android.com/samples/pdfrendererbasic/src/com.example.android.pdfrendererbasic/pdfrendererbasicfragment.html

Chrome throws CORS error when calling https from http, and ASP Core does not send CORS header -

is request considered cors if between addresses in same domain different protocol? because code 401 in console: xmlhttprequest cannot load https://xxx.yyy.com/appname/css/left-pane-menu.component.min.css. no 'access-control-allow-origin' header present on requested resource. origin 'http://xxx.yyy.com' therefore not allowed access. response had http status code 401. on 1 hand, asp core not send cors headers same origin, on other chrome not accept request other protocol. wow. what options besides calling resources same protocol. can't that. need call https due azure enterprise proxy setting mislead site thinking called http when called https base url tag in html set http://xxx.yyy.com/myapp , chrome throw cannot access insecure resources secure connection. my startup.cs looks this: public void configureservices(iservicecollection services) { services.addcors(); services.addmvc() .addjsonoptions(x => {

Why chrome remove wrong css class? -

Image
browser: chrome 60.0.3112.78 original: cssrulelist {0: cssstylerule, 1: cssstylerule, 2: cssstylerule, 3: cssstylerule, length: 4} length:4 0:cssstylerule {selectortext: ".highlight", style: cssstyledeclaration, type: 1, csstext: ".highlight { background-color: rgb(182, 246, 156); }", parentrule: null, …} 1:cssstylerule {selectortext: ".highlight:hover", style: cssstyledeclaration, type: 1, csstext: ".highlight:hover { background-color: rgb(124, 208, 124); }", parentrule: null, …} 2:cssstylerule {selectortext: ".highlightb6f69c:hover", style: cssstyledeclaration, type: 1, csstext: ".highlightb6f69c:hover { background-color: rgb(124, 208, 124); }", parentrule: null, …} 3:cssstylerule {selectortext: ".highlightb6f69c", style: cssstyledeclaration, type: 1, csstext: ".highlightb6f69c { background-color: rgb(182, 246, 156); }", parentrule: null, …} operation: > document.getelementbyi

Caching in Azure Functions using python -

i using azure queue trigger in azure function. my azure function connects mongodb , fetches collections. some of collections common queue jobs , can vary 1000 documents 1 million documents.i need cache collections. i don't want use external caching services(azure redis server etc). is there way use disk caching(or other kind of caching)? i using python 3.5.2. i have used diskcache cache mongodb results. diskcache apache2 licensed disk , file backed cache library, written in pure-python, , compatible django.

php - Spipu HTML2PDF not render UTF-8 font (khmer language) -

i try generate pdf both english , khmer font, render of khmer font "?" instead. try { $html2pdf = new html2pdf("p", "a4", "en", true, "utf-8", [0, 0, 0, 0]); $html2pdf->pdf->setdisplaymode("fullpage"); ob_start(); include "property_pdf.pdf"; $content = ob_get_clean(); $html2pdf->writehtml($content); error_reporting(0); $html2pdf->createindex("", 30, 12, false, true, 1); $html2pdf->output("sample.pdf"); } catch (html2pdfexception $e) { $formatter = new exceptionformatter($e); echo $formatter->gethtmlmessage(); }

linux - Gtk+3 &C & Glade problems -

i tried make simple gui program c , glade on linux. wrote simple program , design window glade. when run code says: (gtk-test:23026): gtk-critical **: gtk_widget_show: assertion ‘gtk_is_widget(widget)’ failed and no window open. searched bit on internet cant helpful. have convert glade file .xml didn't work. c #include <gtk/gtk.h> int main(int argc, char *argv[]) { gtkbuilder *builder; gtkwidget *window; gtk_init(&argc, &argv); builder = gtk_builder_new(); gtk_builder_add_from_file (builder, "window_main.glade", null); window = gtk_widget(gtk_builder_get_object(builder, "window_main")); gtk_builder_connect_signals(builder, null); g_object_unref(builder); gtk_widget_show(window); gtk_main(); return 0; } void on_window_main_destroy() { gtk_main_quit(); } glade <?xml version=1.0 encoding="uft-8"?> <!-- generated glade 3.18.3 --> &l

php - Laravel Repository eagle load pre defined accessor -

just wanted know if possible eager load define accessor in laravel repository. using l5-repository package , laravel 5.4. in userinfo.php model, have function public function getfullnameattribute() { return ucfirst($this->first_name . " ". $this->last_name); } then trying eager load accessor in controller this. $user_infos = $this->repository->with('full_name')->all(); // or $user_infos = $this->repository->with('getfullnameattribute')->all(); return response()->json([ 'data' => $user_infos ]); i know not gonna work. looking similar way add accessor full_name in collection. don't need concatenate in front end. expected result { id : 1, first_name : "sample fname", last_name : "sample lname", ..... ..... full_name : "sample fname sample lname", } use $appends in model userinfo.php protected $appends = ['full_name']; this appen

javascript - Calculating line coordinates in Fabric.js -

i developing self graphing program draws binary tree using fabric.js. far have added draw node functions , working on drawing links between nodes, coordinates isn't getting calculated properly. can me point out error is? function(node1,node2,angle) draws node2 @ 200pixels away node1 @ angle passed. found start points of line following same method founded circle center adding circle's radius 20 in case instead of 200 pixels. end points calculated subtracting 20 200 , hence using value 180. code wrote: code: function addnode(node1,node2,angle) { var intialx=parseint(node1.get('left')); var initialy=parseint(node1.get('top')); if(angle<180) { var pointx =math.abs(math.cos(angle*math.pi/180)*200+intialx); var pointy=math.abs(math.sin(angle*math.pi/180)*200-initialy); var initiallinex=math.abs(math.cos(angle*math.pi/180)*20+intialx); var initialliney=math.abs(math.sin(angle*math.pi/180)*20-initialy);

symfony - Twig: Access a parameters in url -

suppose have symfony url: http:/www.site.com/page/parameter how can access "parameter" in twig? mean, conversion of $this->getpageparams() in symfony repository. i don't want explode url or similar, it's weird. thanks! in order access last element of pathinfo, following: {{ app.request.pathinfo|split('/')|last }} see this working example

c# - Send parameters in teleric controller -

i have teleric kendo ui automatic generated chart controller. , need send parameter. want load chart partial view , tryed send parameter this: @html.partial("~/views/graphs/tablestatementschart.cshtml", new { @model.servicesmodel.id } ); this doesn't work me, okay, tryed code: @{html.renderpartial( "~/views/graphs/tablestatementschart.cshtml", new { id = model.servicesmodel.id }); } and after had no data in chart diagram. how send model id in controller? this code of controller: namespace narkomapp.controllers.graphs { public class tablestatementschartcontroller : controller { private narkomdb db = new narkomdb(); int idservice = 0; public actionresult tablestatementschart(int id) { idservice = id; return view("~/views/graphs/tablestatementschart.cshtml"); } [httppost] public actionresult tablestatements_read(int id) { idservi

r - Adding a third dimension on a 2D heatmap -

Image
i wondering if me out following question: i have correlation matrix , third variable (continuous) every possible pair in correlation matrix. here toy example: set.seed(1234) x <- rnorm(1000,2,1) y <- 0.1*x+rnorm(1000,1,1) z <- y+rnorm(1000) third.dimension <- c("(x,y)" = 0.3, "(x,z)" = 0.5, "(y,z)"= 1) my.df <- data.frame(x,y,z) first, want create heatmap of correlation matrix with heatmap(cor(my.df)) next, have coloured dot within each "cell" of heatmap, depending on value of third dimension respective pair. example - if value between 0 , 0.49, have black dot, if between 0.5 , 1, grey dot etc. hence, have correlation between z , y, say, have grey dot painted in corresponding "cell" of correlation matrix. thanks in advance help! this should work you: set.seed(1234) x <- rnorm(1000,2,1) y <- 0.1*x+rnorm(1000,1,1) z <- y+rnorm(1000) third.dimension <- c("(x,y)" = 0.3, &qu

go - Why does golang repeats the same random number? -

i'm new golang , not sure why prints same number rand.intn(n int) int every run: package main import ( "fmt" "math/rand" ) func main() { fmt.println(rand.intn(10)) } the docs says : intn returns, int, non-negative pseudo-random number in [0,n) default source. panics if n <= 0. and how seed random number generation? by calling rand.seed() function, passing (random) seed (typically current unix timestamp). quoting math/rand package doc: top-level functions, such float64 , int, use default shared source produces deterministic sequence of values each time program run. use seed function initialize default source if different behavior required each run. example: rand.seed(time.now().unixnano()) if rand.seed() not called, generator behaves if seeded 1: seed uses provided seed value initialize default source deterministic state. if seed not called, generator behaves if seeded seed(1).

winforms - c# datagridview checkboxes matrix -

Image
i trying make datagridview checkboxes matrix work in particular way. mandatory requirements are. only 1 checkbox in datagridview row can selected. one checkbox per row must selected. program reading file during start , creating rows 3 out of 5 columns tick boxes column. make work in such way 1 tick box can selected per row , make impossible deselect tick box nothing in row selected. currently make sure 1 tickbox per row selected using code: private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) { (int = 0; <= 2; i++) { datagridview1.rows[e.rowindex].cells[i].value = false; } } nevertheless see row 2-3 have nothing selected. how can prevent unchecking checked box leave ability check other box in row? not sure want, may try this: private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) { if (datagridview1.rows[e.rowind