How to access html element text in chrome devtools console

Uncategorized
Question: I have a page with a whole bunch of blackquote tags. In dev console I am typing document.getElementsByTagName("blockquote") that giving me an array. But if I do document.getElementsByTagName("blockquote").innerText document.getElementsByTagName("blockquote").innerHTML document.getElementsByTagName("blockquote").textContent document.getElementsByTagName("blockquote").outerText document.getElementsByTagName("blockquote").outerHTML All return undefined However if I inspect elements of the array document.getElementsByTagName("blockquote") I can see all above properties in place. How to access at least one of them (innerText, outerHTLM, innerText, outerHTML, textContent) ? Answer: Or if you want to access any specific element you can use index in array for (var i=0; i
Read More

Pandas read_csv do not interprete quotechar

python
Question: Using the following CSV file:"aa"!#"2811"!#"Location"!#"11"!#"67000"!#"ZZ" "bb"!#2812!#"Location"!#"22"!#"67540"!#"XX" "cc"!#"2813"!#Location!#"33"!#"67117"!#"YY" "dd"!#"2452"!#"location"!#"44"!#"67000"!#"ZZ" And using the following python code :import pandas import csv pandas.read_csv("test.csv", sep="!#", header=None, quotechar='"') Give the following result:0 0 1 2 3 4 5 0 "aa" "2811" "Location" "11" "67000" "ZZ" 1 "bb" 2812 "Location" "22" "67540" "XX" 2 "cc" "2813" Location "33" "67117" "YY" 3 "dd" "2452" "location" "44" "67000" "ZZ" However, as I specified quotechar='"', the result should be 0 1 2 3 4 5 0 aa 2811 Location 11 67000 ZZ 1 bb 2812 Location 22 67540 XX 2 cc 2813 Location 33 67117 YY 3 dd 2452 location 44 67000 ZZ Am I missing anything ? Edit: Replacing all !# by , makes it work, so apparently, quotechar isn't interpreted as sep is more than 1 char.…
Read More

A programming language with garbage collection AND manual memory management

Uncategorized
Question: Are there any programming languages out there that use garbage collection, but that also allow for manual memory management? So for example, providing a destructor function. Is it even possible for a programming language to have garbage collection and manual memory management concurrently? Related SO question here, but no answer: Interpreted languages with manual memory management? Thanks Answer: Read more
Read More

JavaScript: find pairs from an object (not array) – collision detection

Uncategorized
Question: I am building a game using Javascript and I need to do collision detection. Everything drawn in the game has its own ID and stored in an object. I chose to use an object despite an array as a container because it is easy to delete children from it. When for example, a bullet hits a ship, it is removed from the object. But for an array, all of the children have to be shifted when one object is deleted. And it is nice to have IDs to keep track of everything. In order to find pairs in an array, I can do this:var a = []; //Object container for(var i = 0; i < a.lenght; i++){ for(var j = i+1; j < a.lenght; j++){ var object1 = a[i];…
Read More

Builder pattern with inheritance support generics issue

Uncategorized
Question: I implemented pattern based on this answer I have the following asbtract config:public abstract class AbstractConfig { public static abstract class Builder { private int calories = 0; public Builder() { } public B setCalories(int calories) { this.calories = calories; return (B) this; } public abstract AbstractConfig build(); } private int calories = 0; protected AbstractConfig(final Builder builder) { calories = builder.calories; } } And I have the following concrete config:public class DialogConfig extends AbstractConfig { public static class DialogConfigBuilder extends Builder { private double width; private double height; public DialogConfigBuilder() { //does nothing. } public B setWidth(final double value) { width = value; return (B) this; } public B setHeight(final double value) { height = value; return (B) this; } public DialogConfig build() { return new DialogConfig(this); }…
Read More

Charity – The Charity Plus HTML Template

Uncategorized
Charity – The Charity Plus Html Template have elegant and modern design style. Template is designed gracefully for non profit Organization. Template follow all Charity Organization guidelines to meet all requirement and provide the features. Template helps Organization to get Crowd Funding. Html Template will help you to build an awesome site Charity, get get Donation, Fundraising easily on website. Charity – Non profit Organization Html Template consist of 23 pages elegant but attractive designs. Because of free Icons and Fonts used in this template, Any Designer can make changes into template easily. Template is easy to convert into any type of website like : WordPress, Joomla, static html, Custom Framework. Html files are fully layered and simply customization, all elements are in group and can easily identify by the…
Read More

Adding ChromeOptions for Selnium Webdriver C#

Uncategorized
Question: From what I understand, the default action of when the Webdriver finds an element is to scroll such that the element is as far up the top of the page as possible. This is an issue because the website I'm working on has a header so every time I try to click on a button, it will instead click on the header. Thus, I want to change the scroll setting so that the element will be at the bottom of the page. From reading this I was able to find what I wanted to set, however, I'm unable to set the DesiredCapabilites or ChromeOptions when I initialise the ChromeDriver. Could some provide code/steps to do this please? Answer: You can use something like this var chromeOptions = new ChromeOptions();…
Read More

Why is the result of the code same? The code is using only the value of the last function for all the looping

Uncategorized
Question: All value in variable (filename, destinationFolder) is different for all loop except the "let uploadDidFinish: (()-> Void)". From what I learnt, it is supposed to be different as it is declared in a different instance. I put the following code in view controller viewdidload() let uploadDidFinish: ()-> Void = { print("nunzip (self.foldername+".zip")n") self.c.unzipFile(foldername: self.mfoldername+"/"+self.foldername,filename: self.foldername+".zip") } DownloadManager.shared.downloadFile("https://ping.passivealtitude.com/magazinefile/"+foldername+"/"+foldername+".zip", to: mfoldername+"/"+foldername, filename: foldername+".zip", upload: uploadDidFinish) After I loop 4 times, the result of code above is downloaded to file:///Users/vivian/Library/Developer/CoreSimulator/Devices/3FF96128-FC8F-4D44-9B4D-DC1989EFF9FF/data/Containers/Data/Application/15B32C21-6117-4CD9-A70E-7C0BFC0DFA6A/Documents/Magazine/book1/book1.zip downloaded to file:///Users/vivian/Library/Developer/CoreSimulator/Devices/3FF96128-FC8F-4D44-9B4D-DC1989EFF9FF/data/Containers/Data/Application/15B32C21-6117-4CD9-A70E-7C0BFC0DFA6A/Documents/Magazine/book2/book2.zip downloaded to file:///Users/vivian/Library/Developer/CoreSimulator/Devices/3FF96128-FC8F-4D44-9B4D-DC1989EFF9FF/data/Containers/Data/Application/15B32C21-6117-4CD9-A70E-7C0BFC0DFA6A/Documents/Magazine/book3/book3.zip downloaded to file:///Users/vivian/Library/Developer/CoreSimulator/Devices/3FF96128-FC8F-4D44-9B4D-DC1989EFF9FF/data/Containers/Data/Application/15B32C21-6117-4CD9-A70E-7C0BFC0DFA6A/Documents/Magazine/book4/book4.zip unzip book4.zip unzip book4.zip unzip book4.zip unzip book4.zip when it supposed to be unzip book1.zip unzip book2.zip unzip book3.zip unzip book4.zip First the function is passed to class DownloadManager: NSObject { ... @discardableResult func downloadFile(_ url: String, to foldername: String, filename:String, upload: @escaping…
Read More