Posts

Showing posts from January, 2014

python - Is it possible to create a canvas inside of a class -

i working on project have have grid made of points... seems code of class ok because there no error message. can't create canvas inside of class? helping me. here code: from tkinter import * root = tk() class grid(): def createcanvas(self, master, width, height): self.canvas = canvas(master, width=width, height=height) return(self.canvas) def createlabel(self, master, textu): self.l = label(self.c, text=textu) self.l.pack() def createpoints(self, master, gridsize): # gridsize format '8x8' gridsize = gridsize.split('x') in range(len(gridsize)): gridsize[i] = int(gridsize[i]) #[8,8] example --> x,y coordinates spx = 0 spy = int(canvas['height']) in range(gridsize[1]): j in range(gridsize[0]): master.create_oval(spx, spy, spx+5, spy+5) spx = spx + (int(canvas['height'])/gridsize[0]) spx = ...

javascript - How to override the background color in material ui select field dropdown menu? -

Image
i have been working materialui time , impressed library - however, there times customizability sorely lacking. instance, trying style selectfield dropdown menu unable change several div styles. from have seen, select field contains dropdownmenu, in turn contains menu component. can see in image below, design close implementation, several issues. however, these issues causing problems right now. main issue can't theme div between paper element , menu element, unfortunately div white background applied to. if can style element able give top padding, simulate spacing between menu , selectfield . is there way style element? have used dropdownmenuprops of selectfield component pass menustyle override menu styles, allows me give menu border radius , green border, , doesn't allow me style parent div . has else had luck doing this? p.s. know theme.menu rather not use unless absolutely necessary, have override everywhere else menu component used. edit: ha...

api - Domain nameservers change in godaddy -

i using godaddy api change domain nameservers , errors: {"code":"failed_name_server_validation","message":"failed update nameserversduplicate ip address","name":"apierror"} or {"code":"failed_name_server_validation","message":"failed update nameserversduplicate nameservers","name":"apierror"} tried google it, not found useful. means , how fix this? thank in advance. i interpret validation on string failing, sure there no new lines or invalid characters in string submitting?

html/javascript: Hiding link destination and opening link in new tab -

i using following javascript (provided m59 in this previous answer) hide destination of link shows @ bottom of browser window when hovering on link: <div> <a data-href="http://www.google.com/"> link </a> <script type="text/javascript"> var anchors = document.queryselectorall('a[data-href]'); (var i=0; i<anchors.length; ++i) { var anchor = anchors[i]; var href = anchor.getattribute('data-href'); anchor.addeventlistener('click', function() { window.location = href; }); } </script> </div> this works fine, link open in new tab well. how have change script in order so? i tried using window.open('href','_blank'); instead of window.location = href; did not work. unless im missing something, obvious thing add target anchor: <a data-href="http://www.google.com/" target=...

Group by multiple columns in R's dplyr -

i group data frame multiple columns names elements of vector names_vec : df %>% group_by(names_vec) i error message: "column names_vec unknown". because there no 1 column called names_vec . how achieve this? use rlang::syms() coupled !!! : library(rlang) df %>% group_by(!!!syms(names_vec))

javascript - GA send event, not working with custom dimensions -

i'm trying include list of custom dimensions when sending ga click event. this code works: ga('send', 'event', category, action, label, { 'hitcallback': function () { //some code goes here } }); but when adding custom dimensions: ga('send', 'event', category, action, label, customdimensions.dimensionstosend, { hitcallback': function () { //some code }, 'hitcallbackfail': function () { alert("unable send google analytics data"); } }); neither hitcallback nor hitcallbackfail gets fired. read in few places ( like here ) should able add custom dimensions ga send event function, maybe i'm doing wrong. the problem second code block custom dimensions not being set appropriately. can't pass custom dimensions in further argument main ga() function. instead, need pass them in through fieldsobject (as part of object you're sending last argument), this: ga('s...

linux - What does the first star (*) mean in visudo command restriction -

restriction example in visudo : (all) nopasswd: (all) /bin/cp * /var/www/html/* i understand of it, first star driving me nuts. best guess , either command options or source path. thanks! it both options , source argument. command line starts /bin/cp , includes /var/www/html match. however rule might not what's intended. rather dangerous . can misuse rule bypass destination restriction.

Java, convert between two different generic instances -

i want make adapter interface (and implementations) use multiple similar external libraries. for example, there interfaces of external libraries. these libraries guide implement converter , register extend features. lib a public interface aconverter<s, d> { d convert(s source); } lib b public interface bconverter<s, d> { d convert(s source); } both interfaces specify same method. what want use own myconverter interface. public interface myconverter<s, d> { d convert(s source); } a user implements class , library converts implementation either liba's implementation of aconverter or libb's implementation of bconverter . possible? edit: i not want factory pattern or extends liba interface , libb interface. myconverter core library, liba , libb external plugable libraries. what trying is, public alibadapter { aconverter change(myconverter convert) { /** * can do? */ return aconverter; ...

java - Google Data Loss Prevention API -

does google data loss prevention api support .pdf or .docx? trying reduction on *.pdf file in java hide sensitive data. many thanks! emi currently, google data loss prevention api supports string of text. sample input: { "items": [ { "value": "my phone number (123) 456-7890", "type": "text/plain" } ], "replaceconfigs": [ { "replacewith": "[redacted phone number]", "infotype": { "name": "phone_number" } } ] } url: post https://dlp.googleapis.com/v2beta1/content:redact sample output: { "items": [ { "type": "text/plain", "value": "my phone number [redacted phone number]" } ] }

printing - Cannot Connect to X server -

Image
theres cups server installed prints tif files , sends them on designated printers. station connects server works fine no errors , prints batch perfectly. on same network station, tried doing same thing out success , following error after printbatch command help please!

mongodb - Load end points from multiple files dynamically - Python Flask -

i trying create web service using flask , mongodb. i have earlier worked tornado had classes in different files , able load end points dynamically using get_routes tornado_json.routes . import tornado.ioloop import tornado.web import json import custom tornado_json.routes import get_routes tornado_json.application import application if __name__ == "__main__": # automatically generate routes webapp routes = get_routes(custom) # create , start application application = application(routes=routes,settings={"cookie_secret": "ffcd62b9ce7f9f0c28681112ca15e2145f8fc4005c0716a2a9f4ddedb0b40871",}) application.listen(5000) tornado.ioloop.ioloop.current().start() in above code custom refers directory .py files where. whenever application starts loads endpoints folder. i know if there similar method need not api.add_resource(todosimple, '/<string:todo_id>') add these lines every class write in flask .

branch io integration with Adobe air app issue -

our ios app live in itunes, , want integrate branch io. can build ipa testing, when try "export release build", flash builder 4.6 hang. this branch io guide following: https://dev.branch.io/getting-started/sdk-integration-guide/guide/adobe/ we followed steps, , put in stuff step 4, called branch.init() in main class. setting in branch io setup ok. here codes, (just copied branch io's website) // create branch instance: var branch:branch = new branch(); // register 2 events before initializing sdk: branch.addeventlistener(branchevent.init_failed, initfailed); branch.addeventlistener(branchevent.init_successed, initsuccessed); private function initfailed(bevt:branchevent):void { trace("branchevent.init_failed", bevt.informations); } private function initsuccessed(bevt:branchevent):void { trace("branchevent.init_successed", bevt.informations); // params deep linked params associated link user clicked before showing // param...

Facebook API post link with custom picture -

i set custom picture , caption link. impossible v2.9. there kind of workaround without specifying og: tags. when using facebook graph v2.8, post link , display custom image , not "og:image". done adding picture parameter hook. https://graph.facebook.com/v2.9/me/feed?link=https%3a%2f%2fwww.google.com%2f&picture=https%3a%2f%2fi.ytimg.com%2fvi%2ftntocgkgt98%2fmaxresdefault.jpg&name=test&message=this%20is%20a%20test&access_token=********** the graph api @ 2.9 , per documentations still supposed work facebook api doc however, keeps getting overridden scraped image. else experiencing problem or have workaround.? facebook api explorer picture, name, caption, thumbnail, description set deprecated. https://developers.facebook.com/docs/apps/changelog#v2_9_90_day_deprecations

http - Screen capture using PhantomJS web server module -

i have phantomjs web server module running on localhost:8082. send http request opens website , screen captures it. understanding can add parameters (such address or output ) request. unfortunately, cannot find list of accepted parameters documentation of web server module rather sparse. additionally, not sending request javascript environment , therefore cannot require reference webserver module (as recommended docs). my idea send http request looks this: get http://127.0.0.1:8082?open=http://www.google.com&output=result.png is possible using phantomjs' web server module? how proper request like?

html - Overlaying groups of elements with css -

i'm trying have text flow across screen in front of matrix background. when try it, marquee pushes matrix background down, , leaves annoying black space. trying put matrix (div columns) reach top of page, behind marquee. have tried experimenting css absolute positioning, must doing wrong... here's code far. <html> <head> <hta:application applicationname="matrix" version="1.0.0.0" author="someone" border="none" innerborder="no" caption="no" sysmenu="no" maximizebutton="no" minimizebutton="no" icon="no" scroll="no" scrollflat="yes" singleinstance="yes" windowstate="maximize" showintaskbar="no" contextmenu="no" selection="no"/> <title>matrix © 2017</title> <style type="text/css"> body{ background-co...

java - Realm can't create Nested Objects from Json -

i've been trying create nested realmobject using json creates first object , not nested ones. appreciate on this. my realm classes: content.java public class content extends realmobject { private string uuid; realmlist<contentdetailmodel> contentdetail; public content() { super(); this.uuid = uuid.randomuuid().tostring(); } public string getuuid() { return uuid; } public realmlist<contentdetailmodel> getcontentdetails() { return contentdetail; } public void setcontentdetails(realmlist<contentdetailmodel> contentdetails) { this.contentdetail = contentdetails; } } contentdetailmodel.java: public class contentdetailmodel extends realmobject { string filename; string contenttypeid; realmlist<contentdetailmetadatamodel> contentdetailmetadata; realmresults<content> content = null; public string getfilename() { return filename; } ...

java - How can I fix FileNotFoundException exception if the file is already there? -

i created .jks file command keytool -genkey -alias teamcity -keyalg rsa -keystore keystoretc.jks -keysize 2048 after moved .jsk file directory receiving error failed load keystore type jks path file:///c:/integrationproces/teamcitydeploy/keystoretc.jks due c:\integrationproces\teamcitydeploy\keystoretc.jks (the system cannot find path specified) java.io.filenotfoundexception: c:\integrationproces\teamcitydeploy\keystoretc.jks (the system cannot find path specified) the file in directory have no idea why java.io.filenotfoundexception exception i using catalina(tomcat) , teamcity , trying enable https , configuration in server.xml <connector port="8099" protocol="org.apache.coyote.http11.http11nioprotocol" sslenabled="true" maxthreads="150" scheme="https" secure="true" clientauth="false" sslprotocol="tls" keystorefile="file:///c:/integrationproces/teamcitydep...

r - How to properly return character values for dplyr's do? -

consider following code: foo <- function() { if (runif(1) < 0.5) { return(data.frame(result="low")) } else { return(data.frame(result="high")) } } df = data.frame(val=c(1,2,3,4,5,6)) df %>% group_by(val) %>% do(foo()) it random, if there both "low" , "high" results returned, you'll see errors this: warning messages: 1: in bind_rows_(x, .id) : unequal factor levels: coercing character 2: in bind_rows_(x, .id) : binding character , factor vector, coercing character vector 3: in bind_rows_(x, .id) : binding character , factor vector, coercing character vector 4: in bind_rows_(x, .id) : binding character , factor vector, coercing character vector 5: in bind_rows_(x, .id) : binding character , factor vector, coercing character vector i believe first value being returned (say, "low") converted factor 1 level, , when other level comes along, incurs dplyr's wrath. what proper way code exa...

react native - How do you add refs to functional components using withHandlers in Recompose and call ScrollTo on a ScrollView? -

my specific goal use scrollto method of scrollview maintain functional component structure. more requires getting ref current component isn't possible naked react native . in dec 2016 recompose added allows handlers property of withhandlers factory function can't quite figure out how use correctly. how add refs functional components using withhandlers in recompose , call scrollto on scrollview? you can try this: /* ... */ const myview = ({ onref, children }) => ( <view> <scrollview ref={onref} /* ... */> {children} </scrollview> </view> ) export default compose( withhandlers(() => { let myscroll = null; return { onref: () => (ref) => (myscroll = ref), scrollto: () => (value) => myscroll.scrollto(value) } }, lifecycle({ componentdidmount() { this.props.scrollto({ x: 0, y: 100, animated: true }) ...

python - Numpy nd array to pandas column without [] -

i'm trying transform numpy nd array pandas column, data coming brackets. this np array: array([[[ 7.10105920e+07], [ 9.18736320e+07], [ 8.35562800e+07], [ 7.16590640e+07], [ 8.28060960e+07], [ 6.77042000e+07], [ 7.07195360e+07], [ 1.04754616e+08], [ 7.27420400e+07], [ 7.33461760e+07], [ 6.34156040e+07], [ 8.00440800e+07], this how i'm sending dataframe: predictions = pd.dataframe() predictions['y_test'] = y_test[0].tolist() this i'm getting: y_test 0 [71010592.0] 1 [91873632.0] 2 [83556280.0] 3 [71659064.0] 4 [82806096.0] 5 [67704200.0] 6 [70719536.0] 7 [104754616.0] 8 [72742040.0] 9 [73346176.0] how can remove brackets ([])? it looks 3d array. can pass first element dataframe constructor: pd.dataframe(y_test[0], columns=['y_test']) out: y_test 0 71010592.0 1 91873632.0 2 8...

algorithm - C++ lambda function in priority_queue with capture by reference -

i solving algorithm problem - "find k-th ugly number", below problem statement , implementation. write program find n-th ugly number. ugly numbers positive numbers prime factors include 2, 3, 5. example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 sequence of first 10 ugly numbers. vector<int> tmp(1,1); vector<int> primes({2,3,5}); vector<int> indices(3, 0); // lambda function pass in variables captured reference priority_queue<int, vector<int>, function<bool(const int&, const int&)>> pq([&](const int& a, const int& b){ return primes[a] * tmp[indices[a]] > primes[b] * tmp[indices[b]]; }); pq.push(0); pq.push(1); pq.push(2); while(tmp.size() <= 3) { // find first 3 ugly number int primeindex = pq.top(); pq.pop(); int nextval = primes[primeindex] * tmp[indices[primeindex]]; pq.push(primeindex + 1); indices[primeindex]++; while(!pq.empty() && primes[pq.top()] & tmp[indices[pq.top()]...

c# - What is an IndexOutOfRangeException / ArgumentOutOfRangeException and how do I fix it? -

i have code , when executes, throws indexoutofrangeexception , saying, index outside bounds of array. what mean, , can it? depending on classes used can argumentoutofrangeexception an exception of type 'system.argumentoutofrangeexception' occurred in mscorlib.dll not handled in user code additional information: index out of range. must non-negative , less size of collection. what it? this exception means you're trying access collection item index, using invalid index. index invalid when it's lower collection's lower bound or greater or equal number of elements contains. when thrown given array declared as: byte[] array = new byte[4]; you can access array 0 3, values outside range cause indexoutofrangeexception thrown. remember when create , access array. array length in c#, usually, arrays 0-based. means first element has index 0 , last element has index length - 1 (where length total number of items in array) code doesn...

C# - Get the sum of the total amount of width for each column in datagridview -

is there faster way other looping through each column , increment variable width? for best solution, pretty slow: int contentwidth = 0; foreach (datagridviewcolumn column in grid.columns) { contentwidth += column.width; } this return length of visible columns: contentwidth = grid.columns.getcolumnswidth(datagridviewelementstates.displayed);

java - @PreUpdate doesn't save parent object when it's updated -

i have 2 entities relation 1 many. parent can have several child entity instances. added field parent stores date of children modifications( childrenlastmodifieddate ). maintain that, added method: @prepersist @preupdate @preremove private void handle() { parent.setchildrenlastmodifieddate(now()); } here problem. it's not invoke when child saved. locally(mac os), works expected, 3 types of changes tracked , saved parent entity. however, on server(linux) works for: @prepersist @preremove even though, preupdate invoked, changes not saved. have tried add direct repository call save parent. result same. nothing saved on update, saved on remove or persist. tried make change in additional transaction , worked, it's resource consuming. also, can see had similar experience: jpa/hibernate preupdate doesn't update parent object however, there nothing on how handle problem itself. question is: there way guarantee using of annotations work , perform additio...

html - When I resize window menu doesn't remain fixed -

i not able keep menu fix whenever resize window menu doesn't remain fix , keep moving down towards left. want text, pictures , menus remain fix can moved extent , after should scrollable other websites. sharing screenshot happen when scroll webpage: this how when maximised fine this when minimised text, menu buttons moves doesn't stay are. i sharing script this: .auto-style19 { color: highlight; font-size: 18pt; position: relative; width:672px; display: inline-block; float: right; margin-right: 10% auto; font-family: 'times new roman', times, serif; top: 49px; min-height: 196px; margin-top: 0px; left: -21px; height:auto; } .auto-style26 { position:relative; min-width: 80%; width:auto; top: 0px; left: 0px; min-hei...

python 2.7.13 fill tabs (from Notebook) with widgets -

i'm having trouble filling these tabs other widgets, here images of current state: sap2000 tab/the 1st one etabs tab/the 2nd one #imports import tkinter tk #to able use "button" tk.button import ttk tkinter import * ttk import * #the gui class mywindow(frame): def __init__(self,master=none): frame.__init__(self,master) #run parent's initiation self.initui() #construct ui def initui(self): #make rows , columns visible "minsize" row in range(5): self.grid_rowconfigure(row,minsize=25) col in range(5): self.grid_columnconfigure(col,minsize=10) #make parent window appears self.grid() #make 2 tabs: sap2000, etabs n=notebook(self.master) n.grid(row=0,column=1) #construct tab etabs fetabs = frame(n) tetabs= n.add(fetabs,text='etabs') impetabs=tk.button(tetabs,text="import etabs model",width...

docusign - Can the "Confirm Your Identity" modal, when using SBS, be translated? -

i went through whole "docusign - signing resource file v1.1" documentation trying find way change text messages of sbs eu advanced signature modal far, not find way it. sbs eu avanced signature modal using resource file, possible change texts of modal? regards.

inheritance - EF Core inherited properties not being reflected in migration script -

i trying migrate below models , inheritance not being reflected in migration script generated. missing? using pm handle migration script generation simple add-migration followed update-database in vs2017 targeting sql 2016. public class facility { [key] public int id { get; set; } public bool deleted { get; set; } public string name { get; set; } public string description { get; set; } public byte? image { get; set; } public list<locationfacility> locationfacilities { get; set; } } public class helipad : facility { public decimal size { get; set; } public decimal maximumweight {get; set;} } based on documentation of ef core , in order have type included in model convention, either need dbset property or navigation property pointing type or refer in onmodelcreating . there navigation property on facility class. perhaps inverse navigation pointing facility on type incl...

java - How to get locale of string on android? -

i want know locale of input text in edittext! tried keyboard locale wasn't helpful. don't want type english in edittext me! want user know he/she can't type english! sorry bad english! here code : edtusernamelogin.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged(charsequence charsequence, int i, int i1, int i2) { } @override public void ontextchanged(charsequence charsequence, int i, int i1, int i2) { } @override public void aftertextchanged(editable editable) { if (editable.tostring().isempty()) { mtfusernamelogin.setlabelcolor(g.resources.getcolor(r.color.cpb_white), "نام کاربری"); } else { string locale = g.inputmethodmanager.getcurrentinputmethodsubtype().getlocale(); if (locale.equals("fa") || locale.equals("ar")) { mtfusernamelogin.setla...

python - Captcha preprocessing and solving with Opencv and pytesseract -

problem i trying write code in python image preprocessing , recognition using tesseract-ocr. goal solve form of captcha reliably. original captcha , result of each preprocessing step steps of now greyscale , thresholding of image image enhancing pil convert tif , scale >300px feed tesseract-ocr (whitelisting uppercase alphabets) however, still rather incorrect reading (epq m q). other preprocessing steps can take improve accuracy? code , additional captcha of similar nature appended below. similar captchas want solve code import cv2 import pytesseract pil import image, imageenhance, imagefilter def binarize_image_using_opencv(captcha_path, binary_image_path='input-black-n-white.jpg'): im_gray = cv2.imread(captcha_path, cv2.imread_grayscale) (thresh, im_bw) = cv2.threshold(im_gray, 85, 255, cv2.thresh_binary) # although thresh used below, gonna pick suitable im_bw = cv2.threshold(im_gray, thresh, 255, cv2.thresh_binary)[1] cv2...

javascript - Save the cordova previous activity -

i developing cordova application,i having concerns application. actually want try import certificate gmail application , display on screen in table format step 1 emulate application using command "cordova emulate android". step 2: go gmail application,import attachment attachment open in application , displays certificate.when click home button application goes background state , when click recent applications state resumes.till here every thing fine step 3: after doing above steps , when start app once again application restarting,i have followed many questions in stack overflow,i post down solutions followed step 4: initialize: function () { document.addeventlistener('deviceready', this.ondeviceready.bind(this), false); }, ondeviceready: function () { //my backend code display certificate } solutions followed 1)changed launch mode singletop singleinstance , singletask in manifest.xml. problem: cant able detect path gmail attachment whe...

Algorithm for finding if sum of sub array elements can make a desired sum -

i trying implement algorithm tell if the desired sum can make out given array elements. i have came program def check_payment(arr, requested_money): arr.sort() arr.reverse() sum = 0 item in arr: sum += item if sum == requested_money: return true elif sum > requested_money: sum -= item return false i dont know getting wrong. test cases failing. can please provide me scenario fail. scenario - code fails run code array:- [10,16,25] - original array arr arr.sort() - [10,16,25] arr.reverse() - [25,16,10] now apply loop , search requested_money 26 hope helps you.

angularjs - dontnetcore error on creating a angular component -

Image
i following error when trying create angular module inside angular component directory project created using following yo 2 yo generator-aspnetcore-spa following error error locating module declaration silenterror: no module files found created file structure below. following workaround fixed issue rename app.client.module app.client.module .

jQuery validate: Using remote validation causes error styling to be removed -

Image
when using remote rule , validation passes rule, if other fields invalid, show error messages, have error styling removed. if remove remote rule, works correctly. also, if remote validation fails, works correctly. problem occurs first time validation run - after first time, works correctly. what looks (notice error messages there, not red): what should like: if remote validation fails, works correctly: javascript: $("#createuserform").validate({ rules: { username: { remote: "/users/usernameisfree" } }, messages: { username: { remote: "username taken" } } }); //bootstrap styling errors $.validator.setdefaults({ highlight: function (element) { $(element).closest('.form-group').addclass('has-error'); }, unhighlight: function (element) { $(element).closest('.form-group').removeclass('has-error'); }, ...

php - Merge 2 arrays: don't change indexes and add the 2nd values in order in the gaps -

i have 2 arrays. want not change indexes of first 1 , second one, added order in gaps of missing indexes: $a = array( 0 => 9, 2 => 13 ); $b = array( 1 => 10, 2 => 11, 3 => 12, 4 => 1 ); i want result: $ab = array( 0 => 9, 1 => 10, 2 => 13, 3 => 11, 4 => 12, 5 => 1 ); i tried this: $ab = $a+$b; // keeps indexes, removes key 2 array $ b $ab = array_merge($a, $b); // change indexes $ab = array_unique(array_merge($a,$b)); // change indexes $ab = array_merge($a, array_diff($b, $a)); // change indexes loop through $b , copying elements $a . if index exists, increment adjustment new index. function mergearrays($a, $b) { $adjust = 0; foreach ($b $i => $val) { while (isset($a[$i + $adjust])) { $adjust++; } $a[$i + $adjust] = $val; } ksort($a); // put in order new indexes return $a;...

Select element of collection by highest value of specific attribute -

Image
i have several documents stored in database following format: { "text": "foo", "items": [{ "num": 1, "value": 1.1 }, { "num": 42, "value": 3.14 }] } { "text": "bar", "items": [{ "num": 3, "value": 5.0 }] } i want retrieve each document "text" , "value" of item highest "num". in example result be: { "text": "foo", "value": 3.14 } { "text": "bar", "value": 5.0 } is there way solve problem orientdb? i tried these records and used query select rid,items.num num,items.value value ( select @rid,items,$a[0].max max test let $a=(select max(items.num) max $parent.$current) unwind items ) items.num=max i got best regards, alessandro

javascript - Accessing td's within a tr in CSS -

so have function needs handle <tr></tr> , 3rd <td> tag in it how access 3rd <td> tag inside this trinput = following <tr> <td>sup</td> <td>9</td> <td>5</td> </tr> how access 3rd td trinput.(whatgoes here access 3rd td) if third mean last one, there lastelementchild property fits need const tr = document.getelementsbytagname('tr')[0] console.log(tr.lastelementchild) // content accessed with: console.log(tr.lastelementchild.innertext) <table> <tr> <td>sup</td> <td>9</td> <td>5</td> </tr> </table>

c# - Make an Http request through a Lambda Func -

i'm trying make httpclient requests through helper function manage circuitbreaker polly policy. i'm trying call var response = clientfactory.makerequest(() => client.getasync("/")); inside of client factory have circuit breaker policy defined , i'm trying execute lambda above using policy so public async task<httpresponsemessage> makerequest(func<httpresponsemessage> request) { var response = policy.executeasync(() => request.invoke()); return response; } i'm new lambda's whole , passing function gets more confusing. how configure function , first line of code execute client , return httpresponsemessage? don't think task<httpresponsemessage> or func<httpresponsemessage> correct i suggest, read information on async/await (not lambdas) key understanding how achieve it. https://docs.microsoft.com/en-us/dotnet/csharp/async you using asynchronous programming must decide, whether want hav...

Delphi: How to assign dynamically an event handler without overwriting the existing event handler? -

i need loop through components , assign event handler (for example dynamically assigning onclick event tbutton to showmessage('you clicked on ' + (sender tbutton).name); the problem in cases assigned tbutton onclick event. is there way solve problem? let's imagine have button1 harcoded onclick event handler is: showmessage('this button1'); after "parsing" full event handler button1 becomes: showmessage('this button1'); // design time event handler code showmessage('you clicked on ' + (sender tbutton).name); // runtime added note: looking soliution allows me use tbutton without inheriting it. you assignment of onclick before overwriting it, persist , use in new handler - chaining events. something this: var original : tnotifyevent; original := component.onclick; component.onclick := newmethod; and in newmethod: if assigned(original) original(sender); you'll not want single original variable...

elm - Converting A Maybe Value Into A Normal Value -

i have no clue how convert maybe value normal value ... i have these lines... pickchord : model -> note -> chord pickchord model note = let nextchord = list.head (list.filter (testchord note) model.possiblemajorchords) in nextchord the compiler complains: the definition of pickchord not match type annotation. - type annotation pickchord says returns: chord but returned value (shown above) a: maybe chord how handle problem? thanks. this why love elm. in it's own way, elm telling you've got design flaw. let's take closer look. here's code as-is: pickchord : model -> note -> chord pickchord model note = let nextchord = list.head (list.filter (testchord note) model.possiblemajorchords) in nextchord so you've got list of major chords filter specific note. produces list of chords. however, list type can represent empty list, why list.head returns maybe . i...

AngularJS : Use of ng-if and ng-class combination -

i have table : <tr> <th scope="row">quantitÉ produite</th> <td>{{hoursvalues[0][0][0]}}</td> <td>{{hoursvalues[0][0][1]}}</td> <td>{{hoursvalues[0][0][2]}}</td> <td>{{hoursvalues[0][0][3]}}</td> <td>{{hoursvalues[0][0][4]}}</td> <td>{{hoursvalues[0][0][5]}}</td> <td>{{hoursvalues[0][0][6]}}</td> <td>{{hoursvalues[0][0][7]}}</td> </tr> <tr> <th scope="row">objectif quantitÉ</th> <td>{{hoursvalues[0][2][0]}}</td> <td>{{hoursvalues[0][2][1]}}</td> <td>{{hoursvalues[0][2][2]}}</td> <td>{{hoursvalues[0][2][3]}}</td> <td>{{hoursvalues[0][2][4]}}</td> <td>{{hoursvalues[0][2][5]}}</td> <td>{{hoursvalues[0][2][6...