Sort strings of ints and save original index

I would like to sort lists of the following form: [‘1000-1005’, ‘6767-8787′, ’88-5607’, ‘600-607’, ‘909-950′] by the integer value before the ‘-‘ symbol and also store the original index after sorting, so something like this: [(2, ’88-5607’), (3, ‘600-607’), (4, ‘909-950’), (0, ‘1000-1005’), (1, ‘6767-8787’)] Where the tuples in the output list contain the original… Read More Sort strings of ints and save original index

Make columns within a list in HTML/CSS

I have an unordered list in which I am displaying some objects. These objects have multiple attributes which I want to display. I made this in Python Flask and jinja. <li class="list-group-item"> <a href="link">{{candidate.name}}</a> <label id="min">Min. value:<input type="number" id="min" name="min-val" min="1" max="100"></label> <label id="max">Max. value:<input type="number" id="max" name="max-val" min="1" max="100"></label> <p id="average_rank">{{‘%0.2f’ % average_rank|float}}</p> <p… Read More Make columns within a list in HTML/CSS

Why is my linked list size function not working as intended?

I used the following code to define my linked list, nodes and a few functions. class node: def __init__(self,node_data): self.__data=node_data self.__next=None def get_data(self): return self.__data def set_data(self,node_data): self.__data=node_data data=property(get_data,set_data) def get_next(self): return self.__next def set_next(self,node_next): self.__next=node_next next=property(get_next,set_next) def __str__(self): return str(self.__data) class unordered_list: def __init__(self): self.head=None def is_empty(self): return self.head==None def add(self,item): temp=node(item) temp.set_next=(self.head) self.head=temp… Read More Why is my linked list size function not working as intended?

erasing nlohmann::json object during iteration causes segmentation fault

I have a simple database consisting of objects with strings containing unix time as keys and strings containing instructions as values I want to iterate though the database and erase any object who’s key is smaller that current time ( so erase objects with dates before current date) for (auto it = m_jsonData.begin(); it !=… Read More erasing nlohmann::json object during iteration causes segmentation fault