Issue I am trying to make a date_list that is a range of the months in the last year. It should be formatted [‘Oct 2014’, ‘Nov 2014’, ‘Dec 2014’, ‘Jan 2015’, ‘Feb 2015’,… ‘Sep 2015’] Sometimes it works, and sometimes
Continue readingTag: list
when I run this code below, it doesn’t give me True or False
Issue it doesn’t give an output and I Know that the output should be True or False some = [1, 9, 21, 3] 9 in some Solution As others have pointed out, you need to do something with the result.
Continue readingMany-to-many relationships with objects, where intermediate fields exist?
Issue I’m trying to build a model of the servers and applications at my workplace. A server can host many applications. An application can be hosted across many servers. Normally I would just have the host class contain a List,
Continue readingModelMapper – Failed to convert ArrayList to List
Issue I have the following Beans public class Ticket extends BaseEntity { private ForeignCollection< TicketDetail > ticketDetails; } public class TicketDto extends BaseDto { private List< TicketDetailDto > ticketDetails; } And I’m mapping, using ModelMapper, a List<TicketDto> to a List<Ticket>
Continue readingUnity: How to not add references into List with GetComponent()?
Issue I have a list of components and I want to give it some values like so. public LoadButtonData loadButtonData; GameObject clone = Instantiate(buttonPrefab, transform); LoadButtonProperties properties = clone.GetComponent<LoadButtonProperties>(); properties.filePath = filePath; properties.Date.text = time.ToShortDateString(); properties.Name.text = fileName; properties.Place.text =
Continue readingHow does ArrayList.clone() method work in Java?
Issue I’m confused about the concept of cloning in Array lists. E.g : Balloon green = new Balloon(“Green”,new Address(“greenState”, “greencity”)); Balloon green2 = (Balloon)green.clone(); green.setColor(“NewGreen”); System.out.println(green); System.out.println(green2);//color not affected in copy as color is of String type. //Immutable objects are
Continue readingElements of list change despite cloning in Python
Issue In the following Python code, I created a list a which contains a number of lists, and then created a copy of it, b, but unlike with lists that do not contain other lists, when b is changed, a
Continue readingHow to create an application settings parameter of type a list of structs?
Issue In my project I have a custom struct: struct Point { public uint xPoint { get; } public uint yPoint { get; } public Point(uint x, uint y) { xPoint = x; yPoint = y; } } I’m using
Continue readingPassing and Using Dictionaries in Django Template Tags
Issue I have a function that uses the psutil library to fetch CPU usage data. import psutil from django.utils.safestring import mark_safe def get_cpu(): """Gets the system-wide CPU utilisation percentage""" utilisation = list(psutil.cpu_percent(interval=1, percpu=True)) cpu_data_utilisation = [] load_avg_list = [] cpu_data
Continue readingHow to 'update' or 'overwrite' a python list
Issue aList = [123, ‘xyz’, ‘zara’, ‘abc’] aList.append(2014) print aList which produces o/p [123, ‘xyz’, ‘zara’, ‘abc’, 2014] What should be done to overwrite/update this list. I want the o/p to be [2014, ‘xyz’, ‘zara’, ‘abc’] Solution You may try
Continue readingHow to override the slice functionality of list in its derived class
Issue I make a class like below: class MyList(list): def __init__(self, lst): self.list = lst I want slice functionality to be overridden in MyList Solution You need to provide custom __getitem__(), __setitem__ and __delitem__ hooks. These are passed a slice
Continue readingAdd text in the trsx Element Node via a dictionary containing list of Strings
Issue I have a JSON file from which I want to pick :Description and put in the dictionary Description_List. JSON data : "UserIntents":[{ "IntentName": "TEAM_WELLNESS", "ModuleName": "Social", "Description": "How is the Alchemy team doing?" }, { "IntentName": "TEAM_MEMBERS", "ModuleName": "Social",
Continue readingTraversing two sequences in Freemarker
Issue I am new to FreeMarker and I am working on a project which uses it. The scenario is, I have two lists in FreeMarker which I am getting from the backend(say firstNames & lastNames. Now what I want to
Continue readingInconsistent results while formatting a list with Ansible
Issue I’m using Ansible to build inventories dynamically according to several parameters. I get raw info from our CMDB’s API, then use set_fact to format a list of FQDNs. Those FQDNs always follow the same formula, so it looks easy,
Continue readingHow to read and rewrite a singleton object from a file?
Issue public class Storage implements Serializable{ /** * */ private static final long serialVersionUID = 1L; public static List<Message> MessageList = Collections.synchronizedList(new ArrayList<Message>()); //Fail safe if multiple threads modify them. public static List<Group> GroupList = Collections.synchronizedList(new ArrayList<Group>()); protected Storage() {
Continue readingHow to convert Elo rating to 5 star rating system?
Issue We have a Elo rating system (such as, as following) for the players in a video game and want to convert it to 5 star rating ranging from [3.00, 5.00]. The conversion should maintain the following four constraints. That
Continue readingHow to fetch and display just the count of grep matches against each file that has the matching string?
Issue cat Samplescript for OUTPUT in $(grep -lR "Sample sv15 Processor" ./*) #List files with matching string do grep "Sample sv15 Processor" $OUTPUT | wc -l done My approach is to list files with matching strings Then run a grep
Continue readingChange the shape of list with multiple arrays python
Issue Initially, I had a dictionary named voltage with 206 arrays each of the shape (25,3,1). I have converted the dictionary into a list of arrays using the following code temp = [] input= [] for value, key in voltage.items():
Continue readingAccess multiple elements of list knowing their index
Issue I need to choose some elements from the given list, knowing their index. Let say I would like to create a new list, which contains element with index 1, 2, 5, from given list [-2, 1, 5, 3, 8,
Continue readingHow to get the index of an item inside a list on flutter
Issue Im trying to get the index of and item inside a list which is inside a Column() in flutter, how do I do that? I’ve tried making a var called index and set it to 0 and have it
Continue readingPython: How to split a list based on a specific element
Issue If we have the following list in Python sentence = [“I”, “am”, “good”, “.”, “I”, “like”, “you”, “.”, “we”, “are”, “not”, “friends”, “.”] How do I split this to get a list which contains elements that finish with the
Continue readingGet the value of a specific record in dicts with lists in python
Issue I have a dict like this: contactos = dict([ "id", id, "nombres", nombres, "apellidos", apellidos, "telefonos", telefonos, "correos", correos ]) And it works when I put a new register in every key:value, my problem is, how can I get
Continue readingHow do I get the last element of a list?
Issue How do I get the last element of a list? Solution some_list[-1] is the shortest and most Pythonic. In fact, you can do much more with this syntax. The some_list[-n] syntax gets the nth-to-last element. So some_list[-1] gets the
Continue readingHow to select values within a provided index range from a List using LINQ
Issue I am a LINQ newbie trying to use it to acheive the following: I have a list of ints:- List<int> intList = new List<int>(new int[]{1,2,3,3,2,1}); Now, I want to compare the sum of the first three elements [index range
Continue readingHow do I check against the first 7 elements of the list in order to print some text?
Issue From an array, I am trying to use an if statement with 3 conditions – if the chosen word from the ‘wordlist’ list has not yet been guessed correctly and over 7 attempts have been made, I wish to
Continue readingHow to remove a range in list depending on a condition in dart?
Issue I made a list to separate to different lists of integers for a flutter project. Now I want to remove all integers after the last null value. How can I do that ? void main() { List<int> v =[];
Continue readingHow to write function that take a list and number X .If X exist in list in index ‘m’, it should return sum of elements of list from index ‘m’
Issue def func(x): lst=list(map(int,input("Enter a list of numbers: ").split())) flag=0 num=0 for i in lst: if x==i: flag=1 if flag==1: ab=lst.index(x) for i in range(ab,len(lst),1): num=lst.index(ab) num=num+lst[i] print(num) return num y=input("Enter a number present in the list: ") print(func(y)) Above
Continue readingImporting a tuple to a list from a function
Issue I’m trying to modify pixels using range in a loop but I can’t import the range from size function. load = bnw.load() loadpx = [ (a), (b) ] bnw.size(loadpx) print(loadpx) for x in a: for y in b: new
Continue readingWhy can't a range object be used to index a list?
Issue In Python 3.9, it is not possible to use a range object to index a list. Indeed running the following code, the second print will return an error stating "TypeError: list indices must be integers or slices, not range".
Continue readingpython range() with duplicates?
Issue Everybody knows that a list of numbers can be obtained with range like this;: >>> list(range(5)) [0, 1, 2, 3, 4] If you want, say, 3 copies of each number you could use: >>> list(range(5)) * 3 [0, 1,
Continue readingPython- To fill values with NaN if they are in a specific range of values
Issue I am working on a requirement where I have to fill specific values as NaN if they fall in a particular range of no’s. Below is my code- import pandas as pd data = {‘A’: [1, 2,3,4,5], ‘B’: [3,
Continue readingcreate several lists with position
Issue I have this super simple code to generate a list in python. I want to make several lists like this 0: [0, 2] 1: [2, 4] 2: [4, 6] it is possible . thanks n = range(0,169,2) num_list=list(n) print
Continue readingExtract list from range Google Sheets
Issue I have some data from workplaces with some different work areas, I need to extract a list for each workplace with their corresponding availables working areas, I have an example of some kind of attempt really close what I
Continue readingGenerating an ascending list of numbers of arbitrary length in python
Issue Is there a function I can call that returns a list of ascending numbers? I.e., function(10) would return [0,1,2,3,4,5,6,7,8,9]? Solution You want range(). Answered By – Ignacio Vazquez-Abrams Answer Checked By – Terry (AngularFixing Volunteer)
Continue readingIdentify groups of continuous numbers in a list
Issue I’d like to identify groups of continuous numbers in a list, so that: myfunc([2, 3, 4, 5, 12, 13, 14, 15, 16, 17, 20]) Returns: [(2,5), (12,17), 20] And was wondering what the best way to do this was
Continue readingProcess a list with a loop, taking 100 elements each time and automatically less than 100 at the end of the list
Issue Is there a way to use a loop that takes the first 100 items in a big list, does something with them, then the next 100 etc but when it is nearing the end it automatically shortens the “100”
Continue readingPython: Replace element in list inside list of list, with value from another list in same
Issue I have a list of lists in python in which I want to replace the first value of some lists with the first value of the list preceding it, but only for certain lists. for i, x in enumerate(protected_rows):
Continue readinghow to remove and replace an element in a list using python
Issue def functionA(): countries = ["Nigeria", "Uganda", "America", "Chad"] print(countries) name1 = input("choose a country you don’t like:") for i in range(3): if countries[i] == name1: print(f"The selected country is {name1}") countries.pop(i) name2 = input("choose a country you want like:")
Continue readingAdd elements in a list at the n index of a other list
Issue calibres_prix =[‘115-135’, ‘1.87’], [‘136-165’, ‘1.97’], [‘150-180’, ‘1.97’], [‘190-220’, ‘1.97’], [’80-95′, ‘1.42’], [’95-115′, ‘1.52’], [‘150-180’, ‘1.82’], [‘115-135’, ‘1.72’], [‘136-165’, ‘1.82’], [‘150-180’, ‘1.82’], [‘190-220’, ‘1.82’], [’80-95′, ‘1.42’], [’95-115′, ‘1.72’], [‘115-135’, ‘1.92’], [‘136-165’, ‘2.02’], [‘150-180’, ‘2.02’], [‘190-220’, ‘2.02’], [’80-95′, ‘1.27’], [’95-115′, ‘1.57’],
Continue readingIterating through integers not found in a list of ranges in Python
Issue So, I have a function which outputs a list of ranges, e.g. [range(1,5),range(8,13)]. I need to iterate through those integers which are not in a range in this list. For example, using the previous list I would like to
Continue readingHow do I set limits for my range function in python?
Issue Say I am iterating through a list. I want to check if the list’s neighbours (i-1 and i+1) contain a certain element. How do I do this without running into "list index out of range" problem? Example: list =
Continue readingList index out of range Error in python ,but index is in range how is it?
Issue def longestValidParentheses(si): cnt=0 s=[] for _ in range(0,len(si)): s.append(si[_]) print(s[6]) for i in range(0,len(s)-1): print(i) if (s[i]=="("): for j in range(0,len(s)): if (s[j]==")"): cnt+=2 s.pop(j) break print(cnt) return cnt longestValidParentheses(")(())()") This my code to find how many correctly formed
Continue readingCreate a list with string + range
Issue I need your help: I want to create a list looking like this [‘Unnamed: 16’, ‘Unnamed: 17’, ‘Unnamed:18′] for a range (16,60). How can I proceed? I don’t know if my question is clear but it’s like doing list(range(16,
Continue readingI'm trying to add elements into my list using the range function but it doesn't seem to work
Issue numberinput = [] for x in range(1, 11): arrayinput = input("Type the number you want to add to the array") numberinput[x] = arrayinput print(numberinput) I’ve created an empty list and what im trying to is, im trying to increment
Continue readingDart: create a list from 0 to N
Issue How can I create easily a range of consecutive integers in dart? For example: // throws a syntax error 🙂 var list = [1..10]; Solution You can use the List.generate constructor : var list = new List<int>.generate(10, (i) =>
Continue readingHow to use the foreign key in condition html Django
Issue I’m a beginner in Python and I have this question. Anyone know why this condition dont work? In the h4 the lancamento.tipo shows the information "Receita", but the condition does not work. Please help me on this. lancamento_list.html <div
Continue readingList item not adjusting itself to bottom of menu
Issue I have created a menu of nested list. The problem is, when I add a second nested list, the last li element among the first group of list elements doesn’t adjust it’s height from the top of the page
Continue readingHow to use list-style-type decimal but without the dots
Issue Hi, list-style-type decimal shows lists like this: 1. apple 2. pear 3. whatever but I dont need the dot so it looks like this: 1 apple 2 pear 3 whatever is it possible? Thank you. Solution Use CSS Counters
Continue readingPosition a dynamically sized div at the bottom of another dynamically sized div
Issue I’m trying to create a UL that will have LI items added to it dynamically. The goal is for the list to have zero height when empty, then expand up to a certain height as items are added to
Continue readingReact Native : elements of the list stuck together?
Issue I have an issue: the elements of my list are not spread appart and I don’t understand why. I have 3 elements for each letter and they should be separated. I think it may have something to do with
Continue readingReturn element in div until classname changes bs4
Issue I am trying to use Beautiful Soup to print the elements of a div. It is a bit hard to explain, so I have simplified it. Let me know if you need more clarification 🙂 The div is structured
Continue readingAngular – Filter list object to other list
Issue I have a custom item: export class PartsChildInfo { name: string; materialName: string; thickNess: number; } export class PartGroupInfo { materialName: string; thickNess: number; } For example, I have a list item PartsChildInfo: list : PartsChildInfo = [ {
Continue readinghow to add new <li> to <ul> onclick with javascript
Issue How do I add a list element to an existing ul using a function from an onclick? I need it to add to this type of list … <ul id=”list”> <li id=”element1″>One</li> <li id=”element2″>Two</li> <li id=”element3″>Three</li> </ul> … another
Continue readingHow do I remove a common character from each element in my list?
Issue I’m cleaning up my data after web scraping and the list has \n before each element. SP500 = [‘\nAAPL’, ‘\nMSFT’, ‘\nGOOG’, ‘\nGOOGL’, ‘\nAMZN’, ‘\nTSLA’…] How should I go about removing the \n from each element? Solution You could do
Continue readingAppending <li> item to <ul> with TS
Issue I have been trying to append "Avocado" to this list but then I get the error message Uncaught TypeError: Cannot read properties of null (reading ‘appendChild’) <!DOCTYPE html > <html lang=”de”> <head > <title >Am I Loaded ?! </title
Continue readingStyle bullet-list with arrows
Issue I have created an arrow that I would like to attach to a list instead of the round bullet points. I have tried to use the :after but haven’t succeeded yet, have to confess that I’m very new to
Continue readingAngularJS how to use btn-group or radio group in list
Issue I have a ng-repeat list, and I want use btn-group or radio group in every row, like this: <script src=”https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js”></script> <tr ng-repeat=”v_review_record in v_review_records_list track by $index”> <td>{{ $index + 1 }}</td> <td><span>{{v_review_record.Name}}</span></td> <td align=”center”> <div class=”btn-group”> <label class=”btn
Continue readingHow to make a List a hyperlink?
Issue I’m working on a link list and I can’t get the List to be a hyperlink <ul> <a href="pdf/VPN.pdf" target="_blank"></a> <li>VPN</li> </a> </ul> Solution Try: <ul> <li><a href="pdf/VPN.pdf" target="_blank">VPN</a></li> </ul> In your original markup you had the link outside
Continue readingHow to make a List a hyperlink?
Issue I’m working on a link list and I can’t get the List to be a hyperlink <ul> <a href="pdf/VPN.pdf" target="_blank"></a> <li>VPN</li> </a> </ul> Solution Try: <ul> <li><a href="pdf/VPN.pdf" target="_blank">VPN</a></li> </ul> In your original markup you had the link outside
Continue readingfilter HTML list with JS
Issue I am not very familiar with HTML and JavaScript, so my learning is based on reverse engineering code. The code I’m using filters a table based on a keyword modified I can also add this code to a button
Continue readingAngular typescript update class if element is in array
Issue I am doing an APP in Angular 12. In my component.ts I have an string array[] like AccessRoles["AA","BB"] And on the other side I have a class like this export class UserRole { Id :string; Active:boolean; } My class
Continue readingaligning list-style-image proportionally with text
Issue So I have <ul> <li>Hello</li> </ul> and li { list-style-image: url(../img/bullet.png); /* 13×13 px */ /* line-height: 13px; */ /* vertical-align: middle; */ padding-left: 5px; } which looks like as you can see text and image element of <li>
Continue readingdjango templates disappearing on refresh
Issue I have constructed a news aggregator website which shows 10 headlines with corresponding images, scraped from https://thestar.com ( The Toronto Star ) , using bs4. Here’s a photo for reference: However, the major problem is, Everytime i refresh the
Continue readingCSS list marker not inline with text
Issue I played around with ::marker which is supported by all major browsers. When changing the font size I noticed that the marker / bullet is not inline with the text. With inline I mean that the top of the
Continue readingCSS list marker not inline with text
Issue I played around with ::marker which is supported by all major browsers. When changing the font size I noticed that the marker / bullet is not inline with the text. With inline I mean that the top of the
Continue readingHow to remove bullets from Unordered list nested in Div's?
Issue I don’t see why my code isn’t working. I want to remove the bullets on my ul anchors. but “ul {list-style: none;} isn’t working. Here’s my code: <div class=”nav-wrapper”> <div class=”logo”> <!– <a href=”/”>Logo</a> –> </div> <div class=”main-page-links”> <ul>
Continue readingPseudo after align right
Issue I’m trying to use the CSS3 pseudo :after on li elements. The issue is that the content of :after is immediately following the li content – as if :after uses text-align:left; But since my li elements use display:block; shouldn’t
Continue readingImplement a list with a static method in JavaScript (TypeScript flavour)
Issue This is the same as implement a list with a static method javascript but with the TypeScript flavour export class List { length: number; constructor(){ this.length = 0; } public static create(…values: number[]): List { let list = new
Continue readingReusable list of custom components in Angular
Issue I want to create reusable SortedList Component in Angular5. The list should accept any array of listItems (objects) as attribute. From ListContainer component I want to use the list and pass a list item template as follows: <div class=’list-container’>
Continue readingUpdate a obj list in js with a form and show it in HTML page
Issue I have a HTML page with a form and a table. In a js file I have a list of objects (JSON) and with this list I populate the table when the page loads. The form should allow me
Continue readingSelenium element is not attached to the page document
Issue I am trying to scrape this particular site with Python: https://www.milanofinanza.it/quotazioni/ricerca/listino-completo-2ae?refresh_cens. I need to get all the isin codes and the names. My idea was to get them all in 2 separated lists, to do that I try to
Continue readingHow to create multiple columns for numbered lists in WordPress? CSS
Issue What’s the best way to display multiple columns for a long numbered (ul) list in WordPress using CSS? Many answers exist for creating columns for unordered ul lists but I can’t seem to find anything that addresses multi-column displays
Continue readingHorizontal Ordered List (and IE)
Issue I’m looking to generate an output similar to this: 1. One 2. Two 3. Three 4. Four from the following HTML Code <ol> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> </ol> It seems that Internet Explorer does not want to display the
Continue readingMaking inline/horizontal list — issues with second last child
Issue [I have seen many questions of a similar kind but those solutions don’t work here] I am making an inline list which should appear like this (depending on number of items): First example: Apples. Second example: Apples and Oranges.
Continue readingHow to append data from modal inputs to list on button click in Angular?
Issue so basically I have a create-employee component that is a modal with input fields and an add button. Then there is the employee-details component in which I have a basic table where i want to add the entry from
Continue readinghow to display different lists by a dynamic tab system?
Issue I have an array of objects with the following structure: [{ “name”: “Equipment”, “functional_id”: “furniture”, “products”: [ { “file”: “data:image/;base64,”, “name”: “White bags”, “description”: “Reusable”, “id”: 11, “path”: “”, “items”: [ { “name”: “Small model”, “description”: “25”, “price”: 0,
Continue readingIMPORTING A SERIES OF WEBELEMENTS IN AN ARRAY PYTHON(SELENIUM)
Issue I’m trying to import all the tickers(security symbols) in a single array from the following site: https://indexes.nasdaqomx.com/Index/Weighting/NQUSS I have found 2 main problems: I had to switch page every time so that I cannot import all the values in
Continue readingInput List Selection Changed Event
Issue I have this example: <datalist id=”browsers”> <option value=”Internet Explorer”> <option value=”Firefox”> <option value=”Google Chrome”> <option value=”Opera”> <option value=”Safari”> </datalist> I need to catch an event, when the user selects option (with mouse or keyboard). I tried to do onchange=”MySuperFunction();”,
Continue readingHow to make the event listener only add CSS element on one item at a time (vanilla JavaScript)
Issue ^I would like to be able for the style to be enabled for only one at a time. ^I’m able to do this, which I don’t want the user to be able to do. So it’s weirdly hard framing
Continue reading