Posts

Showing posts from July, 2012

Python Pyforms : how to use css in Pyforms or html-api in pyforms -

i using pyforms generating forms. but, have use stylesheet/css/html-api in pyforms. follow step have been given on link . want know how add css , making layout beautiful. can please give me better solution that youu can add css stylesheet importing settings , adding settings.py file reference css file. from pysettings import conf import settings conf+=settings settings.py pyforms_stylesheet = "stylesheet.css" see the accompany tutorial .

python - How get zabbix enabled host,Through the use of API -

this code,it can host.i need enabled host. import requests import csv import json url = 'https://xxxx.zabbix.com/api_jsonrpc.php' post_data = { "jsonrpc": "2.0", "method": "host.get", "params": { "filter":{ "with_monitored_items": true}, "output": ["host"], "selectinterfaces": ["ip"]}, "id": 1, "auth": "xxxxxxxxxxxxxxxxxx"} post_header = {'content-type': 'application/json-rpc'} ret = requests.post(url, data=json.dumps(post_data), headers=post_header, verify=false) data = ret.json()['result'] # print(data) parsed_result = [{'host': i['host'], 'eth0': i['interfaces'][0]['ip'], 'type': 'vm', 'sta

sql - How to use subquery in the join function of Yii framework 2 ActiveRecord? -

below pure sql query. select a.*, b.* inner join b on a.id = b.a_id inner join ( select a_id, max(add_time) max_add_time b group a_id ) m on b.a_id = m.a_id , b.add_time = m.max_add_time order b.add_time desc i have subquery in second inner join . below active query. $subquery = b::find()->select(['a_id', 'max(add_time) max_add_time'])->groupby('a_id'); $query = a::find()->innerjoin('b', 'a.id = b.a_id') ->innerjoin('(' . $subquery->prepare(yii::$app->db->querybuilder) ->createcommand() ->rawsql . ') m', 'b.a_id = m.a_id , a.add_time = m.max_add_time ') ->orderby('b.add_time desc'); it works fine, not way use subquery in second inner join . want approach query select left table inner join right table, group a_id , or

ios - decoding base 64 swift 2.3 -

i have following extension: extension string { func frombase64() -> string? { guard let data = nsdata(base64encodedstring: self, options: nsdatabase64decodingoptions(rawvalue: 0)) else { return nil } return string(data: data, encoding: nsutf8stringencoding)! } func tobase64() -> string? { guard let data = self.datausingencoding(nsutf8stringencoding) else { return nil } return data.base64encodedstringwithoptions(nsdatabase64encodingoptions(rawvalue: 0)) } } and have base 64 encoded string: r79gqdntt/0+cju7pduqfa== func dostuff(sample : string){ let samplebase64decoded = sample.frombase64() } when calling function, (dostuff("r79gqdntt/0+cju7pduqfa==")) runtime error referring finding nil while unwrapping optional: return string(data: data, encoding: nsutf8stringencoding)! what reasons there swift not being able convert base64 data string?

listbox - how to add a specific value from a list box in vb.net? -

Image
how can retrieve total price listbox , total in textbox?? code add data listbox private sub cbitem_selectedindexchanged(byval sender object, byval e system.eventargs) handles cbitem.selectedindexchanged if cbitem.selectedindex < 0 return dim price = convert.todecimal(items(cbitem.selectedindex, 1)) txtitemprice.text = price end sub private sub btnadd_click(byval sender system.object, byval e system.eventargs) handles btnadd.click dim price = convert.todecimal(txtitemprice.text) dim quantity = convert.toint32(txtquantity.text) dim totalprice integer = price * quantity lstorder.items.add(cbitem.selecteditem & vbtab & vbtab & vbtab & price & vbtab & vbtab & vbtab & quantity & vbtab & vbtab & totalprice) end sub suppose have 2 controls : listbox1 , textbox1. ' initialise textbox 0 textbox1.text = 0 ' insert values in listbox listbox1.items.add(1) listbox1.items.add(2) listbox1.ite

bash - Calling a script within a script that was run via nohup -

i have script, when run screen, works perfectly. directory structure follows: /home/username/processing/scriptrunning /home/username/processing/functions/include_me in script, opens script, contains function doing this: #!/bin/bash #this scriptrunning script . functions/include_me now when call script using following nohup command: nohup /home/username/processing/scriptrunning this output: /home/username/processing/scriptrunning: line 3: /home/username/functions/include_me: no such file or directory it seems missing out processing directory i've altered line within scriptrunning have full path, both hardcoded /home/username/processing , having variable created calling $(pwd) , error same. am missing stupid? this isn't nohup issue. including source file using relative file name. try: . $(dirname ${bash_source})/functions/include_me to include source file located relative ${bash_source}

javascript - Facebook Open Graph Sharing Debugger not reading my code well -

when check url on open graph debugger , click on scrape again https://developers.facebook.com/tools/debug/sharing/?q=https%3a%2f%2fwww.tvsrbija.online%2findex.php i strange error our page has meta tags in body instead of head. may because html malformed , fell lower in parse tree. please fix in order tags usable. but code fine when source. tried scraping blank index.php file, , when do, here facebook sees <!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/tr/rec-html40/loose.dtd"> <html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head></html> but there no such code, if go blank index.php page of site , check source blank... but, when use index.html instead of index.php facebook sees no code should empty index.php problem script php , not html can not use html extension fix problem. tried rewriting .php extension html because

javascript - jQuery: How can I remember clicked-tab of side-nav and make it colored(active) when newly page loaded? -

Image
part of html code of side-nav: <div class="side-nav margin-bottom-60"> <div class="side-nav-head"> <button class="fa fa-bars"></button> <h4>categories</h4> </div> <ul class="list-group list-group-bordered list-group-noicon uppercase"> <li class="list-group-item active"> <a class="dropdown-toggle" href="#">women</a> <ul> <li><a href="#"><span class="size-11 text-muted pull-right">(123)</span> shoes &amp; boots</a></li> <li class="active"><a href="#"><span class="size-11 text-muted pull-right">(331)</span> top &amp; blouses</a></li> <li><a href="#"><span class="size-11 text-mu

javascript - Change URL parameters -

i have url: site.fwx?position=1&archiveid=5000&columns=5&rows=20&sorting=modifiedtimeasc what need able change 'rows' url param value specify, lets 10. , if 'rows' doesn't exist, need add end of url , add value i've specified (10). i think want query plugin . e.g.: window.location.search = jquery.query.set("rows", 10); this work regardless of current state of rows.

node.js - How to generate a payload at runtime for a request in javascript? -

i'm new javascript/nodejs , need test payload within limits of 4mb via mocha/nodejs , i've used function generate string of characters of length ~4mb+ simulate payload , pass within request payload. however, i'm getting timeout exception error: timeout of 2000ms exceeded. async tests , hooks, ensure "done()" called; if returning promise, ensure resolves. . because approach not valid request generation taking long ... tried increasing wait time in vain. it('expected: handle request made payload exceeding request_limit of 4mb', (done) => { chai.request(server).post('/payload').send({ data: payload(4520000) }) // payload exceeds rate_limit of 4mb .set('content-type', 'plain/text') .end((error, response) => { expect(response).to.have.status(500); // return expect(response).to.eventually.have.status(500); done(); }); }); note have used chai-as-p

amazon web services - Using AWS Pipeline for incremental copy of on premises postgres to Redshift -

we're exploring using redshift our warehouse , need move new data our existing on-premises postgres db redshift nightly. looks can pipeline , template if primary db in rds, can pipeline if database on-premises? since synching in bulk on periodic basis might want consider pushing data s3, easy on-premises, , loading redshift via copy command. it's fast , reliable , backup free (cheap) in s3 side effect. you can use aws s3 cp awscli python tool push csv postgres dumps (after putting access key in .aws/config ) like: aws s3 cp current_dump.csv.gz s3://yourbucket/20170108/dump.csv.gz and regular postgres psql utility execute copy on redshift so: pgpassword='yourpass' psql -h your.redshift.end.point.com -u youruser -d yourdb -p 5439 -c "copy yourtable 's3://yourbucket/20170108/dump.csv.gz' credentials 'aws_access_key_id=[yourkey];aws_secret_access_key=[yoursecret]' delimiter ',' null 'null' ignoreblanklines emptya

ruby on rails - missing required keys: [:id] when updating a nested element -

first of lot helping me out. i working on project tool, have project model has_many project_tasks. project_tasks belongs project. i trying make mark complete action project tasks, can't seem project_task id in patch action. here routes: (note have complete action project too, working fine) resources :projects resources :project_tasks member patch :complete end end member patch :complete end end rake routes complete_project_project_task patch /projects/:project_id/project_tasks/:id/complete(.:format) project_tasks#complete project_project_tasks /projects/:project_id/project_tasks(.:format) project_tasks#index post /projects/:project_id/project_tasks(.:format) project_tasks#create new_project_project_task /projects/:project_id/project_tasks/new(.:format) project_tasks#new edit_project_project_task /projects/:project_id/project_task

javascript - Date.prototype.setMonth() changes the timezone offset? -

this occurs setmonth() method , none of other set*() methods. here's example of mean: var date = new date(); date.gettimezoneoffset(); // -60 date.setmonth(5); date.gettimezoneoffset(); // -120 is expected behavior? there's nothing mentioned on mdn. edit: wow i'm idiot. the gettimezoneoffset method returns different value during dst, , in month 5 dst different now. the time zone offset returned 1 applies date it's called on. host system configured daylight saving, offset change depending on date , time date represents , daylight saving applies. var date = new date(); console.log(date.gettimezoneoffset()); date.setmonth(0); console.log(date.gettimezoneoffset()); date.setmonth(5); console.log(date.gettimezoneoffset()); btw, if run code during june - see there no difference :)

reporting services - SSRS - Using RunningValue vertically -

Image
i running report on ssrs 2 of columns running value. before like: so running report each code @ once. i changed allow multiple codes shown in report (grouping code) , gave me below: as can see, doing running value horizontally. i want vertically each code below: maybe using column group scope work? not sure how use column groups in scope. ideas? you can try writing custom code - go report properties , write code public corder integer function getcorder(order integer) integer corder =corder + order return corder end function give name order text box next write expression calculate cumulative order value calling function written in first step preview output repeat same step rest of cumulative values .. please make sure define public variable public corder integer all best!

Installing Ant for Java on Linux -

trying install ant package cordova applications i'm getting following error upon executing command ant : /home/meronomy/java/jdk1.8.0_11/jre/bin/java: 1: /home/meronomy/java/jdk1.8.0_11/jre/bin/java: syntax error: ")" unexpected result of java -version openjdk version "1.8.0_11" openjdk runtime environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14) openjdk 64-bit server vm (build 25.111-b14-2ubuntu0.16.04.2-b14 does know wrong?

lua c++ connection - How to debug Lua code using Visual Studio -

i have win32 application , linked lua files. both lua , c++ files have bi-directional communication , can invoke function within each other. i wanted debug lua code visual studio ide likewise c++ code. have installed "babelua 2012 v3.2.2.0" extension, not able debug... i created break point in lua file , attached code win32 application, says "no symbols have been loaded". please me understand symbol files resides lua, or there other intuitive way debug lua scripts.. any appreciated... is there other intuitive way debug lua scripts. you may try zerobrane studio ide , supports debugging of lua scripts included in other applications. see remote debugging section in documentation details , examples.

JQuery ajax call does not hit the controller when clicked the second time -

i trying achieve load more data functionality in mvc project using ajax. have followed approach : https://www.codeproject.com/articles/1043142/implementing-load-more-button-using-asp-net-mvc-an everything seems fine when click on load more data button first time hits controller brings same data loaded already. when try click on button again not hit controller me debug instead, brings same initial data once again. there's no error in console way. here controller: public actionresult index() { var model = new homepageviewmodel { initiallyloadedposts = _postservice.getallposts(new getpostsinput { ispublished = true, returncount = 4 }) }; return view(model); } [httppost] [allowanonymous] public jsonresult loadmorepost(int size) { var model = new loadmorepostsviewmodel { posts = _postservice.getallposts(new getpostsinput { ispublished = true, skipcount = size, returncount = 4 }) }; int mo

spring - Springboot JPA Pageable not working for page number greater then 0 -

i want results paginated, below code works fine if request made page parameter set 0 doesn't work page>0 page=1 or page=2 or page=3 etc. here requestmapping myresponse getsample(@modelattribute myrequest myrequest) { pageable pagerequest = new pagerequest(myrequest.page, myrequest.size) mymodule.findsamples(myrequest, pagerequest) } class myrequest { myquerytype querytype string searchterm @min(value = 0l, message = 'offset must greater or equal 0') int offset = 0 @min(value = 0l, message = 'offset must greater or equal 0') int page = 0 @min(value = 1l, message = 'limit must greater or equal 1') int limit = 100 @min(value = 1l, message = 'limit must greater or equal 1') int size = 5 } mymodule:code inside module myresponse findsamples(myrequest myrequest, pageable pagerequest) { log.info("page information set "+pagerequest.pagenumber+pagerequ

how to store values in an array (stack or queue) using JavaScript -

device 1 details: { "positions": [{ "address": "1326 13 cross rd, bengaluru, ka, in", "protocol": "osmand", "fixtime": "2017-01-19t11:58:40.000+05:30", "devicetime": "2017-01-19t11:58:40.000+05:30", "latitude": 12.9750062, "longitude": 77.63568398, "valid": true, "speed": 0.0, "outdated": false, "altitude": 808.0, "course": 0.0, "deviceid": 2, "id": 545, "attributes": { "battery": "62.0", "ip": "192.168.0.107", "distance": 0.13, "totaldistance": 3307.1 } }] } device 2 details : { "positions": [{ "address": "1326 13 cr

Inno Setup: how to paste serial number by right-click mouse and paste -

according question custompage serial number in inno setup , realized serial number pasting "ctr+c" , "ctr+v". need paste serial number right-click mouse , paste. can add wndproc in edit can catch wm_paste message? change code previous answer this: procedure onserialeditchange(sender: tobject); var edit: tedit; editindex: integer; begin edit := tedit(sender); editindex := edit.taborder - serialedits[0].taborder; if ((editindex = 0) , (isvalidinput = false)) begin trypasteserialnumber; end; wizardform.nextbutton.enabled := isvalidinput; end;

How to achieve calendar week view in swift iOS -

Image
how can achieve week view of calendar in ios app shown below, ideally using apple calendar components (if any) , how can retrieve selected date. i have tried using both fscalender , cvcalender plugins, without success, each missing 1 element or other. the answer is, lay out bunch of views , set contents. perhaps use collection view horizontal days. use table view times. there's nothing in public sdk you. put view hierarchy normal way.

android - Firebase dynamic links with Facebook app -

i'm trying use firebase dynamic links (deep links). core of application should share link on social media. i've created short link (200 ok) shared link both g+ , facebook. there problem mobile browser -> deep link -> successful redirect g+ app -> deep link -> successful redirect facebook app -> deep link (not installed app) -> install -> continue -> success facebook app -> deep link (installed app) -> opens playstore app app displayed instead of running app i'm using http scheme suggested on android developers site: <activity android:name=".linkactivity"> <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="http" android:host=&qu

ios - Cannot invoke call from SDWebImage -

i have read couple similar questions, none of them working me. well, trying show different images on list , save images in cache. getting error on iconview.sd call. import uikit import sdwebimage class tableviewcell: uitableviewcell { var item: itemrealm? { didset { if item == nil { iconview.image = nil itemtitlelabel.text = "test" itemdesclabel.text = "some description" } else { // todo: implement item sets iconview.sd_setimage(with: nsurl(string: (item?.icon)!), placeholderimage: uiimage(named: "placeholder.png"), completed: { (image: uiimage!, error: nserror!, cachetype: sdimagecachetype, imageurl: nsurl!) in }) itemtitlelabel.text = item?.name itemdesclabel.text = item?.desc } } } @iboutlet weak var iconview: uiimagevi

java - Convert HTML (String attribute of class) to XML -

i have class @xmlrootelement(name = "newsletter") public class newsletter { /*************/ string content; /*************/ @xmlelement public string getcontent() { return content; } public void setcontent(string content) { this.content = content; } /*******content value <p> <p> <img alt="" src="http://pngimg.com/upload/small/star_png1598.png" style="width: 280.0px;height: 277.0px;float: left;" /> orientis vero limes in longum protentus et rectum ab euphratis fluminis </p> <div class="texte" id="thetexte" lang="zxx"> <p> haec dum oriens diu perferret </p> </div> </p> ********/ } i want convert these html content xml elements , attributes. i try bytearrayoutputstream newsletterxml = new bytearrayoutputstream(); jaxbcontext jaxbcontext = null; jaxbcontext = jaxbcontext.newinstanc

javascript - Filtering array of objects with multiple attribute on multiple condition -

i trying filter array of objects multiple attribute on multiple condition. i'm creating param array consists of of multiple array holding parameters. example var params = [ ["id", "equals", "11060"], ["user_id", "exact", "84"] ]; first element key , second 1 condition , third 1 value. first filtering condition id == '11060' , second 1 user_id = '84' // data filter var originaldata = [{ "id": 11141, "user_id": 84, "received": "26 jan 2017", "approvalstatus": "approved" }, { "id": 11080, "user_id": 84, "received": "25 jan 2017", "approvalstatus": "approved" }, { "id": 11079, "user_id": 84, "received": "25 jan 2017", "appr

sql - MySQL Trigger for aggregating one table's rows to another table -

Image
i have 2 mysql tables, 1 updated new rows needs aggregated(table 1). , 1 should automatically filled aggregated data using mysql trigger (table 2). given tables schema: example table 1: table aggregated unique key uniqueid ( uniqueid , ci , ai , status ) example table 2: aggregated table unique key ix_unique_daily ( ai , ci , day ) the sql trigger should like: delimiter $$ create trigger yii_botclient2 . st_unqiue_trigger after insert on yii_botclient2 . st_unique each row begin set @myday := date(new.date); set @today = date(); set isdaily := select count(id) `yii_botclient2`.`st_daily` `ai` = new.ai , st_daily.ci = new.ci , st_daily.day = @myday; set mydaily = ifnull(isdaily, 'no'); if (mydaily = 'no') if new.status = 0 insert st_daily (`day`, `ai`,`ci`,`impressions`,`updated`) values (@today,new.ai,new.ci,1,now()); elseif new.status = 1 insert st_daily (`day`, `ai`,`ci`,`clicks`,`updated`) values (@tod

ruby - iRuby kernel keeps getting killed -

i ruby homebrew on macos sierra 10.12.3. installed jupyter pip install , iruby gem install when run iruby notebook server starts fine while creating new notebook kernel killed following log. /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/lib/iruby/kernel.rb:18:in `initialize': uninitialized constant iruby::kernel::session (nameerror) /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/lib/iruby/command.rb:70:in `new' /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/lib/iruby/command.rb:70:in `run_kernel' /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/lib/iruby/command.rb:34:in `run' /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/bin/iruby:5:in `<top (required)>' /usr/local/bin/iruby:22:in `load' /usr/local/bin/iruby:22:in `<main>' i have seen other question there error message different. the iruby documentation @ github suggests using anaconda , setting ruby environment 2.4.1 using rbenv. had same issu

javascript - Pass data from one js file to other synchronously in NodeJS -

i have situation need service function in service folder controller folder , once receive output need pass ui. //controller var service = require('service'); api.get('/users', function(request, response) { var name = request.query['name']; var responsefromservice = service.someapi(name); response.send(responsefromservice).status(200); }); //service exports.calltwitterapi = function(twitterhandle,callback){ var responsefromtwitterservice; console.log("calling twitter api.." + twitterhandle); someapi.get('users/show', {screen_name: twitterhandle}, function (err, data, res) { if (err) { //loggererror.error('no connection twitter :', date.now()); responsefromtwitterservice = json.stringify(err) + "unable connect twitter"; } else if (data.errors) { responsefromtwitterservice ="user not found!!"

javascript - Creating jquery plugin for objects -

i want create jquery plugin array splice(opposite of push() function).but error uncaught typeerror: allfiles.pull not function here code: $.fn.pull = function (index) { this.splice(index-1,1); } var allfiles = ['1','2','3','4','5']; $("div").html(allfiles); allfiles.pull(1); $("div").html(allfiles); .first:before{ content:'before:'; } .second:before{ content:'after:'; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="first"></div> <div class="second"></div> because $.fn.pull extends jquery function list, not add method object array . do array.prototype.pull . in original code array.pull ( allfiles.pull ) undefined , because you've never declared it. i've changed code , wrapped array jquery function: $(allfiles) . should give need.

openerp - Odoo 10 how to check if Purchase Order "Sent PO by email" action was executed or not -

in odoo 10, possible define report list purchase orders marked confirmed not sent email supplier? i.e., how can detect if in purchase order action "sent po email" completed or not. thanks, you can using following simple way. step 1 : add 1 boolean field in purchase order model , update context in following method. from odoo import fields,models,api class purchase_order(models.model): _inherit="purchase.order" sent_po_via_email=fields.boolean("sent po via email",default=false,copy=false) @api.multi def action_rfq_send(self): ''' function opens window compose email, edi purchase template message loaded default ''' self.ensure_one() ctx = dict(self.env.context or {}) ir_model_data = self.env['ir.model.data'] try: if self.env.context.get('send_rfq', false): template_id = ir_model_data.get_object_re

ios - Stubbing Methods does not work with OCMock3.4 -

stubbing methods works nicely 'nsuserdefaults',but doesn't seem work custom method. my test code follows: - (void)testexample { id userdefaultmock = ocmclassmock([nsuserdefaults class]); ocmstub([userdefaultmock standarduserdefaults]).andreturn(userdefaultmock); ocmstub([userdefaultmock objectforkey:[ocmarg any]]).andreturn(@"user defaults mock obj"); id managermock = ocmclassmock([viewmanager class]); ocmstub([managermock sharedinstance]).andreturn(managermock); ocmstub([managermock generateobjwithobj:[ocmarg any]]).andreturn(@(11)); viewcontroller *vc = [[viewcontroller alloc]init]; [vc publicmethod]; } code in viewcontroller: - (void)publicmethod { [[nsuserdefaults standarduserdefaults]setobject:@"mockobj" forkey:@"mockobjkey"]; id obj = [[nsuserdefaults standarduserdefaults]objectforkey:@"mockobjkey"]; nslog(@"mockobjkey:%@",obj); nsnumber *num = @(0);

c# - ? Operator using MVC Razor syntax -

<span>@model.selectedordertypename @model.percentage ? @model.financialsupportpercentage % : @model.amount $</span> how do above in razor syntax? (basically if percentage not null display otherwise display amount you need use brackets <span>@model.selectedordertypename @(model.percentage != null ? model.financialsupportpercentage + "%" : model.amount + "$")</span> without brackets, every time use @ returning something, meaning displaying <span> containing @model.selectedordertypename 's value, @model.percentage 's, value ? literal character, @model.financialsupportpercentage 's value, % literal character, : , @model.amount 's value , $ literal. adding brackets turns 1 return - allowing ternary functions written.

wordpress - Edit booking duration for multiple products on WooCommerce -

i've imported on 200 products system using csv import suite but, see, cannot edit booking duration nor product availability automatically. meaning have go each product individually if want set proper booking duration. is there way edit 1 (or any) of options below? change default booking settings. if possible, where? using simple update query in database. if possible, table? add fields in csv file. if possible, fields? i found properties needed in db , created script update. see code below in case needs. remember adapt needs. replace `db_site`.one_postmeta (post_id, meta_key, meta_value) (select id, '_wc_booking_base_cost', '' `db_site`.one_posts post_type = 'product'); replace `db_site`.one_postmeta (post_id, meta_key, meta_value) (select id, '_wc_booking_calendar_display_mode', 'always_visible' `db_site`.one_posts post_type = 'product'); replace `db_site`.one_postmeta (post_id, meta_key, meta_value) (select id

polygon - Area calculation in R -

so haven been trying calculate total land loss due climate change. dataset use website link this dataset consists of longitude , latitude of place lost. want calculate total area of such points. know geosphere packages has function calculate area of polygon created set of points. still worry using may overestimate result connecting points far away each other. link map if @ antarctica, connecting red points overestimated affected area. my question areapolygon() function accounts fact? if not there way come more precise estimate area in question? thinking using distance between points criteria. don't know how implement in r. thank this code have been using far library(rgdal) library(sp) library(geosphere) library(plyr) grid_file_6m <- new("gdalreadonlydataset","link_to_the_file") grid_6m <- assgdf_grod(grid_file_6m, output.dim=c(1000, 1000)) plot(grid_6m,bg="black") grid_6m_df <- as.data.frame(grid_

Disable read operation ont the slave member for a mongodb replicaset -

rs.slaveok() enables read operation on slave member in mongodb replica set. what function used disable it? simply type rs.slaveok(false) . in shell can see code executed each command, if time rs.slaveok (without parenthesis) following: rs.slaveok function (value) { return db.getmongo().setslaveok(value); } so slaveok function accepts boolean parameter , recalls setslaveok , composed following code: db.getmongo().setslaveok function (value) { if (value == undefined) value = true; this.slaveok = value; } as see, setslaveok has true default value, specifying false can prevent reading secondary.

c# - user settings changed on file not changing run time -

i have file several user , application settings, when change them run time , save them, file not updated, still, when re-start application there. saved? also, if change of settings in file, , start application, cant see changes in application, why that? i tried read documentation related settings ( https://msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx ) wasn't able find awsner.

Ava js not working async await tests -

i trying use ava.js tests can't launch async/await. copy/paste example documentation , showed me error. (async function(t) { syntaxerror: missing) after argument list. looks not compiled correctly , don't know did wrong. me please? here code test.spec.js import test 'ava'; test(async t => { const value = await promisefn(); t.true(value); }); package.json { "scripts": { "test": "ava" }, "devdependencies": { "ava": "^0.16.0", "ava-spec": "^1.0.1", "babel-preset-es2015": "^6.18.0", "tap-nyan": "0.0.2" }, "ava": { "babel": "inherit", "require": [ "babel-register" ] } } and .babelrc { "presets": [ "es2015" ] } async/await not transpiled using preset es2015 . should enable preset es2017

mysql - Cant use ENUM in new tables -

after updated wamp server mysql version 5.7.14, apache version 2.4.23, , php version 7.0.10. not sure if php version mather there if need it. after updated i've not been able create new tables 1 or more of column uses enum , after searching it, found thread recomended using ells enum since have been working far, dont see problem it(?). after update error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '0) not null , `rank` enum(0) not null , `avatar` varchar(255) not null , `' @ line 13 it works when removing enum columns need them. heres sql: create table `az2983`.`users` ( `id` int(11) not null auto_increment , `username` varchar(255) not null , `email` varchar(255) not null , `firstname` varchar(255) not null , `lastname` varchar(255) not null , `question` varchar(255) not null , `answer` varchar(255) not null , `ip` int(25) not null , `active_ip` int(25) not null ,

css - WordPress: Save editor inline style in AMP -

i want use inline style wordpress editor in amp view. @ moment, amp deletes inline styles. is there way protect single class , use in amp or against concept of amp? i found answer! use class .amp-custom keep inline-styles in amp.

excel - If cell value is #NV get another cell -

i've got following code work with set sourcerange = sheets("sheet1").range("aw2:aw" & lastrow) set resultrange = sheets("sheet2").range("a2:h" & lastrow) = 1 each cell in sourcerange if cell.value = 1 resultrange.rows.cells(i, 1).value = sheets("sheet1").range("o" & cell.row).value resultrange.rows.cells(i, 2).value = sheets("sheet1").range("x" & cell.row).value resultrange.rows.cells(i, 3).value = sheets("sheet1").range("p" & cell.row).value resultrange.rows.cells(i, 4).value = sheets("sheet1").range("j" & cell.row).value resultrange.rows.cells(i, 5).value = sheets("sheet1").range("k" & cell.row).value resultrange.rows.cells(i, 6).value = sheets("sheet1").range("g" & cell.row).value

R: tune.svm return same performance for every combination of parameter -

i have dataset 22 subjects , ~20000 features. want train supporting vector regression nu model linear kernel. in order chose best parameter model using tune function in package e1071 following call out = tune(svm,dependentvariable~.,data=data,kernel="linear", ranges=list(cost=10^(-1:2), nu=seq(.1,1,.1))). the output of command is, expected, error , dispersion each combination of parameters, problem same error , dispersion each combination. this strange, considering exploring entire possible parameter space nu. what possibly going wrong ?

python - How to use out parameter in numpy.argmin to retrieve minimum indices? -

according numpy.argmin documentation, third parameter out should provide indices (as understand): out : array, optional if provided, result inserted array. should of appropriate shape , type. but having trouble using collect indices of minimum twenty of large numpy.ndarray ( dist in following snippet). # here using smaller size arrays, hold rgbs of images = np.random.normal(size=(10,3)) b = np.random.normal(size=(1,3)) # compute distances between 2 arrays dist = scipy.spatial.distance.cdist(a,b) index_of_minimum = np.argmin(dist) # create array hold indices: same shape , same datatype indices = np.array(dist.shape, dtype=np.float64) np.argmin(dist, axis=0, out=indices) but following error: valueerror: output array not match result of np.argmin. there similar questions asked before requirement different. first, possible collect indices of minimum using out parameter? if how can that? two problems: first there type in line 6. should say d

javascript - How to give different border for each series in pie chart using highcharts? -

Image
i able chart i'm not able different border each series. set border color each point individually (slices in pie points, not series). { name: 'microsoft internet explorer', y: 56.33, bordercolor: 'blue' } example: http://jsfiddle.net/yk5mgbk5/3/

ios - Custom Facebook loginButton functions Swift 3 -

i'm trying create custom loginbutton, i've found lot of guides for. however, none of them updated swift 3, i've tried myself create functions. however, keep getting errors. the first i'm getting ambiguous reference member login(_:completion:) @ibaction func loginpressed(_ sender: anyobject) { let fbloginmanager : loginmanager = loginmanager() fbloginmanager.login(["public_profile", "email", "user_friends"], viewcontroller: self, completion: { (result, error) -> void in if (error == nil){ let fbloginresult : fbsdkloginmanagerloginresult = result! if fbloginresult.grantedpermissions != nil { if(fbloginresult.grantedpermissions.contains("email")) { self.getfbuserdata() fbloginmanager.logout() } } } }) } the second i'm getting cannot convert value of type (_, _, _)

how can i know new row insert my mysql database using php? -

i have create chatbox using php.its smoothly works.but don't know when new message inserted mysql database.how can know that? i've tried below code.but return me new message. $initialcounter = 0; $count_query = "select * `message` `receiver_id` = '$sender_id' , `sender_id` = '$rid' order `id` desc"; $count_query_res = $conn->query($count_query); $countmsg = $count_query_res->num_rows; $initialcounter += $countmsg; $msgcounter = $initialcounter + $countmsg; if($initialcounter<$msgcounter){ echo "new message";} after inserting database, mysqli should return number of affected rows can use know if theres new data inserted in database. number stored in $mysqli->affected_rows example: <?php $c = new mysqli("server","username","password","database"); $c->query("insert table(column1,column2,column3) values('data','data','data')"); echo

groovy - Jenkins Pipeline - how to get values after parallel execution -

is possible save values during parallel execution , use these values during final step? in following example, know jenkins slave used during parallel execution , use during final step. node { stage 'checkout' checkout([...]) stash includes: '**', name: 'binary' stage 'running simulation' parallel ( "stream 1" : { node { unstash "binary" sh "echo \"\$(whoami)@\$(hostname):\$pwd\"" // how save previous result // run simulation on node first slave ... } }, "stream 2" : { node { unstash "binary" sh "echo \"\$(w

javascript - Get onload event of an angular.element iframe -

i trying onload event on added iframe. happens inside service function call. supposed download file, works fine. need wait until iframe loaded return promise resolve. reduced code problem is: iframe = angular.element('<iframe id="blaba" style=\'position:fixed;display:none;top:-1px;left:-1px;\'/>') angular.element(document.body).append iframe # onload bind here iframe.attr('src', url) i tried iframe.onload = -> $log.info 'iframe loaded' also iframe.on 'load', (event) -> $log.info 'iframe loaded' i tried select iframe via id , bind load event on that. doesn't work. ideas or suggestions? best regards try app.controller('mainctrl', () => { var iframe = angular.element('<iframe id="blaba" height="200"/>') angular.element(document.body).append(iframe); // onload bind here var url = 'test.txt'; iframe.attr('src'

d3.js - d3.request generates unauthorized error -

i using d3.request.js download data remote server requires http basic authentication. scripts are: var query="<request-url>"; d3.request(query) .post() .user("login-id") .password("login-password") .get(function(error, data) { //scripts process result } ) <script src="https://d3js.org/d3-request.v1.min.js"></script> <script src="https://d3js.org/d3.v4.min.js"></script> however upon executing above scripts, received 401 (unauthorized) error. have tested use $.ajax request method before switching d3.request. , working. hence should not cross domain issue remote server. result json object, tested using d3.json failed. any suggestion problem? thanks. is cross-origin request? wag this problem . try this: var query="<request-url>"; d3.request(query) .post() .user("login-id") .password("login-passwor

objective c - TextField on Custom Cells -

i using custom cell inside tableview . in custom cell, there label , textfield ....this custom cell being reused display ten items. i want open datepicker on 1 of cell's text field not able understand how work can achieved? please set text field tag , delegate in cellforrowatindexpath method... like.. cell.yourtextfieldname.tag = 1000; cell.yourtextfieldname.delegate = self; in .h file add uitextfielddelegate then in textfieldshouldbeginediting delegate can picker. -(bool)textfieldshouldbeginediting:(uitextfield *)textfield{ nsinteger txtfldtag = textfield.tag; if(txtfldtag == 1000){ //write method show picker. return no; }

javascript - MarkerClustererPlus and nested clusters -

what mean following: suppose have in area number of transmitting-receiving stations (pylons) (5, example), , 2 hundred customers connected wirelessly them (40 each on average). i want first icon appear on area showing number 5 (number of stations), on click event on icon want 5 pylons icons appear, , subsequently on click event on of icons customers icons (only customers connected clicked pylon) appear. all many areas in country. question is: basic steps should implement task accomplished? have done @ moment define cluster of 5 stations so, clicking on icon, stations shown. should define new clusters, 1 each station, each 1 containing customers connected it? or should take bottom-up approach, mean, define single big cluster of customers, , move on? in such case how should proceed? i newbie html , javascript ( , 66!!! ), nonetheless trying accomplish task using languages , markerclustereplus library. need suggestions, please. all. thanks answering. have done few mo