Posts

Showing posts from July, 2010

How to print a list containing strings with a specific number of spaces between each string? -

i'm working on making code prints strings list, need have specific number of spaces between each word. i'm working java. you can so: for (string item : list) { system.out.print(item + " "); } system.out.println(); assuming number of spaces low can add end.

javascript - e.target is body on click when context menu is visible -

i have event: $(document).on('click', function(e) { var $target = $(e.target); if ($target.is('.element')) { console.log('element'); } }); and have issue: when right click show context menu , click on .element (when context menu visible) e.target body not .element in chrome. how can detect if click on .element ? i've resolve issue adding code: function inside(element, x, y) { var offset = element.offset(); var width = element.outerwidth(); var height = element.outerheight(); return (x > offset.left && y > offset.top && x < (offset.left + width) && y < (offset.top + height)); } $(document).on('click', function(e) { e = e.originalevent; var inside_elements = $('.element').get().filter(function(element) { return inside(element, e.pagex, e.pagey); }); if (inside_elements.length) { console.log('element'); }

Reverse proxy multiple tomcats on same nginx on same server -

i have 2 different versions of tomcat running on server , using nginx reverse proxy traffic on default 80 port. in server block cannot have tow locations /. tried change default root url of tomcat within server.xml using context element below. and have server block as: tomcat 7 homepage location /tomsev { proxy_pass http://127.0.0.1:8080; } # tomcat 8 homepage location / { proxy_pass http://127.0.0.1:9506; } this loads ui placed in tomcat 8 not in 7. have servlet application deployed on tomcat 7. after many trials , errors finaly managed page loaded unable load css, js, mime files. throw unable load resources error. application url is: http://myserver.com/myapplication/landingpage.do tomact 7: deployed application war file in webapp folder. nginx config file: server { listen 80; server_name myserver.com; # tomcat 8 homepage location / { proxy_pass http://127.0.0.1:9506; } location /myapplication/ {

httprequest - SRTServletRequest getSession(true) returns HttpSession with same sessionId -

i facing issue httprequest.getsession(true) - when called multiple times after invalidating session - returning session object new hashcode same session id. set details - jdk8 websphere9.0 application: 2 wars: 1 jsp servlet based app, second 1 angular2 spring based app requirement: between 2 wars deployed inside same bla ear, need share session, using ibmapplicationsession attribute , set calls - place httpsession being used if working on pages part of jsp servlet jar app - below code able create new session different session id 1.httpsession session = request.getsession(false); //few other lines 2.session.invalidate(); //few other lines 3.session = request.getsession(true); i.e. session @ end has different session id session invalidated however if go war has angular2 , spring based application - create instance of ibmapplicationsession store attributes (get , set attributes call) -- , come war has jsp based application - same lines of code giving totally different , st

Ansible inventory group array pointer to parent -

i want check if knows if there solution problem facing in ansible. i have inventory file looks this:- [clustera] 10.0.0.1 10.0.0.2 10.0.0.3 .... [clusterb] 10.1.0.1 10.1.0.2 10.1.0.3 .... [web-lb] 10.0.0.1 10.1.0.1 instead of repeating ip address in web-lb group, want this:- [web-lb:children] clustera[0] clusterb[0] if can script group mentioned above, don't need duplicate ip addresses, , can mix different item group group, eg [weba-lb:children] clustera[1] clustera[5] clusterb[3] updated having below configuration doesn't work well [weba-lb] clustera[1] error: bbed5901ea74:~$ ansible -i hosts --list-hosts hosts (6): 10.1.0.1 10.1.0.2 10.1.0.3 10.0.0.1 10.0.0.2 10.0.0.3 bbed5901ea74:~$ vi hosts bbed5901ea74:~$ ansible -i hosts --list-hosts error! attempted read "hosts" yaml: syntax error while loading yaml. error appears have been in '/home/jenkins/hosts': line 2, column 1, may elsewhere in file depending on exact syntax problem

How to do css media query equivalent within javascript -

i want change javascript below if screen resolution 768px wide or lower, header_height variable reduced 50 instead of 100, otherwise stays @ 100. in advance assistance! <script> $(window).scroll(function () { var elem = $('.header'); var header_height = 100; var header_top = elem.offset().top; var current_top = $(this).scrolltop(); if (current_top > header_height && !elem.hasclass('fixed')) { elem.addclass('fixed'); $('body').addclass('fixed-padding'); } else if(current_top <= header_height && elem.hasclass('fixed')) { elem.removeclass('fixed'); $('body').removeclass('fixed-padding'); } }); </script> you can window width using window.innerwidth , , combine ternary operator set value of header_height : var header_height = (window.innerwidth <= 768) ? 50 : 100; it's worth

node.js - Pdfkit node + express Download PDF -

i'm triying download pdf when click on button. response de api node , if try on postman works ok , can save pdf, when call api express don't know how call it. node function function generarpdf(req, res){ let presupuestoid = req.params.id; let doc = new pdf(); res.setheader('content-disposition', 'attachment; filename="' + presupuestoid + '.pdf"'); res.setheader('content-type', 'application/pdf'); doc.font('times-roman').fontsize(12).text(presupuestoid,100,100) doc.pipe(res); doc.end(); } route api.get('/generarpdf/:id', md_auth.ensureauth, presupuestocontroller.generarpdf); express service generatepdf(token, id){ let headers = new headers({ 'content-type':'application/json', 'authorization':token }); return this._http.get(this.url+'generarpdf/' + id, {headers: headers}) .map(res => res.json()); } express view oncrearpdf

reactjs - The navigation reducer is not called while navigating -

Image
i trying achive nested navigation using reactnavigation have reducer following below : import appnavigation '../navigation/appnavigation' export const reducer = (state, action) => { const newstate = appnavigation.router.getstateforaction(action, state) console.log("reducer running") return nextstate || state; } from 1 of screen trying navigate screen using this.props.navigation.navigate('orderpreviewassigned') i can see dispatch action in console reducer not getting triggered. console output : ps : reason trying achieve because i want prevent navigating twice when clicking button quickly , plan read current route , if route different navigate or don't. it looks have not set redux integration correctly react navigation. need pass state , dispatch main appnavigator so: import { addnavigationhelpers } 'react-navigation'; const appnavigator = stacknavigator(approuteconfigs); class app extends react.co

javascript - Aborting / canceling running AJAX calls before execute new AJAX in JS -

i've never done type of manipulation of ajax calls (to stop/abort/cancel or ignore? running ajax calls before execution of new one) before don't understand how , appreciate direction. i have page in app make number of ajax calls fill dynamically data in table (object name, object fit, object progress) when page loads. example, there 5 rows in table. call $.post("/getfit", {objectid: objectid}, function (result) { manipulation result } and $.post("/getprogress", {objectid: objectid}, function (result) { manipulation result } 5 times each in loop -- 1 each of objects. the first column of table has links more detail on object, , clicking on them call ajax: $(document).off('click', '.js_object').on('click', '.js_object', function (e) { var objectid = $(this).attr("id") $.post("/viewobject", {objectid: objectid}, function (result) {document.getelementbyid("main_window_content

python - How can I combine two presentations (pptx) into one master presentation? -

i'm part of project team created pptx presentations present clients. after creating of files, need add additional slides each presentation. of new slides same across each presentation. what best way accomplish programmatically? i don't want use vba because (as far understand) have open each presentation run script. i've tried using python-pptx library. documentation states: "copying slide 1 presentation turns out pretty hard right in general case, won’t come until more of backlog burned down." i hoping following work - from pptx import presentation main = presentation('universal.pptx') abc = presentation('test1.pptx') main_slides = main.slides.get(1) abc_slides = abc.slides.get(1) full = main.slides.add_slide(abc_slides[1]) full.save('full.pptx') has had success that?

python - Understanding requests versus grequests -

i'm working process follows: build list/other iterable of urls. make http request each of them , response object. create beautifulsoup object text of each response. pull text of tag beautifulsoup object. from understanding, seems ideal grequests : grequests allows use requests gevent make asynchronous http requests easily. but yet, 2 processes (one requests, 1 grequests) seem getting me different results, of requests in grequests returning none rather response. using requests import requests tickers=[ 'a', 'aal', 'aap', 'aapl', 'abbv', 'abc', 'abt', 'acn', 'adbe', 'adi', 'adm', 'adp', 'ads', 'adsk', 'aee', 'aep', 'aes', 'aet', 'afl', 'agn', 'aig', 'aiv', 'aiz', 'ajg', 'akam', 'alb', 'algn', 'alk', 'all', '

ios - What is hasProtectedContent for AVAsset -

i notice property hasprotectedcontent in avasset vaguely defined. assets containing protected content may not playable without successful authorization, if value of playable property yes. [doc] can elaborate protected content property means , when true ? required (or practice) check value before attempting play video?

javascript - Why is my array returning empty? -

this question has answer here: using .slice method on array 1 answer var array= ["a", "b", "c", "d"] var finalarray= array.slice(2,2); console.log(finalarray); this returns: finalarray=[] i return: finalarray=["c","d"] the first argument index @ begin extraction, , second 1 index before end extraction. so, last 2 elements (indexes 2 , 3), need this: var array= ["a", "b", "c", "d"] var finalarray = array.slice(2, 4); // or slice(2), since 4 length of array console.log(finalarray); more info on array.prototype.slice() available in mdn documentation .

terminal - Liquibase: Communications link failure -

i try run liquibase terminal: command: user@host ~/development/liquibase $ java -jar liquibase.jar --changelogfile=changelog/create.xml --username=root --password=pass123 --url=jdbc:mysql://192.168.1.8:3306/semafor --classpath=lib/mysql-connector-java-5.1.44-bin.jar update unexpected error running liquibase: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure last packet sent server 0 milliseconds ago. driver has not received packets server. ping host: ~/documents/development/liquibase $ ping 192.168.1.8 ping 192.168.1.8 (192.168.1.8) 56(84) bytes of data. 64 bytes 192.168.1.8: icmp_seq=1 ttl=64 time=1.29 ms

email - Test New Members for Mailchimp -

i have test scripts add emails mailchimp mail list (among other actions). use real gmail address variable tag (e.g john.doe+12122121212@gmail.com), tool might detect fake email addresses. yet after few runs mailchimp figures , generates 'that user added many lists' error. any advice how fix test? i considered creating large pool of gmail addresses alternating randomly seems solution (not sure 100% legit ...). there few less known disposable email api pass real mailchimp, yet not 100% sure there risk in api provider discrete, , revealing company info (i.e. email designs) third parties/competitors. creating 12122121212@gmail.com might affect delivery rating. theoretically can ask developers generate special error code case, rather avoid if possible.

How do I use the testing package in go playground? -

the testing package available in go playground. how can use go playground demonstrate testing concepts, without access go test ? my assumption it's possible using testing.runtests function. attempts generate "testing: warning: no tests run". example: https://play.golang.org/p/pvrcmdexhx for context, use case sharing quick examples of tests, examples , benchmarks colleagues. rely on go playground sharing code snippets often. you need use testing.main : func main() { testsuite := []testing.internaltest{ { name: "testcasea", f: testcasea, }, } testing.main(matchstring, testsuite, nil, nil) } https://play.golang.org/p/dqsigknwwd if want use "non deprecated", unstable way: https://play.golang.org/p/4zh7didcap

java - Is there a way to prevent the "Delete and update AspectJ markers" from updating on every build? -

whenever build, build process takes forever. gets stuck in "delete , update aspectj markers myproject". there way can speed or possibly make build faster? seems though gets stuck in phase , sits there hours. i'm using java 8. running aspectjrt , aspectj. i'm running eclipse oxygen , jrebel. maven 3.0 build tool. if there else need in order me figure out. please ask. thanks.

Access database doesn't recognize linked SharePoint lists -

i have access database linked several sharepoint lists. works in computer , others, there other computers on database doesn't work. doesn't recognize lists, there no connection, when i'm seeing them linked in database. computers run access 2013.

r - Trim Data Based on First Character of Column Name -

i have data set multiple columns. using r want keep column have first character t create subset shown in output data below. input data t1234 t5678 t9101112 b d e 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 output data t1234 t5678 t9101112 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 any suggestion how can achieved? thanks. in base r using regex df <- data.frame(t1234=rep(1,7),t5678=2,t9101112=3,a=4,b=5,d=6,e=7) df[,grepl("^t",names(df))] the regex pattern ^t matches t @ beginning of each row name. refine pattern ^t\\d+ if wanted match "t" followed 1 or more numbers, example. also note ^ asserts you're @ beginning of string. without you'd match "at912340"

javascript - Why my click event handler is (YES "is") working? -

i know it's bit funny because people ask solution not working, in case it's exact opposite. i playing around javascript , discovered puzzled me! tried searching online can't find useful of subject. the problem this: after calling function bar once, onclick event working fine. how possible!? but when ask type of variable x returns undefined instead of number , normal, because x inside bar . function bar() { var p = document.getelementbyid("foo"); p.onclick = showalert; var x = 5; alert("bar function called !"); } bar(); can enlighten me happening, detailed explanation appreciated. full code: (jsfiddle link: https://jsfiddle.net/ge4gj5nw ) <!doctype html> <html> <head> <style> #foo { border: solid blue 1px; width: 30%; padding: 10px; } </style> </head> <body> <p id="foo">my event element</p> &l

list - python select lines based on maximum value of a column -

i'm not familiar python, there's need do. have ascii file (space-separated) of several columns. in first column, values duplicates. these duplicate values, need select lines have larger value in 3rd column, example, , return array back. i'd this: #col1 col2 col3 col4 col5 1 1 2 3 4 1 2 1 5 3 2 2 5 2 1 would return lines 1 , 3. here's have far: defined auxiliary function detect indexes of duplicates (all second entries) def list_duplicates(seq): seen = set() seen_add = seen.add return [idx idx,item in enumerate(seq) if item in seen or seen_add(item)] and try use read list (that loaded file np.genfromtxt naming each column) def select_high(ndarray, dup_col, sel_col): #dup_col column duplicates are, sel_col column select larger value result = [] dup = list_duplicates(ndarray[dup_col]) dupdup = [x-1 x in dup] in range(len(ndarray[sel_col])):

javascript - TypeError: Cannot read property 'push' of undefined D3? -

i don't know d3 chart doesn't work. i've been trying 2 days no result. it's throwing typeerror: cannot read property 'push' of undefined error. here complete code <!doctype html> <meta charset="utf-8"> <body> <style> .link { stroke: #666; opacity: 0.9; stroke-width: 1.5px; } .node circle { stroke: #fff; opacity: 0.9; stroke-width: 1.5px; } .node:not(:hover) .nodetext { display: none; } text { font: 7px serif; opacity: 0.9; pointer-events: none; } </style> <script src=http://d3js.org/d3.v3.min.js></script> <script> var links = [ { "source" : "a", "target" : "b", "value" : "1" }, { "source" : "a", "target" : "c", "value" : "2" }, { "source" : "a", "target" : "d", "value" : "3" }, { "source" : "a",

android - Crash reports sent according to logcat but didn't show in Arcalyzer Dashboard? -

i creating arithmetic exception receive crash report using arca. have set end @ cloudant using arcalyzer. after crash, according logcat, crash report has been sent no report being shown @ arcalyzer dashboard. couldn't figure out wrong code. mainapp: @reportscrashes( formuri = "https://terrybogard911.cloudant.com/acra-faheemcallrecorder/_design/acra-storage/_update/report", reporttype = httpsender.type.json, httpmethod = httpsender.method.post, formuribasicauthlogin = ""//login, formuribasicauthpassword = ""//password, customreportcontent = { reportfield.app_version_code, reportfield.app_version_name, reportfield.android_version, reportfield.package_name, reportfield.report_id, reportfield.build, reportfield.stack_trace }, mode = reportinginteractionmode.toast, restoasttext = r.string.toast_crash ) public class mainapp extends

Hotel communication microservice -

in microservice architecture hotel want create communication service handle emails, sms, ... service should triggered asynchronous events. should these events called: send_reservation_confirmation_email, making reservation service aware of email communication. or should there more generic event reservation_confirmed, resulting in confirmation email? should these events called: send_reservation_confirmation_email no. events should named sentences in past. making reservation service aware of email communication i not make coupling. reservation service responsible reservations, not methods of notifying customers. or should there more generic event reservation_confirmed, resulting in confirmation email? yes, reservation_confirmed seems choice; represent what had happened , not contain indication of should done next. workflow/process of notifying customer should managed component, i.e. saga/process manager. saga receive reservation_confirmed event , s

linux - Hiding my login credentials for vpn -

so here code automatically logins schools vpn. #!/usr/bin/expect spawn sudo openconnect vpn.ucr.edu/engineering expect -r "\[sudo] .*\: " { send "pw_for_my_linux\n" } expect "username:" { send "my_vpn_username\n" } expect "password:" { send "vpn_password\n" } interact i wondering if there anyway can hide username or password when goes directly file not shown in plain sight se credentials. thank you!

How to make all buttons having ActionEvent handler handle Enter key in JavaFX? -

i have 50 buttons in application. buttons created handler way: @fxml protected void handlefoobuttonactionevent(actionevent actionevent) { ... } this way user can press buttons using mouse left button or space key. however, normal practice (as know) allow user press button using enter key. possible make buttons having actionevent handler (see above) handle enter key in javafx, example if have reference stage stage , scene scene or parent root ? you can configure scene it: scene.getaccelerators().put( keycombination.valueof("enter"), () -> { node focusowner = scene.getfocusowner(); if (focusowner instanceof button) { ((button) focusowner).fire(); } }); you can event handler: scene.addeventhandler(keyevent.key_pressed, e -> { if (e.getcode() == keycode.enter) { node focusowner = scene.getfocusowner(); if (focusowner instanceof button) { ((button) focusowner).fire();

r - Assigning labels to values -

this question has answer here: match values in data frame values in data frame , replace former corresponding pattern other data frame 2 answers i have dataset numbers 1:70 correspond neighborhood name within city. data set so: date | area | count 04/16 1 12 04/16 1 1 05/16 2 3 06/16 3 10 i have dataframe area number , corresponding area name. number | name 1 franklin 2 state how can assign area number value corresponding name without having type out each number , name? you can match ## data dat = read.table(text=" date area count 04/16 1 12 04/16 1 1 05/16 2 3 06/16 3 10", header=true, stringsasfactors=false) areas = read.table(text="number name 1 franklin 2 state", header=true, stringsasfa

python - Write a program to allow the user to enter a number of 5-character product codes, in the format LLNNN (L=letter, N=number) -

write program allow user enter number of 5-character product codes, in format llnnn (l=letter, n=number). count , print total number of product codes starting “ab” , total number of product codes ending in “00”. devise set of test data test program , show evidence of testing. here have far prints 0 @ end. print( """ welcome product code sorter. plese enter stop signal have finished. please enter in format llnnn """) ab = 0 oo = 0 product = input("please enter product code ") while (product != "stop"): product = input("please enter product code") def count_letters(ab): ab in word: if product == "ab": ab += 1 return product 00 in word: if product =="00": oo += 1 return product print(ab) print(oo)

javascript - Jquery Sort Table Rows Based on Hidden Input -

i have table sort based on value of hidden input in each row. inputs numeric , in third column. sort in descending order. here's sample of table. thanks! <table class="sortme"> <thead> <tr> <th class="col-cat">category</th> <th class="col-title">title</th> <th class="col-id"></th> </tr> </thead> <tbody> <tr> <td class="col-cat">article category</td> <td class="col-title">article title 1</td> <td class="col-id"> <input type="hidden" name="id[]" value="1250"> </td> </tr> <tr> <td class="col-cat">article category</td> <td class="col-title">article title 2</td> <td class="col-id">

kubernetes - Two resource groups created for an ACS cluster -

i don't understand why separate resource group created of infrastructure associated acs cluster, , not resource group specify when creating cluster? leave defined resource group 1 lonely entity (the acs cluster definition) , whole new resource group name don't control. not fan of this. i using azure cli create acs cluster, i'm "guessing" if went arm route i'd have more control. still, limitation reside , why? here's cli command: az acs create -n=int-madraskube -g=internal-acs --orchestrator-type=kubernetes --agent-count=2 --generate-ssh-keys --windows --admin-username={myadmin} --admin-password={mypassword} --service-principal={sp_guid} --client-secret={secret_guid} and end 2 resource groups: internal-acs internal-acs_int-madraskube_westus2 this new design of acs (v2) in selected regions. in past (the v1), created resources in same resource group container service resource is. makes hard clean resources when delete contain

How can we define object type interface in typescript? -

i want define interface object , different types such export interface example { code: string; category : { name : string, reference: string, sequence : number }; } in definition, there no problem after calling like ex = {} example; ex.category.name ='electric; this not work , below error occurs error error: uncaught (in promise): typeerror: cannot set property 'name' of undefined typeerror: cannot set property 'name' of undefined there similar subjects not related. ( how define object in type script interface or how can define types of object variable in typescript? ) i appreciate assistance finding solution. type assertions not mean object of shape asserting @ runtime. can assert object of type, fail @ runtime if runtime type not match. in example, ex object not have category property undefined @ runtime leads error. you can initialize category property in object: var ex = { category: {} /

javascript - How to use bootstrap alert in php with page refresh -

i want password checking can not echo because page being refreshed when button clicked. when clicks button: first check password input then register. if password wrong, print bootstrap alert on form top php. how do this? form.php // form insert.php // connect database , insert form data

Does the MVEL Null-Safe operator work on methods? -

i have question regarding mvel null-safe ( ? ) operator. say have following java class: public class traveler { private set<string> visitedcountries; public set<string> getvisitedcountries() { return visitedcountries; } } if have mvel expression this: traveler.visitedcountries.contains("france") i nullpointerexception if visitedcountries field null. around this, can use null-safe operator: traveler.?visitedcountries.contains("france") if visitedcountries null, expression evaluates null instead of throwing npe. my question this: null-safe operator work on method invocations? example: traveler.getvisitedcountries().contains("france") will throw nullpointerexception if getvisitedcountries() returns null. but happens if put in null-safe operator? following if field visitedcountries null? traveler.?getvisitedcountries().contains("france") as turns out, expression travel

javascript - AngularJS ng-view not showing up using $routeProvider templates -

directory structure: public film - film.html - film-controller.js main - main.html - film-controller.js - app.js - index.html in index.html file have: <div ng-view> </div> in body , ng-app="myapp" in starting html tag app.js angular.module('myapp', ['ngroute']).config(config); function config($routeprovider) { $routeprovider.when('/', { templateurl: 'main/main.html', controller: 'maincontroller', controlleras: 'vm' }).when('/film/:id', { templateurl : 'film/film.html', controller: 'filmcontroller', controlleras: 'vm' }).otherwise({ redirectto : '/' }); } in main.html have <h1>hello {{vm.name}}</h1> line of code in main-controller.js: angular.module('myapp').controller('maincontroller', maincontroller); function maincontroller($http

apache kafka - worker not recovered - Current config state offset 5 is behind group assignment 20, reading to end of config log -

i using 3 nodes kafka connect cluster write data source to kafka topic , topic destination. works fine in distributed mode when 1 of worker stopped , restarted getting below message. [2017-09-13 23:48:44,519] warn catching assignment's config offset. (org.apache.kafka.connect.runtime.distributed.distributedherder:741) [2017-09-13 23:48:44,519] info current config state offset 5 behind group assignment 20, reading end of config log (org.apache.kafka.connect.runtime.distributed.distributedherder:785) [2017-09-13 23:48:45,018] info finished reading end of log , updated config snapshot, new config log offset: 5 (org.apache.kafka.connect.runtime.distributed.distributedherder:789) [2017-09-13 23:48:45,018] info current config state offset 5 not match group assignment 20. forcing rebalance. (org.apache.kafka.connect.runtime.distributed.distributedherder:765) [2017-09-13 23:48:45,018] info rebalance started (org.apache.kafka.connect.runtime.distributed.distributedherder:1187) [2017-0

django - Adding custom attrs to a form widget -

i'm working forms in django, , need add custom attribute widgets, example: widgets = { 'datefield': forms.widgets.dateinput(attrs = {'myownattr': 'foobar_value'}) } is valid? , if it, how can access template? tried {{ field.myownattr }} , doesn't return @ all.

python - How to tell if any element in a list of combinations is in a specific set in the most efficient way? -

here mean question: j = [1,2,3,4,5,6,7] k = [1,2,3,4,5,6,7] #i want generate possible pairs of pairs these 2 lists, example: p1 = (1,1) p2 = (2,2) paira = (p1,p2) # (1,1),(2,2) #this mean pair of pair #this i've got far: sa = set() #this has lot of pairs of pairs in sa.add(...) #... item in permutations(j): m1,m2 in combinations(zip(item,k),2): if (m1,m2) in sa: # want know # if pair(of pairs) # combination produces # in set sa #do stuff else: #do other stuff this part of code scales badly number of elements in list j,k increases. wonder there specific way in python make more efficient in terms of performance or cleaner in style. looks clumsy me. any idea , advice appreciated! in advance!

pascalscript - Inno Setup Set Uninstallable directive based on custom checkbox value -

i want know, how use uninstallable directive, when don't have tasks or components: [setup] uninstallable:not if iscomponentselected ('comp1 comp2') i don't have tasks or components created. created checkboxes "portable" option, want add uninstallable option, when 1 checked: [code] var component: twizardpage; portable,installer: tnewradiobutton; copmp: tlabel; function install: boolean; begin result := installer.checked; end; function portab: boolean; begin result := portable.checked; end; procedure initializewizard(); begin component := createcustompage( wpselectdir, 'component selection', 'which types , components install?'); comppanel := tpanel.create(wizardform); comppanel begin parent := component.surface; left := scalex(0); top := scaley(0); width := scalex(417); height := scaley(100); bevelouter := bvnone; end; copmp := tlabel.create(wizardform); copm

binary - Two's Complement 6-bit signed conversion -

i trying understand two's complement struggling grasp concept. the question is: show how following decimal integers stored in 6-bit two’s complement format. -45 the way solved by: the binary of 45 is: 101101 taking inverse: 010010 adding 1: + 1 becomes: 1010011 but issue having when totals out -45 can put 7-bit system. understanding concept appreciated, thanks! edit: ignore carry out number?

Apache/PHP/Rasbian/ not displaying webpages correctly -

Image
raspberry pi - debian stretch apache 2.4.25 php 7 myphpadmin http forwarded https myphpadmin , phpinfo not displaying correctly. please see images. not sure did. looking through google on how secure apache long story short. screwed up. how resolve. images should explain issue. i unsure of not working. color gone , formatting phpinfo, , myphpadmin doesnt show log in box.

javascript - Why are my checkbox and double-click functions not responsive? -

this question has answer here: event binding on dynamically created elements? 19 answers i have code making table on fly checkbox, , refreshing after minute. checkbox , double-click functions not working, , i'm not sure why. please help. <script type='text/javascript'> function vehicle() { $('#vehicles').html( <?php $username =$_session['user_name']; $sql = "select * gps_product gp_userid ='$username'"; $db = new dbclass($sql); echo '"<table>'; echo '<tr>'; echo '<th>name</th>'; echo '<th>driver</th>'; echo '<th>last seen</th>'; echo '<th>follow</th>'; echo '<th>status</th>'; echo &

ios - How do I add a google maps marker when Pressing a button? -

Image
is possible fetch child nodes parent in firebase db? trying this: i want posts @ same time. it fetches videos current users videos. want fetch users videos @ same time. here's code more understanding of i'm doing: fileprivate func fetchallpost() { fetchposts() fetchallpostsfromuserids() } fileprivate func fetchallpostsfromuserids() { guard let uid = firauth.auth()?.currentuser?.uid else { return } firdatabase.database().reference().child("posts").child(uid).observesingleevent(of: .value, with: { (snapshot) in guard let useridsdictionary = snapshot.value as? [string: any] else { return } useridsdictionary.foreach({ (key, value) in firdatabase.fetchuserwithuid(uid: key, completion: { (user) in self.fetchpostswithuser(user: user) }) }) }) { (err) in print("failed fetch following users ids:", err) } } var posts = [post]() fileprivate func fetchposts()