Posts

Showing posts from August, 2012

amazon web services - Hyperkube apiserver zone not specified in configuration file -

so i'm getting error when trying install kubernetes aws cloud provider. i'm installing kubespray narrowed down below command tried executing manually inside hyperkube container. i'm guessing actual error comes not having proper iam role. i'm working on obtaining 1 take sometime. see says zone not specified in configuration file. i'm not sure specify it. can point me in right direction in that? testing purposes can manually obtain awa access keys , session tokens. there way hyperkube use those? root@15713968201f:/# /hyperkube apiserver --advertise-address=10.205.232.161 --etcd-servers=https://10.205.232.161:2379,https://10.205.235.70:2379 --etcd-quorum-read=true --etcd-cafile=/etc/ssl/etcd/ssl/ca.pem --etcd-certfile=/etc/ssl/etcd/ssl/node-ip-10-205-232-161.ec2.internal.pem --etcd-keyfile=/etc/ssl/etcd/ssl/node-ip-10-205-232-161.ec2.internal-key.pem --insecure-bind-address=127.0.0.1 --apiserver-count=2 --admission-control=namespacelifecycle,limitrange

ecmascript 6 - TypeScript and custom iterators -

i want create iterator array in typescript, how must fix code not transpilation error? generics or so? let array4 = [10, 20, 30]; array4[symbol.iterator] = function () { let = 0; return { next: function () { i++; return { value: < 4 ? array4[i - 1] : undefined, done: >= 4 ? true : false }; } }; }; let it4 = array4[symbol.iterator](); console.log(it4.next()); console.log(it4.next()); console.log(it4.next()); console.log(it4.next()); like so: array4[symbol.iterator] = function* () { let = 0; while (i < 3) { i++; yield array4[i - 1]; } }; you without generator function if like, need find correct signature of iterableiterator<t> . let me know if need that.

unix - Remove "...[C[0k" from expect output -

how can not generate substring "...[c[c[c[0k" after issued comands trough expect scripts? example, have following lines in expect script: #set variables, parameters etc ... spawn telnet $ip $port expect -nocase "name:" send -- "$user\r" expect -nocase "password:" send -- "$pass\r" expect -re "$prompt" send -- "terminal length 0\r" expect -re "$prompt" send -- "show vlan\r" expect -re "$prompt" send -- "logout\r" expect eof after execution receive undesirable substrings: username:[c[c[c[c[c[c[c[c[c[0kadmin password:[c[c[c[c[c[c[c[c[c[0k************** switch# [c[c[c[c[c[c[c[c[c[0kterminal length 0 switch#[c[c[c[c[c[c[c[c[c[0kshow vlan ... #'show vlan' command result here ... switch#[c[c[c[c[c[c[c[c[c[0klogout connection closed foreign host. does have tip on how can not generate these "[c[c[c[c[c[c[c[c[c[0k" strings? other issue i cannot use other too

c# - Intercept text from print job and then printing as normal -

i trying intercept text data printed document without making modifications it. user's standpoint, document print normally, have text document use in program. i have come across printer++, unsure if want. presently plan create virtual printer extracts text, , forwards original document actual printer. is achievable printer++? or other solution?

r - Arrange multiple ggplots from a list on multiple pages with specified page breaks -

Image
i'm trying take plots list , output multipage pdf. can using gridextra:marrangegrob i'm having issues getting page breaks in right place. data in sets of 7 4 pages 2 plots on each page , break after 7th plot 8th starting on new page (as after 14th, 21st etc.). my list contains (currently 84 ggplots, more in future) i looked @ ggplot list of plots 1 pdf different page layouts don't want have set each page individually there many of them (i might want change 3 or 4 per page once have initial ones , don't want have re-work. i've made example using diamonds dataframe, assuming want split pages plots 2 different clarities aren't on same page egsplitdf <- diamonds %>% distinct(color, clarity) %>% arrange(clarity) egplotfun <- function(i, filterdf){ dat = filter(diamonds, color == filterdf[["color"]][i] & clarity == filterdf[["clarity"]][i]) ggplot(dat, aes(x= x, y = y))+ geom_point()+ labs(titl

javascript - How to make a fixed sidebar stop at the end of a container -

i have container 2 columns, 1 of holds sidebar. jsfiddle the sidebar fixed, , when gets near bottom used jquery alter bottom have stay @ bottom of container. how can make stops moving when hits bottom of container (outlined in red)? have work sidebar of height. html <div class="container"> <div class="col-left"> <div class="sidebar"> fixed sidebar </div> </div> <div class="col-right"> <p>paragraph</p> <p>paragraph</p> <p>paragraph</p> </div> </div> <footer>footer</footer> css .container { outline: 1px solid red; position: relative; } .col-left { width: 58%; display: inline-block; outline: 1px solid black; vertical-align: top; height: 100%; } .col-right { width: 40%; display: inline-block; outline: 1px solid black; vertical-align: top; } .sidebar { position: fixed; top:

machine learning - Word embedding training -

i have 1 corpus word embedding. using corpus, trained word embedding. however, whenever train word embedding, results quite different(this results based on k-nearest neighbor(knn)). example, in first training, ' computer ' nearest neighbor words ' laptops ', ' computerized ' ,' hardware '. but, in second training, knn words ' software ', ' machine ',...('laptops' low ranked!) - training performed independently 20 epochs, , hyper-parameters same. i want train word embedding similar(e.g., 'laptops' high ranked). how should do? should modulate hyper-parameters(learning rate, initializing, etc)? you didn't word2vec software you're using, might change relevant factors. the word2vec algorithm inherently uses randomness, in both initialization , several aspects of training (like selection of negative-examples, if using negative-sampling, or random downsampling of very-frequent words). additionally, if you

cordova - ionic platform add android - are these necessary directories? -

Image
when run either of following commands: $ ionic platform add android or $ ionic run android -l the plugins on directory: <root>/plugins are copied directory: <root>/platforms/android/assets/www/plugins inside each plugin directory there 1 javascript file. in other hand, inside directory: <root>/platforms/android/assets/www/build there 1 compiled javascript file: main.js so, question if need following directory? <root>/platforms/android/assets/www/plugins in case application doesn't need it, how can remove during execution of 2 first commands above? in <root>/platforms/android/assets/www/build find .js files of application (the code create application). in <root>/platforms/android/assets/www/plugins find single folder , 1 or more .js files every plugin add project, these .js files part of bridge between javascript part in webview , native (java or objc) code of plugins. deleting them break cordovas pl

javascript - Page/Div Content fade in and out on click -

Image
i have been working on recruiting website days now. newbie in programming. please need script load employment review content fade out on click of of each employment vacancy div , fade in on clicking "close" on employment review content page. thanks. you can use jquery achieve this: http://api.jquery.com/fadeout/ $( "#vacancy-div-id" ).click(function() { $( "#id-of-what-you-want-to-fade-out" ).fadeout( "slow", function() { // animation complete. }); }); to fade in can use this: http://api.jquery.com/fadein/ $( "#close-button-id" ).click(function() { $( "#id-of-what-you-want-to-fade-in" ).fadein( "slow", function() { // animation complete }); }); more detailed example - put in html: <script> $( "#close-button-id" ).click(function() { $( "#id-of-what-you-want-to-fade-in" ).fadein( "slow", function() { // animation complete

python - Error When Using Mechanize in Custom Module Imported to Django views.py file -

i cannot life of me figure out what's going on here. making site django takes username , password of logging in, runs through python script uses mechanize scrape site, , math , displays data. problem appears mechanize when trying run file live django. obviously, scraping script works fine when run alone. here traceback , all. environment: request method: post request url: http://127.0.0.1:8000/ django version: 1.11.4 python version: 2.7.12 installed applications: ['webapp', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] installed middleware: ['django.middleware.security.securitymiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middl

Where are a JavaScript's class' instance methods stored? -

this question has answer here: es6 iterate on class methods 4 answers given: var car = class car{ drive() {} park(){} } given car, how can find methods class has, ie "drive" , "park" ? have thought on car.prototype it's true car.prototype.drive returns method , car.prototype.hasownproperty("drive") => true but for(let prop_name in car.prototype){ console.log(prop_name) } prints nothing. the property not enumerable ( car.prototype.propertyisenumerable("drive") === false ), therefore doesn't show it. see mdn . the for...in statement iterates on enumerable properties of object, in original insertion order otherwise correct, function on prototype. note not , instance method. instance method exists once per instance, name implies. can generate instance methods e.g. wit

sql - Convert PHP Query to Laravel in Controller -

can convert php code in laravel. $result = mysqli_query($conn, "select birthday, count(*) person group birthday;"); while ($row = mysqli_fetch_array($result, mysql_num)) { $yearvalues[$row[0]] = (int)$row[1]; } like this: $female = enroll::select(db::raw("sum(tot_enroll) count")) ->orderby(db::raw('sy')) ->groupby(db::raw("(sy)")) ->where('gender','=', 'female') ->get()->toarray(); $female = array_column($female, 'count'); it's simple, you can convert sql query query builder in laravel this: db::table('person')->select('birthday',db::raw('count(*) count')) ->groupby('birthday') ->get(); in case, have forgot select sy , gender orderby , groupby , where nothing try code data. db::table('enrollments')->select(db::

osx - Expo on MacOS can open my app on my Android device over USB cable via XDE but not commandline -

i'm new android , macs , react native. i'm using macbook air sierra connected usb cable new android phone. using expo's ide can run , test app on android device when try same via terminal network errors. why commandline version want use internet when xde happy work usb cable , how can change it? googling issue has been elusive far. download adb developer.android.com cd directory downloaded, , tools directory. plug in phone run './adb devices', should spit out id , 'device', if says 'unkown', try restarting phone, or otherwise device. './adb install app_path.apk', , should install. good luck.

the tensorflow c++ api translate to python api -

std::vector<std::string> output_names({flags_node_name}); std::vector<tensorflow::tensor> outputtensors; tensorflow::status s = session_->run({}, outputnames, {}, &outputtensors); who can translate code python. thanks!!!

android - Color of title bar -

how change color of title bar clicking button. have group of buttons represent different colors once 1 of button clicked should change color of title bar activities in application. <?xml version="1.0" encoding="utf-8"?> <radiogroup xmlns:android="schemas.android.com/apk/res/android"; android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <radiobutton android:id="@+id/radio_blue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/pirates" android:onclick="onradiobuttonclicked"/> <radiobutton android:id="@+id/radio_red" android:layout_width="wrap_content" android:layout_height="wrap_content&q

Word VBA- Incorporate a macro to a checkbox -

i creating word form has multiple sections. have these sections hidden (collapsed) or expanded based on user checks in checkbox. example below question within form. if user answers "yes," next section titled "client software package" appear. if user answers "no," want section hidden. 1) need macro hides section 2) how can assign macro legacy tool checkbox word developer tab "does client have software package us?" yes no client software package list name of software. list version of software. how long has client had software thanks! jimmy

asp.net - ask - how to prevent refresh on chrome browser of jquery tabs with <object> -

i have code using jquery-ui-tabs , 1 of tabs contain <object> . there no problem when i'm open using ie. when open using google chrome everytime change tabs , tab, <object> refreshing. there anyway prevent refresh while tab changing? here example code $( function() { $( "#tabs" ).tabs(); } ); <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <div id="tabs"> <ul> <li><a href="#tabs-1">nunc tincidunt</a></li> <li><a href="#tabs-2">proin dolor</a></li> <li><a href="#tabs-3">aenean lacinia</a></li> </ul> <div id=&

error 401 ajax in laravel already added token -

i stuck in laravel 5.4 ajax because says error 401. unauthorized i searched solutions , made this: from header: <meta name="csrf-token" content="{{ csrf_token() }}"> and in ajax: <script type = "text/javascript"> $.ajaxsetup({ headers: { 'x-csrf-token': $('meta[name="csrf-token"]').attr('content') } }); function getproducts(category_id) { $("#product-list").empty(); $.ajax({ url:"{{ url('home/product') }}/" +category_id, type:"get", datatype: "json", success: function(data) { } }); } </script> nothing happens. . don't know why any suggestions please?

How to import mapbox-gl-draw into Angular 2/4? -

i importing module in angular 2/4 app this: import { mapboxdraw } '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw'; and using in 1 of components this: var draw = new mapboxdraw({ displaycontrolsdefault: false, controls: { polygon: true, trash: true } }); map.addcontrol(draw); but getting error when open page: error typeerror: __webpack_imported_module_4__mapbox_mapbox_gl_draw_dist_mapbox_gl_draw__.mapboxdraw not constructor what best way import mapbox-gl-draw? this minimal example app works on machine: based on little project on github: https://github.com/haoliangyu/ngx-mapboxgl-starter import { component } '@angular/core'; import * mapboxgl 'mapbox-gl'; import * mapboxdraw 'mapbox-gl-draw'; @component({ selector: 'app-root', templateurl: './app.component.html', styleurls: ['./app.component.css'] }) export class appcomponent { ngoninit() { mapboxgl.accesstoke

java - Full width android textView -

Image
i new android , developing card making application. want add feature in app enables user apply background color textview full width . need below image: this works fine when text length long but, when text contains more 1 line , not in full width, becomes below image: i need result same first image no matter how long text is. in textview have used wrap_content height width. need apply background textview in full display width if textview letter only. hope clear. thanks try set textview width match_parent. android:layout_width :-> specifies basic width of view. sample code <textview android:layout_width="match_parent" android:layout_height="wrap_content" /> or set layoutparams of textview programatically this layoutparams my_params = new linearlayout.layoutparams(layoutparams.match_parent, layoutparams.wrap_content, 1f); textview.setlayoutparams(my_params);

java - Read a specific line from file and separate the data from one line -

i'm new java appreciated. i'm trying write program asks user file read from, asks id, searches inside file id , outputs information line. text file read formatted this: apple^201^3 banana^202^4 orange^205^5 the 2nd column id. also need separate information how can output this: item: apple id: 201: price: $3 import java.util.*; import java.io.*; public class fruit { public static void main(string[] args) throws ioexception { scanner keyboard = new scanner(system.in); system.out.println("enter filename >> "); string filename = keyboard.nextline(); file f = new file(filename); scanner fin = new scanner(f); system.out.println("enter item id: "); int fruitid = keyboard.nextint(); while(fin.hasnextline()) { string line = fin.nextline(); if(fin.hasnextint(fruitid)) { system.out.println(line); } else { system.out.println("error"); } }

sql - Need a query to find the records that have different values for same id in multiple rows -

Image
i confused here. i need find custtreenodeid 's have ( preferenceid = 55 , overridevalue = 1 ), ( preferenceid = 56 , overridevalue = 1),( preferenceid = 58 , overridevalue not null ). the record should have 3 preferenceid , should statisfy 3 conditions mentioned above. example - see custtreenodeid = 76853551-7acd-48e1-beff-0000498a144c in screenshot. these gives custtreenodepreferenceoverrideid need select custtreenodepreferenceoverrideid yourtable ( condition 1 ) or ( condition 2 ) or ( condition 3 ) group custtreenodepreferenceoverrideid having count(*) = 3

android - Font Awesome doesn't work with direct string input -

i want set font awesome 1 text view in application. used below , works fine: typeface font = typeface.createfromasset( getassets(), "fontawesome/fonts/fontawesome-webfont.ttf" ); textview awesomebutton = (textview)findviewbyid(r.id.awesome_button); awesomebutton.settypeface(font); awesomebutton.settext(mainactivity.this.getstring(r.string.heart)); but when want use below cod, doesn't work: typeface font = typeface.createfromasset( getassets(), "fontawesome/fonts/fontawesome-webfont.ttf" ); textview awesomebutton = (textview)findviewbyid(r.id.awesome_button); awesomebutton.settypeface(font); awesomebutton.settext("&#xf076;"); try this typeface font = typeface.createfromasset( getassets(), "fontawesome/fonts/fontawesome-webfont.ttf" ); textview awesomebutton = (textview)findviewbyid(r.id.awesome_button); awesomebutton.settypeface(font); awesomebutton.settext(html.fromhtml("&#xf076;"));

nightwatch.js - Using magellan-nightwatch, is there a way to assert some element is hidden / displayed? -

waitforelementpresent or waitforelementnotpresent won't work if element not showing on screen 1 of display: none , visible: hidden or opacity: 0 . (it should similar jasmine-jquery's expecting element tobehidden() . ) use .waitforelementvisible or .waitforelementnotvisible see if displayed or hidden

c# - LINQ Left Outer join with group by count through extension methods -

i have 2 tables. categories , ads . every category can have many ads in ads table. i want categories details including how many ads have each. following linq expression fetches categories have ads may bacause firstordefault() i know how can achieve result given condition plus categories have location id (let say: lid) of "7". following in expression var x1 = context.categories .groupjoin( context.ads, cat => cat.id, ad => ad.catid, (cat, ad) => new { cats = cat, ads = ad }) .selectmany( => a.ads.defaultifempty(), (a, y) => new { catss = a.cats, adss = y }) .groupby(w => w.adss,ww=>new { cat=ww.catss,count=ww.catss.ads.count()}) .where(s=>s.firstordefault().cat.lid==7); you try following: var result = context.categories .w

java - How to Authorize user in Oracle EBS through pl/sql API -

we making connector oracle ebs through pl/sql interface , java. create connection database using jdbc api. able create connection oracle ebs database through super user(apps/apps) , detail metadata. validate user - fnd_user_pkg.validatelogin() pl/sql api to create session use - exec fnd_global.apps_initialize(p_user_id, p_resp_id, p_resp_appl_id); now, authorize user/application combination , not user. is there pl/sql api authorize user/application combination ?

javascript - Can anybody tell me how to add or update data from the different pages to app module in ionic 2 -

i using below code setting variables values in app module via native storage. values come login page. this.menu.open().then(() => this.native.getitem('data') .then(data => { if(data != null){ alert('native acess'); this.user_name = data.name_user; this.user_image = data.profile; } }); this.native.getitem('fbdata') .then(fb => { console.log(json.stringify(fb)); if(fb != null && this.user_name == null && this.user_image == null){ alert('hello'); this.user_name = fb.fb_name; this.user_image = fb.fb_image; } }); }).catch( (err) => { console.log(err); });

postgresql - CASE types integer and text cannot be matched Postgres -

declare pop character varying; begin execute 'select case(select exists(select count(case_reported) qwe week = '' weekk '' , code = '' codee '' , case_type= '' case_type '' having count(case_reported) > 0 ) ) when true (select case(count(case_reported)) when 1 (select case(case_reported) when 1 1::varchar when 0 ''zr''::varchar end qwe week = '' weekk '' , code = '' codee '' , case_type= '' case_type '') else count(case_reported)::tex

Store PowerShell script output to a file -

i have created script collect list of users part of remote servers localadmin group , can see output in powershell prompt. but how can save output file? any appreciated. foreach ($computer in get-content c:\server.txt) { echo "$computer" $admins = invoke-command {net localgroup administrators} -computername $computer $results = $computer + " " + $admins | out-file -append c:\adminmember.txt } change code if want avoid mangled lines: foreach ($computer in get-content c:\server.txt) { $admins = invoke-command { net localgroup administrators | out-string } -computer $computer "{0}`r`n{1}" -f $computer, $admins | add-content 'c:\adminmember.txt' }

python - See if item in each row of pandas series -

i have pandas series following data: 2015-07-24 ['business', 'corporate'] 2015-07-24 ['business', 'corporate'] 2015-07-08 ['commentary', 'world'] 2015-07-05 ['issues', 'just cause'] 2015-06-15 ['business'] 2015-04-11 ['business', 'economy'] 2015-03-24 ['food & drink'] 2015-02-24 ['commentary', 'japan'] 2015-02-19 ['business', 'financial markets'] 2015-01-05 ['national', '70 years of peace , prosperity'] 2014-11-06 ['national'] 2014-10-31 ['business', 'financial markets'] 2014-10-20

ui testing - How to call a method after executing all test cases in XCTestCase? -

i'm having ui test class (say myuitests ). myuitests class contains n number of test cases. know setup() , teardown() before , after each test cases. what expect: want run method initiates pre-setup test cases. 1 time setup. means, before executing n number of test cases, want run method(say initialonetimesetup() ) once. in same way, want run method(say finalteardown() ) delete pre-setup. method should called after n number of test cases executed. how can achieve this? there xctestcase delegates served purpose? thanks

c# - Getting IConfiguration from ServiceCollection -

i´m writing own extension method servicecollection registered types of module , need access iconfiguration instance collection register options. extension method public static iservicecollection addapi(this iservicecollection services) { // configuration collection var configuration = (iconfiguration) services.firstordefault(p => p.servicetype == typeof(iconfiguration)).implementationinstance; services.configure<databaseoptions>(configuration.getsection("database")); } is right way iconfiguration instance collection or there more elegant solution? not want add iconfiguration instance parameter method. i created own "service collection" type wrapped iservicecollection , iconfiguration , modules use type register services. example: public interface imyservicecollection { public iservicecollection services { get; set; } public iconfiguration configuration { get; set; } } public static void addfoomodule(this imyservice

html - Css not working correctly on ie11 web server -

i have problem website after uploading on webserver, background changes picture every 6 seconds, , i've accomplish using css. works fine when open html file hard disk, in chrome , ie 11. when using web server, still works fine on chrome, on internet explorer 11 won't work. can me?

java - Changing baseUrl dynamically using retrofit & dagger2 -

i'm using retrofit & dagger2 application.i want change baseurl of application dynamically based on user selects in spinner. after spending couple of hours on internet came conclusion possible change baseurl dynamically. the dependency injection looks this: apimodule @module public class apimodule { string mbaseurl; public apimodule(string mbaseurl) { this.mbaseurl = mbaseurl; } @provides @singleton okhttpclient provideokhttpclient(cache cache) { okhttpclient.builder client = new okhttpclient.builder(); httplogginginterceptor logging = new httplogginginterceptor(); // set desired log level logging.setlevel(httplogginginterceptor.level.body); client.addinterceptor(logging); client.cache(cache); return client.build(); } @provides @singleton retrofit provideretrofit(okhttpclient okhttpclient) { return new retrofit.builder() .addcon

android - Fatal signal 7 (SIGBUS), code 2, fault addr 0x8e020c98 -

06-05 05:11:15.220078 3155 3155 aee/aed : revision: '0' 06-05 05:11:15.220131 3155 3155 aee/aed : abi: 'arm' 06-05 05:11:15.220477 3155 3155 aee/aed : pid: 3080, tid: 3080, name: droid.apps.maps >>> com.google.android.apps.maps <<< 06-05 05:11:15.220619 3155 3155 aee/aed : signal 7 (sigbus), code 2 (bus_adrerr), fault addr 0x8e020c98 06-05 05:11:15.220766 3155 3155 aee/aed : r0 8e020c9d r1 8e020c9c r2 6867fe9d r3 00000005 06-05 05:11:15.220841 3155 3155 aee/aed : r4 7d933648 r5 bec9075c r6 00000005 r7 bec90834 06-05 05:11:15.220893 3155 3155 aee/aed : r8 a67e9140 r9 bec907c0 sl bec907a8 fp a67e9140 06-05 05:11:15.220943 3155 3155 aee/aed : ip fffffff7 sp bec90730 lr a637ac71 pc a65598c8 cpsr a00d0030 06-05 05:11:15.253080 3155 3155 aee/aed : 06-05 05:11:15.253080 3155 3155 aee/aed : backtrace: 06-05 05:11:15.253232 3155 3155 aee/aed : #00 pc 002c78c8 /system/lib/libart.

javascript - How do I make a negative amount in form field produce a warning error -

i have .html form field when changes negative number, warns users field needs positive number ? appreciate assistance. in onblur event handler of html field, write javascript function check if value number. if is, check whether less 0. if yes, write css make field border red or display warning. or, can use field input type number min value set in html5. <input type="number" name="f1" id="f1" min="0">

android - How to persist webview cookies between app executions? -

it possible achieve in android? can find deprecated questions old methods (cookiesynchmanager) not seems work actually. it possible achieve it? can't find on android developers guide. thank you since cookiesynchmanager deprecated, cookiemanager.getinstance() cookiemanager instance entire application. hence, enable cookiemanager.getinstance().setacceptcookie(true) setacceptcookie(boolean accept); sets whether application's webview instances should send , accept cookies. https://developer.android.com/reference/android/webkit/cookiemanager.html

This app hasn’t been reviewed or approved by Slack. Learn more -

Image
i created bot on api.ai , tried integrate slack. clicking "test in slack" opens new browser window , shows "this app hasn’t been reviewed or approved slack. learn more." refer screenshot: what mean it, able use app url https://ait-corp.slack.com/messages/@ait/

How to add response headers to data-urls by Chrome.webRequest -

i according chrome.webrequest want change data-urls responseheaders.but can't capture data request in chrome.webrequest.onheadersreceived . am wrong ? chrome.webrequest.onbeforerequest.addlistener( function (details) { const url = details.url if(url == 'http://www.example.com/api/getusers') { return { redirecturl: 'data:application/json; charset=utf-8,' + json.stringify({"a":1, "b": 2}) } } return {cancel: false} }, {urls: ["<all_urls>"]}, ["blocking"] ) chrome.webrequest.onheadersreceived.addlistener( function (details) { console.log(details) // can't capture data-urls return {responseheaders:details.responseheaders}; }, {urls: ["<all_urls>"]}, ["responseheaders","blocking"] ) you can't capture data: urls webrequest api, since data: not supported scheme host permissions . as such, <all

c++ - Does push_back in vector insert at the same location? -

class example { public: int i; example(const example &e) { = e.i; } example(int i) { this->i = i; } }; int main() { std::vector<example*> vec; std::vector<example*> newvec; example* ex1 = new example(1); example* ex2 = new example(2); vec.push_back(ex1); vec.push_back(ex2); //newvec = vec; --> shallow copy for(int i=0; i<vec.size(); ++i) // --> deep copy { example newe(*(vec[i])); newvec.push_back(&newe); } for(int i=0; i<newvec.size(); ++i) { std::cout << "\nfoobar" << newvec[i]->i << "\n"; } } the above code prints foobar2 twice. shouldn't print foobar1 , foobar2? also, best way copy vector containing objects? want deep copying. for(int i=0; i<vec.size(); ++i) // --> deep copy { example newe(*(vec[i])); newvec.push_back(&newe); } in code make copy of vec[i] example newe . push_back address of newe newvec

arrays - Set img src property from byte[] -

i'm trying show thumbnailphoto property of activedirectory user on mvc view. i'm parsing needed properties list of class named employee: for (int counter = 0; counter < resultcol.count; counter++) { result = resultcol[counter]; if (result.properties.contains("samaccountname") && result.properties.contains("displayname") && result.properties.contains("sn") && result.properties.contains("givenname")) { list.add(new employee { email = (string)result.properties["samaccountname"][0], firstname = (string)result.properties["givenname"][0], lastname = (string)result.properties["sn"][0], pictureblob = result.properties.contains(&quo

c++ - Alternative to virtual variables -

i have 2 classes, base , derived . derived inherits base , additionally includes several functions , variables -- therefore need have 2 separate classes. however, share 1 function, run . in example below have pass argument run in order execute read - argument depends on class object refers to. possible write generic version of read such program automatically uses vars_base or vars_derived depending on object calls run ? #include <iostream> #include <fstream> #include <string> #include <vector> class base { protected: void read(std::vector<std::string>); public: void run(std::vector<std::string> vars) { read(vars); } std::vector<std::string> vars_base; }; void base::read(std::vector<std::string> int_vars) { (auto int_vars_it : int_vars) { std::cout << int_vars_it << "\n"; } } class derived : public base { protected: public: std::vector<std::string>

python - Sorting a list of strings based on the first element from split (datetime) -

i have long list of strings, separated commas (basically, csv files read line line strings, not performing split on separator): lines[0] = "2017-08-01 13:45:58,mytext,mytext2,mytext3,etc" lines[1] = "2017-08-01 15:45:58,mytextx,mytext2x,mytext3x,etcx" lines[2] = "2017-08-01 19:45:58,mytexty,mytext2y,mytext3y,etcy" lines[3] = "..." from this post know following code should work if lines consist of datetimes: lines_sorted = sorted(lines, key=lambda x: datetime.datetime.strptime(lines, '%y-%m-%d %h:%m:%s')) i thought use partition extract tuples lines in files, first element contains datetimepart: for unsortedfile in glob('*.txt'): open(unsortedfile, 'r') file: lines = [line.rstrip('\n').partition(',') line in file] lines_sorted = sorted(lines, key=lambda x: datetime.datetime.strptime(lines[0], '%y-%m-%d %h:%m:%s')) ..but of course, not work "typeerror: list i

Azure Blob CORS setup for multiple certain hosts -

Image
the limitations configure cors in blob storages frustrating me. maximum 265 characters no wildcard hosts maximum 5 cors rules as result of these restrictions, come maximum of ~48 hosts. see docs.microsoft.com . for scenario (private cdn serve assets js, css, fonts), can not see other way use * allowedorigins . is way? nobody (no other host) should able use licensed fonts ( https://www.viget.com/articles/cors-youre-doing-it-wrong ). integration a wildcard *.int.any.local.network solution. http://brand-at.int.any.local.network http://brand-be.int.any.local.network http://brand-bg.int.any.local.network http://brand-ca.int.any.local.network http://brand-ch.int.any.local.network http://brand-cn.int.any.local.network http://brand-tr.int.any.local.network http://brand-cz.int.any.local.network http://brand-de.int.any.local.network http://brand-dk.int.any.local.network http://brand-es.int.any.local.network http://brand-fi.int.any.local.network http://brand-fr.int.any.lo

swift3 - Can't use the Virtual Stick even though isVirtualStickControlModeAvailable returns true -

i having problem virtual sticks, following problem. the virtual sticks fire notification, listener sends proper values roll, pitch, yaw , throttle, isvirtualstickcontrolmodeavailable method sdk returns true, when returns true use command flight controller send returns completion error nil, means can not else there, not need else. virtual sticks working in timer sample simulator dji. what can in app? - take off - land - give control , forward rc none of list above brings me errors, including process of virtualstick. what else did try? - run sample simulator app dji, linked above. - run sample app on android - run using bridge app (thats how know values being passed correctly, though added labels on screen debug without bridge app) - update firmware aircraft , rc latest - sample simulator ios - went previous working commits , branches on git none of things have tried above worked. curious stuf: - virtual sticks worked fine till yesterday, , before yesterday,

pdo - Invalid argument supplied for foreach in PHP, -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers i running pdo query on mysql database , error saying there invalid argument supplied foreach. on frontend, pass string $questiontable , integer $questionid. what doing wrong? $query = $this->dbconnection->query("select * ('$questiontable') id = ('$questionid')"); foreach ($query $row) { echo $row; }; is because of shouldn't put '' query? mean: $query = $this->dbconnection->query("select * ($questiontable) id = ($questionid)");

php - how I can get third party user report data using AdWords API -

i have standard access but, can't adwords report data using mcc account customer_id so, how can third party user report data using adwords api when use mcc account customer_id can't data. , when use other customer_id it's not working user (i don't have customer_id type of user). i want create same report garden.

Returning the last element of a list in haskell using recursion -

how last element in list in haskell? have written of code below: lastlist :: list -> lastlist lst = case lst of cons x xs -> lastlist xs cons _ xs -> lastlist xs empty -> error "lastlist of empty list" how do without using of built in functions? you have check when element cons empty : lastlist :: list -> lastlist lst = case lst of cons x empty -> x cons _ xs -> lastlist xs empty -> error "lastlist of empty list"

Behavior of python's repr method -

i understand goal of repr unambiguous, behavior of repr confused me. repr('"1"') out[84]: '\'"1"\'' repr("'1'") out[85]: '"\'1\'"' based on above code, think repr put '' around string. when try this: repr('1') out[82]: "'1'" repr("1") out[83]: "'1'" repr put "" around strings , repr("1") , repr('1') same. why? there 3 levels of quotes going on here! the quotes inside string you're passing (only present in first example). the quotes in string produced repr . keep in mind repr tries return string representation work python code, if pass string, add quotes around string. the quotes added python interpreter upon printing output. these confuses you. interpreter calling repr again, in order give idea of type of object being returned. otherwise, string 1 , number 1 identica

python - Accessing dtype parsing behaviour of read_csv when creating a DataFrame from a nested list -

this follows discussion pirsquared here . basically, i'm curious why read_csv better (debatable?) @ inferring datatypes , being fault-tolerant creating dataframe from, say, nested list? there's lot of cases inferred datatypes acceptable work functionality doesn't seem exposed in dataframe() , meaning have manually deal dtypes unnecessarily, can tedious if have hundreds of columns. closest can find convert_objects() doesn't handle bools in case. example: import numpy np import pandas pd import csv data = [['string_boolean', 'numeric', 'numeric_missing'], ['false', 23, 50], ['true', 19, 12], ['false', 4.8, '']] open('my_csv.csv', 'w') outfile: writer = csv.writer(outfile) writer.writerows(data) # reading csv df = pd.read_csv('my_csv.csv') print df.string_boolean.dtype # automatically converted bool print df.numeric.dtype # float, expected prin

scala - Match words which have given regex around -

i need text have 2 or more spaces "\s{2,}" around them. given following text: ip address name location type 10.1.10.5 uslaxbowc01rb santa monica, ca local need extract: line1: "ip address", "name", "location", "type" line2: "10.1.10.5", "uslaxbowc01rb", "santa monica, ca", "local" edit: text eligible extraction: " ip address " & " name " 2 or more spaces apart eligible extracted. similarly, " santa monica, ca " & " local ". you try split text according pattern " \s{2,} ". thus, in python, regex lib re give needed tools: import re line = "ip address name location type" result = re.split('\s{2,}',line) which gives: ['ip address', 'name', 'location', 'type'] edit i guess understood little more question :

symfony - How to deal with 3 form on the same page? -

i have page 3 forms , independent (the user can complete 0, 1, 2 or 3) : the first asks phone number if user wants called; the second same if user wants contacted sms; the third used if user want add commentary what best way handle situation? should repeat code 3 times in controller ? public function mypageaction(request $request) { // first 1 $form = $this->createformbuilder() ->add... ->getform(); $form->handlerequest($request); if ($form->issubmitted() && $form->isvalid() ) { // code } // second 1 $form2 = $this->createformbuilder() ->add... ->getform(); $form2->handlerequest($request); if ($form2->issubmitted() && $form2->isvalid() ) { // code } // third 1 $form3 = $this->createformbuilder() ->add... ->getform(); $form3->handlerequest($request); if ($form3->issubmitted() && $form3->isvalid() ) { // code } } and in

hyperledger composer - Named query not visible in the explorer -

i have created business network , exported .bna. deployed .bna , created rest-server using composer-rest-server. but unable find named queries, defined .qry file in explorer dashboard. could tell me, issue not reflecting query rest board. can see query. please suggest. i able see named query after changing bna name , redeploying it. not sure, there issue cache, might pointing older bna name.

javascript - How to create maximum 8 <input type="button"> with value A, B, C and so on? -

i trying create, @ max, 8 buttons , successful @ that, want give values buttons a, b, c , on.. here code have done far: var buttonvalue = 1; function addbutton(){ if(buttonvalue <=8){ var targetdiv = document.getelementbyid('targetdiv'); var inputfield = document.createelement('input'); inputfield.setattribute('type','button'); inputfield.setattribute('id',"input-"+buttonvalue+""); inputfield.setattribute('class','controls'); targetdiv.append(inputfield); } buttonvalue++; } but want give values buttons a, b, c , on. the character code a 65 ( "a".charcodeat(0) ). can use string.fromcharcode create values adding buttonvalue - 1 65 : inputfield.setattribute("value", string.fromcharcode(65 + buttonvalue - 1)); // or inputfield.defaultvalue = string.fromcharcode(65 + buttonvalue - 1); // or inputfield.value = string.f