Deleting multiple elements from a list

Question: Is it possible to delete multiple elements from a list at the same time? If I want to delete elements at index 0 and 2, and try something like del somelist[0], followed by del somelist[2], the second statement will actually delete somelist[3].
I suppose I could always delete the higher numbered elements first but I'm hoping there is a better way.
Comment: Use multiple slices if you care about efficiency.
Answer: For some reason I don't like any of the answers here.
Yes, they work, but strictly speaking most of them aren't deleting elements in a list, are they? (But making a copy and then replacing the original one with the edited copy).
Why not just delete the higher index first?
Is there a reason for this?
I would just do:
for i in sorted(indices, reverse=True):
    del somelist[i]

If you really don't want to delete items backwards, then I guess you should just deincrement the indices values which are greater than the last deleted index (can't really use the same index since you're having a different list) or use a copy of the list (which wouldn't be 'deleting' but replacing the original with an edited copy).
Am I missing something here, any reason to NOT delete in the reverse order?
Comment: There are two reasons. (a) For a list, the time complexity would be higher than the "make a copy" method (using a set of indices) on average (assuming random indices) because some elements need to be shifted forward multiple times. (b) At least for me, it's difficult to read, because there is a sort function that doesn't correspond to any actual program logic, and exists solely for technical reasons. Even though by now I already understand the logic thoroughly, I still _feel_ it would be difficult to read.
Comment: @ImperishableNightcould you elaborate (a) ? I don't understand the "some elements need to be shifted". For (b) you could just define a function if you need reading clarity.
Comment: @tglaria That is possible, and that is how [linked lists](https://en.wikipedia.org/wiki/Linked_list) are implemented. You lose the contiguity (single block) aspect of the "Python list", which gives you random access, i.e., the ability to access any element in constant time. In linked lists, the elements are scattered in memory and you store addresses to point to the next element. On the other hand, as you suggested, it is not necessary to shift elements after deletion. So it's a matter of tradeoff.
Comment: worth mentioning that you can also use `somelist.pop(i)` instead of `del` if you want to do something with the item you are removing.
Comment: @tglaria Lists occupy a contiguous amount of memory; therefore if you remove any element other than the last one, the elements "to the right" must be shifted "left". (I'm using 'left' as the start of the list, and 'right' as the end of the list here)
Comment: @luizfls that's interesting. I wonder if that takes any resources. Wouldn't be easier to relocate the address to the next element of the list instead of shifting the elements of the list?
Answer: You can use enumerate and remove the values whose index matches the indices you want to remove:
indices = 0, 2
somelist = [i for j, i in enumerate(somelist) if j not in indices]

Comment: This is not deleting items from somelist at all, but rather creating a brand new list.  If anything is holding a reference to the original list, it will still have all the items in it.
Comment: the reason that i've chosen tuple for indices was only simplicity of the record. it would be a perfect job for set() giving O(n)
Comment: Almost, only if you delete the entire list.  it'll be len(indices) * len(somelist).  It also creates a copy, which may or may not be desired
Comment: Changed my mind. By giving the results of the enumerate more descriptive names, this approach is easy to read. It also helps me if parens are added. That is: `[ value for (i, value) in enumerate(lst) if i not in set(indices) ]`.
Comment: @SilentGhost Not necessary to make an enumeration. How about this: `somelist = [ lst[i] for i in xrange(len(lst)) if i not in set(indices) ]`?
Comment: if you're checking for a value in a list, it is.  the 'in' operator works on the values of a list, whereas it works on the keys of a dict.  If i'm wrong, please point me to the pep/reference
Comment: @SilentGhost  I originally avoided using this solution, because "j not in indices" sounded slow, when many indices. As you acknowledge "set()" would fix that. Surprised you didn't edit your post. So, the performance fix is to replace `in indices` with `in set(indices)`?
Comment: @TomFuture. True. It is good practice, when creating a method to perform a task, to create a new object, rather than modifying the original. Leave it to the user to modify the original if they need to. Do so with `[:]`. E.g. `somelist[:] = ...` will replace the elements of the object pointed to by somelist, affecting all references to that object.
Comment: (I've added an answer, far below, that shows this in action.)
Comment: Brilliant! this method really help me
Comment: I like better having it indices = {0, 2} to make indices a set from the get-go :)
Comment: As others have said, this is NOT deleting anything from a list – it's creating a new list with those elements excluded. For some applications both ways are fine, but the OP specifically mentions deleting and del.
Answer: If you're deleting multiple non-adjacent items, then what you describe is the best way (and yes, be sure to start from the highest index).
If your items are adjacent, you can use the slice assignment syntax:
a[2:10] = []

Comment: You can also say `del a[2:10]` with the same effect.
Comment: @sth Interestingly, del is little faster than the assigning.
Answer: You can use numpy.delete as follows:
import numpy as np
a = ['a', 'l', 3.14, 42, 'u']
I = [0, 2]
np.delete(a, I).tolist()
# Returns: ['l', '42', 'u']

If you don't mind ending up with a numpy array at the end, you can leave out the .tolist(). You should see some pretty major speed improvements, too, making this a more scalable solution. I haven't benchmarked it, but numpy operations are compiled code written in either C or Fortran.
Comment: general solution when elements are not consecutive +1
Comment: question here, how about deleting ['a', 42].
Comment: HUGE bonus points for this solution, compared to the others, for speed.  What I can say is that for a very large data set, it was taking me several minutes to achieve something that took just a few seconds with good ol' numpy.
Answer: As a specialisation of Greg's answer, you can even use extended slice syntax. eg. If you wanted to delete items 0 and 2:
>>> a= [0, 1, 2, 3, 4]
>>> del a[0:3:2]
>>> a
[1, 3, 4]

This doesn't cover any arbitrary selection, of course, but it can certainly work for deleting any two items.
Answer: As a function:
def multi_delete(list_, *args):
    indexes = sorted(list(args), reverse=True)
    for index in indexes:
        del list_[index]
    return list_

Runs in n log(n) time, which should make it the fastest correct solution yet.
Comment: `n log n`? Really? I don't think `del list[index]` is O(1).
Comment: The version with args.sort().reverse() is definitely better. It also happens to work with dicts instead of throwing or, worse, silently corrupting.
Comment: sort() is not defined for tuple,  you'd have to convert to list first. sort() returns None, so you couldn't use reverse() on it.
Comment: @ R. Pate: I removed the first version for that reason.  Thanks.

@ SilentGhost: Fixed it.
Comment: @Nikhil: no you didn't ;)
args = list(args)
args.sort()
args.reverse()
but better option would be: args = sorted(args, reverse=True)
Comment: Oh, I see what you meant - you can't chain the methods, which seems silly, even for immutable objects.

I don't like changing a variable's type as in "args = list(args)" . I know it's done, but it can be confusing.
Comment: The list argument overrides the builtin list used inside the method.
Comment: Yeah, I'd give this solution a +1 if it actually worked as written (c.f. what @iny said).
Comment: why did you do `list(args)`, couldn't you use `args` as is?
Comment: @JoãoPortela is correct. After the first edit, which put `list(args)` inside of `sorted()`, the `list()` wrapper is no longer necessary, as per SilentGhost's responding comment. Tested & verified with tuple input. Have submitted as an edit.
Comment: @user202729 del` statement itself is actually  O(1), and the cleanup of the old array is delayed. So, the algorithmic cost may still be O(n). https://stackoverflow.com/questions/44148504/python-big-o-of-del-my-list
Comment: @ARAT That answer contradict what you says. It has "it could be optimized", but it's not actually optimized yet. Besides, that's a different case from this one, here only one element is deleted all the following elements must be shifted to the left.
Comment: My mistake, sorry! I was just referring that `del` statement itself is actually O(1), Other than that, you are totally right. As you said, since an item is removed, all the following elements are shifted, that makes `del list[index]` take O(n) time.
Answer: So, you essentially want to delete multiple elements in one pass?  In that case, the position of the next element to delete will be offset by however many were deleted previously.
Our goal is to delete all the vowels, which are precomputed to be indices 1, 4, and 7.  Note that its important the to_delete indices are in ascending order, otherwise it won't work.
to_delete = [1, 4, 7]
target = list("hello world")
for offset, index in enumerate(to_delete):
  index -= offset
  del target[index]

It'd be a more complicated if you wanted to delete the elements in any order.  IMO, sorting to_delete might be easier than figuring out when you should or shouldn't subtract from index.
Answer: I'm a total beginner in Python, and my programming at the moment is crude and dirty to say the least, but my solution was to use a combination of the basic commands I learnt in early tutorials:
some_list = [1,2,3,4,5,6,7,8,10]
rem = [0,5,7]

for i in rem:
    some_list[i] = '!' # mark for deletion

for i in range(0, some_list.count('!')):
    some_list.remove('!') # remove
print some_list

Obviously, because of having to choose a "mark-for-deletion" character, this has its limitations.
As for the performance as the size of the list scales, I'm sure that my solution is sub-optimal.  However, it's straightforward, which I hope appeals to other beginners, and will work in simple cases where some_list is of a well-known format, e.g., always numeric...
Comment: instead of using '!' as your special character, use None.  This keeps every character valid and frees up your possiblities
Answer: Here is an alternative, that does not use enumerate() to create tuples (as in SilentGhost's original answer).
This seems more readable to me. (Maybe I'd feel differently if I was in the habit of using enumerate.) CAVEAT: I have not tested performance of the two approaches.
# Returns a new list. "lst" is not modified.
def delete_by_indices(lst, indices):
    indices_as_set = set(indices)
    return [ lst[i] for i in xrange(len(lst)) if i not in indices_as_set ]

NOTE: Python 2.7 syntax. For Python 3, xrange => range.
Usage:
lst = [ 11*x for x in xrange(10) ]
somelist = delete_by_indices( lst, [0, 4, 5])

somelist:
[11, 22, 33, 66, 77, 88, 99]

--- BONUS ---
Delete multiple values from a list. That is, we have the values we want to delete:
# Returns a new list. "lst" is not modified.
def delete__by_values(lst, values):
    values_as_set = set(values)
    return [ x for x in lst if x not in values_as_set ]

Usage:
somelist = delete__by_values( lst, [0, 44, 55] )

somelist:
[11, 22, 33, 66, 77, 88, 99]

This is the same answer as before, but this time we supplied the VALUES to be deleted [0, 44, 55].
Comment: Is there a style reason for the double underscore in `delete__by_values()`?
Comment: I've decided @SilentGhost's was only difficult to read, because of the non-descriptive variable names used for the result of the enumerate. Also, parens would have made it easier to read. So here is how I would word his solution (with "set" added, for performance): `[ value for (i, value) in enumerate(lst) if i not in set(indices) ]`. But I'll leave my answer here, because I also show how to delete by values. Which is an easier case, but might help someone.
Comment: @Veedrac- thank you; I've re-written to build the set first. What do you think - faster solution now than SilentGhost's? (I don't consider it important enough to actually time it, just asking your opinion.)  Similarly, I would re-write SilentGhost's version as `indices_as_set = set(indices)`, `[ value for (i, value) in enumerate(lst) if i not in indices_as_set ]`, to speed it up.
Answer: An alternative list comprehension method that uses list index values:
stuff = ['a', 'b', 'c', 'd', 'e', 'f', 'woof']
index = [0, 3, 6]
new = [i for i in stuff if stuff.index(i) not in index]

This returns:
['b', 'c', 'e', 'f']

Comment: good answer, but naming the list of indexes as `index` is misleading since in the list iterator is used the method `index()`
Comment: What if `stuff` has duplicate values?
Answer: here is another method which removes the elements in place. also if your list is really long, it is faster.
>>> a = range(10)
>>> remove = [0,4,5]
>>> from collections import deque
>>> deque((list.pop(a, i) for i in sorted(remove, reverse=True)), maxlen=0)

>>> timeit.timeit('[i for j, i in enumerate(a) if j not in remove]', setup='import random;remove=[random.randrange(100000) for i in range(100)]; a = range(100000)', number=1)
0.1704120635986328

>>> timeit.timeit('deque((list.pop(a, i) for i in sorted(remove, reverse=True)), maxlen=0)', setup='from collections import deque;import random;remove=[random.randrange(100000) for i in range(100)]; a = range(100000)', number=1)
0.004853963851928711

Comment: +1: Interesting use of deque to perform a for action as part of an expression, rather than requiring a "for ..:" block. However, for this simple case, I find Nikhil's for block more readable.
Answer: This has been mentioned, but somehow nobody managed to actually get it right.
On O(n) solution would be:
indices = {0, 2}
somelist = [i for j, i in enumerate(somelist) if j not in indices]

This is really close to SilentGhost's version, but adds two braces.
Comment: @MadPhysicist [`j not in indices` is `O(1)`, seriously.](http://stackoverflow.com/a/3949795/1763356)
Comment: This is not `O(n)` if you count the lookups that take `log(len(indices))` for each iteration.
Comment: @MadPhysicist `j not in indices` is `O(1)`.
Comment: I am not sure how you get that number. Since indices is a set, `j not in indices` still requires lookup, which is `O(log(len(indices)))`. While I agree that a lookup in a 2-element set qualifies as `O(1)`, in the general case it will be `O(log(N))`. Either way `O(N log(N))` still beats `O(N^2)`.
Comment: And what exactly did two braces do?
Comment: @Nuclear03020704 https://docs.python.org/3.3/tutorial/datastructures.html#sets
Answer: l = ['a','b','a','c','a','d']
to_remove = [1, 3]
[l[i] for i in range(0, len(l)) if i not in to_remove])

It's basically the same as the top voted answer, just a different way of writing it. Note that using l.index() is not a good idea, because it can't handle duplicated elements in a list.
Answer: Remove method will causes a lot of shift of list elements. I think is better to make a copy:
...
new_list = []
for el in obj.my_list:
   if condition_is_true(el):
      new_list.append(el)
del obj.my_list
obj.my_list = new_list
...

Answer: technically, the answer is NO it is not possible to delete two objects AT THE SAME TIME. However, it IS possible to delete two objects in one line of beautiful python.
del (foo['bar'],foo['baz'])

will recusrively delete foo['bar'], then foo['baz']
Comment: This deletes from a dict object, not a list, but I'm still +1'ing it cause it's darn pretty!
Comment: It applies to list as well, with appropriate syntax. However the claim is that it is not possible to delete two objects at the same time is false; see answer by @bobince
Answer: we can do this by use of a for loop iterating over the indexes after sorting the index list in descending order
mylist=[66.25, 333, 1, 4, 6, 7, 8, 56, 8769, 65]
indexes = 4,6
indexes = sorted(indexes, reverse=True)
for i in index:
    mylist.pop(i)
print mylist

Answer: For the indices 0 and 2 from listA:
for x in (2,0): listA.pop(x)

For some random indices to remove from listA:
indices=(5,3,2,7,0)
for x in sorted(indices)[::-1]: listA.pop(x)

Answer: To generalize the comment from @sth. Item deletion in any class, that implements abc.MutableSequence, and in list in particular, is done via __delitem__ magic method. This method works similar to __getitem__, meaning it can accept either an integer or a slice. Here is an example:
class MyList(list):
    def __delitem__(self, item):
        if isinstance(item, slice):
            for i in range(*item.indices(len(self))):
                self[i] = 'null'
        else:
            self[item] = 'null'

l = MyList(range(10))
print(l)
del l[5:8]
print(l)

This will output
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 1, 2, 3, 4, 'null', 'null', 'null', 8, 9]

Answer: I wanted to a way to compare the different solutions that made it easy to turn the knobs.
First I generated my data:
import random

N = 16 * 1024
x = range(N)
random.shuffle(x)
y = random.sample(range(N), N / 10)

Then I defined my functions:
def list_set(value_list, index_list):
    index_list = set(index_list)
    result = [value for index, value in enumerate(value_list) if index not in index_list]
    return result

def list_del(value_list, index_list):
    for index in sorted(index_list, reverse=True):
        del(value_list[index])

def list_pop(value_list, index_list):
    for index in sorted(index_list, reverse=True):
        value_list.pop(index)

Then I used timeit to compare the solutions:
import timeit
from collections import OrderedDict

M = 1000
setup = 'from __main__ import x, y, list_set, list_del, list_pop'
statement_dict = OrderedDict([
    ('overhead',  'a = x[:]'),
    ('set', 'a = x[:]; list_set(a, y)'),
    ('del', 'a = x[:]; list_del(a, y)'),
    ('pop', 'a = x[:]; list_pop(a, y)'),
])

overhead = None
result_dict = OrderedDict()
for name, statement in statement_dict.iteritems():
    result = timeit.timeit(statement, number=M, setup=setup)
    if overhead is None:
        overhead = result
    else:
        result = result - overhead
        result_dict[name] = result

for name, result in result_dict.iteritems():
    print "%s = %7.3f" % (name, result)

Output
set =   1.711
del =   3.450
pop =   3.618

So the generator with the indices in a set was the winner. And del is slightly faster then pop.
Comment: Thank you for this comparison, this led me to make my own tests (actually just borrowed your code) and for small number of items to remove, the overhead for creating a SET makes it the worst solution (use 10, 100, 500 for the length of 'y' and you'll see). As most of the times, this depends on the application.
Answer: You can use this logic:
my_list = ['word','yes','no','nice']

c=[b for i,b in enumerate(my_list) if not i in (0,2,3)]

print c

Answer: Another implementation of the idea of removing from the highest index.
for i in range(len(yourlist)-1, -1, -1):
    del yourlist(i)

Answer: You may want to simply use np.delete:
list_indices = [0, 2]
original_list = [0, 1, 2, 3]
new_list = np.delete(original_list, list_indices)

Output
array([1, 3])

Here, the first argument is the original list, the second is the index or a list of indices you want to delete.
There is a third argument which you can use in the case of having ndarrays: axis (0 for rows and 1 for columns in case of ndarrays).
Answer: I tested the suggested solutions with perfplot and found that NumPy's
np.delete(lst, remove_ids)

is the fastest solution if the list is longer than about 100 entries. Before that, all solutions are around 10^-5 seconds. The list comprehension seems simple enough then:
out = [item for i, item in enumerate(lst) if i not in remove_ids]

Code to reproduce the plot:
import perfplot
import random
import numpy as np
import copy

def setup(n):
    lst = list(range(n))
    random.shuffle(lst)
    # //10 = 10%
    remove_ids = random.sample(range(n), n // 10)
    return lst, remove_ids

def if_comprehension(lst, remove_ids):
    return [item for i, item in enumerate(lst) if i not in remove_ids]

def del_list_inplace(lst, remove_ids):
    out = copy.deepcopy(lst)
    for i in sorted(remove_ids, reverse=True):
        del out[i]
    return out

def del_list_numpy(lst, remove_ids):
    return np.delete(lst, remove_ids)

b = perfplot.bench(
    setup=setup,
    kernels=[if_comprehension, del_list_numpy, del_list_inplace],
    n_range=[2**k for k in range(20)],
)
b.save("out.png")
b.show()

Answer: You can do that way on a dict, not on a list. In a list elements are in sequence. In a dict they depend only on the index.
Simple code just to explain it by doing:
>>> lst = ['a','b','c']
>>> dct = {0: 'a', 1: 'b', 2:'c'}
>>> lst[0]
'a'
>>> dct[0]
'a'
>>> del lst[0]
>>> del dct[0]
>>> lst[0]
'b'
>>> dct[0]
Traceback (most recent call last):
  File "<pyshell#19>", line 1, in <module>
    dct[0]
KeyError: 0
>>> dct[1]
'b'
>>> lst[1]
'c'

A way to "convert" a list in a dict is:
>>> dct = {}
>>> for i in xrange(0,len(lst)): dct[i] = lst[i]

The inverse is:
lst = [dct[i] for i in sorted(dct.keys())]

Anyway I think it's better to start deleting from the higher index as you said.
Comment: This answer talks about dictionaries in a fundamentally wrong way. A dictionary has KEYS (not INDICES). Yes, the key/value pairs are independent of each other. No, it doesn't matter what order you delete the entries in. Converting to a dictionary just to delete some elements from a list would be overkill.
Comment: Does Python guarantee [dct[i] for i in dct] will always use increasing values of i? If so, list(dct.values()) is surely better.
Comment: I was not thinking about that. You're right. There is not guarantee as I read [here][1] that the items will be picked in order, or at least the expected order. I edited.

  [1]: http://docs.python.org/library/stdtypes.html#dict.items
Answer: I can actually think of two ways to do it:

slice the list like (this deletes the 1st,3rd and 8th elements)
somelist = somelist[1:2]+somelist[3:7]+somelist[8:]
do that in place, but one at a time:
somelist.pop(2)
somelist.pop(0)
Answer: Importing it only for this reason might be overkill, but if you happen to be using pandas anyway, then the solution is simple and straightforward:
import pandas as pd
stuff = pd.Series(['a','b','a','c','a','d'])
less_stuff = stuff[stuff != 'a']  # define any condition here
# results ['b','c','d']

Answer: some_list.remove(some_list[max(i, j)])

Avoids sorting cost and having to explicitly copy list.
Answer: None of the answers offered so far performs the deletion in place in O(n) on the length of the list for an arbitrary number of indices to delete, so here's my version:
def multi_delete(the_list, indices):
    assert type(indices) in {set, frozenset}, "indices must be a set or frozenset"
    offset = 0
    for i in range(len(the_list)):
        if i in indices:
            offset += 1
        elif offset:
            the_list[i - offset] = the_list[i]
    if offset:
        del the_list[-offset:]

# Example:
a = [0, 1, 2, 3, 4, 5, 6, 7]
multi_delete(a, {1, 2, 4, 6, 7})
print(a)  # prints [0, 3, 5]

Answer: How about one of these (I'm very new to Python, but they seem ok):
ocean_basin = ['a', 'Atlantic', 'Pacific', 'Indian', 'a', 'a', 'a']
for i in range(1, (ocean_basin.count('a') + 1)):
    ocean_basin.remove('a')
print(ocean_basin)

['Atlantic', 'Pacific', 'Indian']
ob = ['a', 'b', 4, 5,'Atlantic', 'Pacific', 'Indian', 'a', 'a', 4, 'a']
remove = ('a', 'b', 4, 5)
ob = [i for i in ob if i not in (remove)]
print(ob)

['Atlantic', 'Pacific', 'Indian']
Answer: I put it all together into a list_diff function that simply takes two lists as inputs and returns their difference, while preserving the original order of the first list.
def list_diff(list_a, list_b, verbose=False):

    # returns a difference of list_a and list_b,
    # preserving the original order, unlike set-based solutions

    # get indices of elements to be excluded from list_a
    excl_ind = [i for i, x in enumerate(list_a) if x in list_b]
    if verbose:
        print(excl_ind)

    # filter out the excluded indices, producing a new list
    new_list = [i for i in list_a if list_a.index(i) not in excl_ind]
    if verbose:
        print(new_list)

    return(new_list)

Sample usage:
my_list = ['a', 'b', 'c', 'd', 'e', 'f', 'woof']
# index = [0, 3, 6]

# define excluded names list
excl_names_list = ['woof', 'c']

list_diff(my_list, excl_names_list)
>> ['a', 'b', 'd', 'e', 'f']

Answer: Use numpy.delete which is definitely faster (376 times, as shown later) than python lists.
First method (using numpy):
import numpy as np

arr = np.array([0,3,5,7])
# [0,3,5,7]
indexes = [0,3]
np.delete(arr, indexes)
# [3,5]

Second method (using a python list):
arr = [0,3,5,7]
# [0,3,5,7]
indexes = [0,3]
for index in sorted(indexes, reverse=True):
    del arr[index]
arr
# [3,5]

Code to benchmark the two methods on an array of 500000 elements, deleting half of the elements randomly:
import numpy as np
import random
import time

start = 0
stop = 500000
elements = np.arange(start,stop)
num_elements = len(temp)

temp = np.copy(elements)
temp2 = elements.tolist()

indexes = random.sample(range(0, num_elements), int(num_elements/2))

start_time = time.time()

temp = np.delete(temp, indexes)

end_time = time.time()
total_time = end_time - start_time
print("First method: ", total_time)

start_time = time.time()

for index in sorted(indexes, reverse=True):
    del temp2[index]

end_time = time.time()
total_time = end_time - start_time
print("Second method: ", total_time)

# First method:  0.04500985145568848
# Second method:  16.94180393218994

The first method is about 376 times faster than the second one.
Answer: You can use remove, too.
delete_from_somelist = []
for i in [int(0), int(2)]:
     delete_from_somelist.append(somelist[i])
for j in delete_from_somelist:
     newlist = somelist.remove(j)

Deleting multiple elements from a list


How to make Skyrim more challenging at higher character levels?

Question: I'm a first time TES player, and I simply loved Skyrim the first time I tried it. I started playing on Adept (the default difficulty level), and while the first 80 - 95 hours were both challenging and fun to play, I'm seeing now that the game is becoming progressively easier once I've leveled up and used the appropriate perk trees for my style of game-play. I want to keep it challenging now that I've leveled up and have better equipments, and wanted the community's advice regarding that. Details of my (first) build:

Level 48, with 100 Smithing/Alchemy/Enchanting/Sneak, 70+ Archery, 40+ One-Handed, 40+
Destruction (which I rarely use since the last 10 levels or so)
Armor rating of 565 (Dragonscale), using 4x28% Smithing clothing and 118% Smithing potion,
Daedric Bow with 320 damage (+29 pts of Fire/shock damage), made with the same smithing gear above and 31% fortify enchanting potion,
Jewellery double enchanted with fire/frost/magic/shock resistance (46% elemental, 23% for magic).

I've stayed completely away from using either the console, or exploits like the Falmer Helmet glitch (for boosting alchemy/smithing buffs), or the Fortify restoration glitch (for alchemy). I had heard that the AI leveled up the beasts/dragons according to the character level, but now I find I can take on Draugr Deathlords, Dragon Priests AND Elder Dragons without using a single potion/healing spell! This is becoming game breaking for me, and I've barely done half of the quest-lines (so far, finished only the College of Winterhold questline, completed the main quest up to Alduin's Bane, and the Thieves Guild quest till Blind-sighted - I've still to start the Companions, Dark Brotherhood, Civil War apart from the main quest!).
So far, I've turned on the difficulty to Master, and have started to actively hunt down tougher quests (like going after Dragon Priests), but I still don't seem to able to make it challenging enough. So, my question(s) are:

Is there anything that I've done incorrectly for my build, in that I shouldn't have tried to get the best gear midway through the game?
Are there any hard quests that I've completely missed, or do you think that now if I start new questlines with my increased stats, the game would level up the difficulty for me?

I understand that getting rid of my gear would be one-way to fix the issue, but would kind of break immersion for me (as I leveled up the 3 critical skills painstakingly, and am surprised that I'm getting penalized by the game for it!) - so, I'm looking for any advice as to how to bring back the challenge that was playing Skyrim.
Comment: Try not using the Attack button
Comment: I see your issue, but beyond handicapping yourself by your own standards. (Ie: no potions or no spells or no daedric equip, ect) I cant think of any way to make the game harder. Simply put, the game isn't hard, not for anyone with any kind of understanding of how to play such a game. Not in my opinion anyway.
Comment: I sometimes find it fun to put all of my equipment into a chest, and then just run out into the wilderness naked, and then work from there, meaning the only way I can get gear is by looting dead bodies or stealing. It's fun to see how far you can get, and offers a welcome break from being an uber being who doesnt afraid of anything
Comment: @shan23 not sarcastic, it was just a joke! Though not a very good one, it seems...
Comment: @Ender: I agree that its not tough once u put your mind to it, though that certainly makes it a bit disappointing when u realize it!
Comment: @Alex - was that meant as a sarcastic comment, or am I missing something here?
Comment: @Alex - Its okay, I thought being a first time TES player, I was doing something glaringly wrong!
Comment: Same thing for me... you could take off all of your clothes and use a hunting bow;), or start a new character like i did @Alex I liked your joke
Comment: Lets see - if player.advlevel does not do anything for me, restarting seems like the only way to go!
Comment: Use only practice arrows. You can get them for free from Angi in the mountain range South of Falkreath.
Answer:
Is there anything that I've done incorrectly for my build, in that I shouldn't have tried to get the best gear midway through the game?

This is very subjective - what is considered an "incorrect" build by one player, may be "optimal" for another. If you want to make the game harder, focus your skill points and perks on non-combat skills: Speech, Pickpocket, Lockpicking, etc. You can also put skill points and perks on combat skills that you won't be using in combat. This will level up your character (which will make enemy level difficulty scale to your level), while at the same time, not make your character stronger for combat.
With the Dragonborn DLC installed, perks may be undone and redistributed at the cost of one dragon soul per skill tree.
At the end of the At the Summit of Apocrypha quest, you will have access to different portals (one for each skill) which allows you to clear and regain any perks in that skill tree, at the cost of one dragon soul. You remove all perks from a single skill perk tree and can use these reclaimed perks on unlocking any perks you wish, including perks taken from said perk tree. By reading the Black Book, Waking Dreams, you can return to Apocrypha and alter the skill trees whenever you wish.

Are there any hard quests that I've completely missed, or do you think that now if I start new questlines with my increased stats, the game would level up the difficulty for me?

It is subjective to state which quests are "Hard quests". Just have a look here for a list of all quests and see which ones appear to be hard for you. As for the second part of your question, the unmodded game only checks your current level and the difficulty settings in the options to compute how difficult the enemies will be for you.
Excerpts from UESP wiki's "Leveling - Effects of Leveling" article:

Various aspects of the game are leveled. This means that as your character increases in level, some enemies become more challenging but also the quality of the items you find becomes better. However, the leveling system in Skyrim has been altered from that used in Oblivion, in response to criticisms of Oblivion's leveling system.
Different locations in Skyrim have different inherent difficulties. In other words, some dungeons are designed to be too difficult for low-level characters to enter. More challenging dungeons are generally located at higher elevations, meaning that early in the game players may want to avoid mountainous regions. However, more difficult dungeons contain better rewards. In addition, some high-quality items can be randomly found even early in the game.
... Bandit NPCs are always a fixed level for their name (Bandits are level 1, Bandit Thugs are level 9, Bandit Highwaymen are level 14, etc). The player's level affects the range of possible bandit types generated within a bandit dungeon, and probably the frequency, but does not seem to affect the resulting stats except in a few rare cases. Lower variant bandits remain reasonably common even when more dangerous bandits are available.

v1.9 Patch - 'Legendary' difficulty
Patch 1.9 adds a sixth difficulty level: Legendary. It reduces damage dealt by the player to x0.25 and increases damage taken by the player to x3.

Mods
If playing on the PC, you could also make the game harder with mods:
The mod, Pluto's Improved Skyrim Experience (PISE) has a "More Intense Level Scaling" component. It makes enemies more stronger relative to your level, compared to the vanilla enemy scaling. PISE also features harder sneaking, more enemy spawns, harder enemies and an overhauled enemy AI. The mod, Path of Shadows, a major stealth overhaul mod, also makes sneaking harder.
Other mods that may make the game harder:

DFB - Random Encounters - adds different random encounters from vanilla: Vampires, Falmers, Werewolves, Dwarven Spiders, Spheres, Centurion, etc.
High Level Enemies - has a feature that allows certain or all enemies to scale with your level
Deadly Dragons - overhauls dragons to make them more challenging to fight
Balanced Magic - designed to 'balance' the game's magic spells - make the spells do damage and consume mana appropriate to your magic perks, and lessens the effect of abusive perks like the 100% stagger change of the 'Impact' perk.  It also affects enemy mage NPCs, making them more challenging
Auto-cast Racial Powers Plugin - "Auto-cast racial powers will activate for NPCs, both enemy and friendly, making fights much more interesting and adding a new element to prioritizing targets in larger fights!"

Creature mods that increase creature spawn points, number of spawns, and also improves creature AI:
(I recommend using only one creature mod, to avoid conflicts and other issues.)

Real Wildlife - Skyrim
Realistic Animals and Predators
Skyrim Creatures Alive
Comment: @camino Those are not direct download links. If you've tried them, you'll find out that they link to their respective Nexusmods.com mod description page. Nexusmods.com just changed they way they linked to the mod description page. There is no need for your edit as the old links will redirect to the new URLs anyway. The old links work fine. Please do some testing before doing a trivial edit next time.
Comment: @desaivv I'm always glad to be of help to fellow Skyrim adventurers.
Comment: No direct download links please, this will break.
Comment: @daemonfire300 I fixed the download links to the mods instead of the files
Answer: There are 2 console commands if you are on PC that makes things harder without ruining the experience:

The first is: player.modav healrate x where x is any value
less than the 0.7 vanilla Skyrim grants you. I have mine personally
at player.modav healrate 0.2. This allows for me to still regen
when out of combat or when resting, but when in combat, the regen
does nothing for me.

The second is: player.advlevel. This will allow you to "level
up" your character strictly for the numerical value. You WILL NOT
gain any perk points or stat points from this approach. Instead, it
will simply put you x amount of levels above your "true" level, thus
making enemies scale up to this imaginary level, and therefore making
the game as adjustable in difficulty past master as you wish!

The Total Realism - Basic Needs mod adds realism and can make it somewhat harder to survive.
The Deadly Dragons mod makes dragons more powerful as they should be.
Comment: Regen rate would do nothing for me - I barely take a hit when i'm in combat, due to my high sneak/archery skills plus a killer bow! I'll look at the .advlevel mod - do you know what is the highest (i.e. most challenging) legal value that I can input?
Comment: The game apparently doesn't scale after level 50, so advlevel would probably do little in that case.
Comment: @kotekzot - Are there any references for that, or is it from experience? Because if its true, i might have to abandon this character - so, before doing that, I just wanted to ensure that it was well verified :)
Comment: the command should force that max level to go higher there are not many rules that apply to console commands.Try increasing game by 10 levels...someone said that 25% of their level increse it took him 75 arrows to kill a dragon and he would get 2 hitted.
Comment: @shan23 I've seen it mentioned several times, but can't really remember where. If all else fails there are always mods to try. IMO the real reason the game stops being challenging at later levels is because the enemies don't get access to the same toys as the character does. Perhaps it was an attempt to balance the "economy" somewhat, but hide armor does little against daedric weapons.
Comment: @Arremer - I doubt it'd take me that long to finish off a dragon, unless I revert to using something like a Nightingale Bow instead of my Legendary Daedric Bow of Woe :)
Comment: @Arremer - player.advlevel didn't do a lot for me - I leveled to 60 using it, and I'm getting 4 Draugr Deathlords in each room in a dungeon on average, which still doesn't really seem too tough. I'll start playing after selling off all my custom armor/weapons (:( ), and using the Nighitngale Armor/Bow/Sword only. That **should** fix it IMO!
Answer: I had this same problem. This is what I am trying. YMMV.
You can try this play style. Go without killing anyone for as many levels as possible on Adept or Master difficulty. This was proposed by @Alex as well in the comments to your question.
It is a very challenging play style, for quests where I simply have to kill as part of the quest objective, it gets difficult, but even then with Mayhem/Frenzy/Fear etc it is possible that your quarry gets killed.
For an example of this challenging play style check out Felix The Peaceful Monk
Answer: If you're playing on the PC try a mod called High Level Enemies.  It adds something like 400+ higher level Bandits, Draugr, Dragon Priests, Forsworn... (it covers all enemy types) to the game.  Really keeps the difficulty up at high levels.

Main Files

Adds 708 new enemies starting at level 10 to Skyrim, Dawnguard and Dragonborn!
Now includes an optional version with full level scaling so all enemies (even Vanilla enemies) will scale to your level!
Each of Skyrim's main enemy types are covered including Bandits, Draugr, Dragon Priests, Falmer, Forsworn, Thalmor, Dwarven Constructs, Vampires, Warlocks, Trolls, Chaurus, Spriggans, Hagravens, Spiders, Skeletons, Witches, Ice Wraiths, Mammoths, Dremora and Wild Animals!
Each of Dawnguard's main enemy types are covered including Vampires, Vampire Hunters, Falmer, Gargoyles, Armored Trolls, Death Hounds and Chaurus Hunters!
Dragonborn Cultists, Rieklings, Ash Spawn, and Dragonborn Bandits Included!
For each enemy type the highest level variant scales with player level so the game doesn't get too easy!
Countless hours were spent customizing the Stats, Skills, Perks, Spells, Damage Done and Armor Rating of each added creature to ensure that the difficulty stays consistent as the player levels!
The scaling is non-linear and takes into account that high level players invest in at least 1 crafting skill (Smithing, Enchanting or Alchemy).

Optional Files

Includes an optional file that increases difficulty at all levels.
Includes an optional file that increases armor cap to 90% and max magic resist to 90% encouraging high-level play.
Includes an optional file that scales Illusion, Raise Dead, Summons, Turn Undead Spells and Werewolf Howl so they are still viable in high-level play.
Answer: I had the same issue! Here's how to make it difficult:

No glitch use
Leveling up skills using cheap ways is banned (like leveling up restoration by jumping on blacksmith fire and heal)
You can only put perks in four trees only (example: one hand + destruction + light armor + archery)
(this is most important). You can't pick perks that require skill level 70 or more! Because such perks are overpowered, like dual savegery and elemental protection
enchanting can accept only 2 perks, because more will make you overpowered
Your character is allowed to use 2 shouts only. You assign them at the begining of the game and don't use other shouts execept for quests
Answer: You can start using 2 handed weapons. If your skill is still low and you haven't put points in that skill tree, killing oponents will be harder and more challenging.
Or you can try to only use magic in fights. Destruction to damage your oponents, Restoration to heal yourself (no potions), Conjuration to call for allies, Alteration for defensive spells, ...
If you are a PC gamer:
galacticninja gave some nice mods to try out.
Another mod that makes Skyrim more challenging in my eyes is Imp's More Complex Needs.
If you don't eat, drink or sleep, you die. That's the mod in a nutshell, but it is way more complex than that. It's available on Steam so it's easy to install too.
Answer: Start a new game, play normally but never use your perks
You will have weapons that will do 20 (tops) damage and enemies with 150+ hp (some have a lot more)
Answer: Ideas i thought of is,

Restrict yourself from certain things like no fast traveling.
No skill boosting via glitches.
No trading or training with vendors or followers.
No followers unless quest involved.
All materials you need must be foraged from the world. (Eg. Iron can only be obtained by finding. Stealing. Or mining)
play completely on the hardest difficulty.
Craft all your own things such as potions and gear.
Turn the hud completely off.
Comment: Hi Robert, welcome to Arqade. I've suggested an edit to your answer that (a) removes the "me too!" aspect at the start, which would probably get downvotes; (b) formats your suggestions into bullet points.
Answer: Just change how you play. You seem to mostly be a warrior. Just use skills that you haven't gotten to high. I know that for myself, not using enchanted items other than the ones I have found has kept the game fun.
You're not being penalized for your hard work, in some eyes it's a reward, but it's up to you to make it fun or boring. You're right - the only way is stop using your great items. Maybe you should sell them so you are not tempted to kick too much ass, just enough.
Answer: A good way to improve your gaming experience is to play something what I call "Iron Man" challenge - when you die, you just start a new game, there is no reloading. I can assure you you will suddenly start playing much more cautiously and the game will become much more of a challenge :)
Answer: Just reset difficulty to legendary then legendary all your skills.  You'll have the same gear and have the same enemies though.
Answer: don't craft items. only use items you find. makes the game much harder when you don't have gear that you got through blacksmithing potions + grindstone
Answer: My first character was just a leveling up fiend and the same thing happened to me as to you. I got too powerful and the game lost its appeal.
  One of the ways I've found useful to play Skyrim is to play using a set character theme in mind. Some examples from my play are; a Barbarian that won't use any magic other than heal and wields a two-handed sword almost exclusively. I have a Paladian that has leveled up his restoration but won't use destruction, conjuration or other spells, except calm and courage. Having a set character theme has helped keep my game interesting and given me a variety of interesting paths through the game and different 'feels' each time.


How to download images from a website that are running in a loop?

Question: This is the website:
http://www.sat24.com/foreloop.aspx?type=1&continent=europa#
The images there are moving in a loop.
This is an example of a url of one image:
http://www.niederschlagsradar.de/images.aspx?jaar=-6&type=europa.precip&datum=201309171200&cultuur=en-GB&continent=europa
In the middle there is time and date: 201309171200
I need somehow to parse the time and date automatic from each url.
To build some string for example:
"www.niederschlagsradar.de/images.aspx?jaar=-6&type=europa.precip&datum=" + parsedDateAndTime + &cultuur=en-GB&continent=europa
What i tried so far is this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;

namespace DownloadImages
{
    public partial class Form1 : Form
    {
        int counter;

        public Form1()
        {
            InitializeComponent();

            counter = 0;

            string localFilename = @"d:\localpath\";
            while (true)
            {
                using (WebClient client = new WebClient())
                {
                    client.DownloadFile("http://www.sat24.com/foreloop.aspx?type=1&continent=europa#", localFilename + counter.ToString("D6") + ".jpg");
                    counter++;
                }
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

But i didn't parse any url yet im justing using the main loop url and i see that it's downloading each time 46kb file but i can't open them im getting an error that paint can't open it...etc
This is wrong the way i did it.
How can i download each image from the site from the loop ?
How can i parse from each image the date and time so it won't download the same image all the time ? I need somehow to get the date and tiem of each image-url and use it as a sign or something so it won't download the same file.
Edit**
The date and time are changing per url of each image for example :
http://www.niederschlagsradar.de/images.aspx?jaar=-6&type=europa.precip&datum=201309161500&cultuur=en-GB&continent=europa
Next image url will be: http://www.niederschlagsradar.de/images.aspx?jaar=-6&type=europa.precip&datum=201309171500&cultuur=en-GB&continent=europa
The date and time change according to the loop just as it is in the website if you make right click on the image and make: Copy image URL you can see the time and date are change per image.
Comment: you can not open the image because in your code you are downloading a gif file which your code gives a *.jpg extension
Comment: unless you improve the it, posting the same question twice will not help you much. http://stackoverflow.com/questions/18805142/how-can-i-download-images-from-a-website-that-is-loop
Comment: Put some more information . Like is date time is randomly used or fixed . And y you r changing the extension at this point . I thought you have to download original image and it will open properly
Comment: The date and time are fixed per url in the loop.
Comment: Changed the line made the extention gif: localFilename + counter.ToString("D6") + ".gif" still can't open the file same error.
Comment: Then why you want to put date time dynamically. If they are fixed . Use the same value from above url .
Answer: I assume you mean that you get a URL of the form:
"http://www.niederschlagsradar.de/images.aspx?
    jaar=-6&type=europa.precip&datum=201309171500&cultuur=en-GB&continent=europa"

And you want to extract that date and time bit so you can compare it against a list of images that you already have. So in the above, you want to get the 201309171500.
You can do that with a regular expression:
string theUrl = @"http://www.niederschlahttp://www.niederschlagsradar.de/images.aspx?
    jaar=-6&type=europa.precip&datum=201309171500&cultuur=en-GB&continent=europa";

Match m = Regex.Match(theUrl, @"&datum=(\d{12})&");
if (m.Success)
{
    string theDate = m.Groups[1].Value;
    Console.WriteLine(theDate);
}

Additional info
If you look at the HTML from the original URL, http://www.sat24.com/foreloop.aspx?type=1&continent=europa#, you'll see some Javascript that looks like this:
var images = new Array(
    "http://www.niederschlagsradar.de/images.aspx?jaar=-6&type=europa.precip&datum=201309150000&cultuur=en-GB&continent=europa",
    "http://www.niederschlagsradar.de/images.aspx?
    // many more image URLs here
);

You need to download the HTML page, find that array in the HTML, and parse out the URLs for the individual images. Then you can download each image in turn.
Comment: Jim yes but the problem is that on the website each time the url is different. The date and time are different on each image in the loop on the website. So i can't put in the variable theUrl fixed url with fixed date and time. That's the problem to get each time the next image url.
Comment: There is animation on the website: http://www.sat24.com/foreloop.aspx?type=1 and if i put my mouse on the image it self on the animation make right click and make copy image url im getting each time url with different date and time. i need to save/download the images in the loop . Im not sure if its possible but the variable theUrl should be something like "http://www.niederschlahttp://www.niederschlagsradar.de/images.aspx?
    jaar=-6&type=europa.precip&datum=" + datetimevariable + "&cultuur=en-GB&continent=europa"


How do I integrate pyenv, poetry, and docker?

Question: Note: I have just started trying to learn docker, so I'm a beginner
Currently, I'm using poetry and pyenv to make my python project. I'm using pyenv for my python version, and poetry for creating and managing my python projects. But, I want to also use docker.
So, how can I can I integrate all 3 of these into a python project?
Comment: I don't know. I don't think you need _pyenv_ in the container. I also don't think you need _poetry_ in the container from my personal point of view. -- I mean, this is kind of an off-topic question for _stackoverflow_ since all answers will be very much based on personal opinions.
Comment: @sinoroc uh ok what about pyenv?
Comment: https://github.com/python-poetry/poetry/discussions/1879
Comment: @sinoroc I'm just using pyenv because sometimes the default system python isn't up to date.
Comment: @sinoroc and poetry is the package manager
Comment: Sure. But I don't know how to help you. The question "how can I can I integrate all 3 of these  [poetry, pyenv, docker] into a python project?" is way too broad to answer here. You need to pick a concrete question, that can be answered objectively.
Comment: @sinoroc you can make some edits then if you want
Comment: Typically in a docker container you only want one Python interpreter, so there is no need for pyenv. And typically in a docker container you only install pre-built wheels (look up "_wheel house_"), so no need for poetry. -- If you need multiple Python in docker containers, then you might want to have multiple docker images, 1 for each Python interpreter. -- Also try to figure out how to build a _wheel house_ of pre built wheels of your dependencies, and in your docker image only install those wheels with pip (no need for poetry at this point).
Answer: Not really a perfect solution, but I made it.
FROM debian:buster-slim

RUN apt-get update
RUN apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

ENV HOME="/root"
WORKDIR ${HOME}
RUN apt-get install -y git
RUN git clone --depth=1 https://github.com/pyenv/pyenv.git .pyenv
ENV PYENV_ROOT="${HOME}/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"

ENV PYTHON_VERSION=3.8.6
RUN pyenv install ${PYTHON_VERSION}
RUN pyenv global ${PYTHON_VERSION}

RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

WORKDIR /app

RUN apt-get install -y mecab-ipadic-utf8
RUN touch /usr/local/etc/mecabrc

COPY poetry.lock pyproject.toml ./
RUN /bin/bash -c 'source $HOME/.poetry/env && POETRY_VIRTUALENVS_IN_PROJECT=true poetry install --no-dev --no-root'

COPY . .

ENTRYPOINT [ "/bin/bash", "-c", "source .venv/bin/activate && uvicorn server:app --host=0.0.0.0" ]

See also this post.
Why pyenv
Apparently, apt-get install python3 installs python 3.7, which is also incomplete (no distutil). You cannot even pin .python-version to 3.8 or 3.9 or conda; which may error in one, but not another.
Why poetry
Poetry is just another neat way to manage dependencies, although alternate ways would be Pipfile; or just virtualenv with requirements.txt.
Comment: ***A.*** There are Docker images for specific Python versions, instead of _apt-installing_ things: https://hub.docker.com/_/python/ -- ***B.*** I would recommend avoiding installing _poetry_ in the docker container. Many possibilities. ***1.*** would be to `poetry export` outside of the container and then `python -m pip install -r requirements.txt` inside the container. ***2.*** Would be to create the _wheels_ outside of the container and `python -m pip install --no-index wheels/*.whl` inside the container.
Comment: @sinoroc Yes, I forgot about that. That is, if Debian or Alpine is enough. Or if you use only Python in that image. As you can see, I also installed MeCab, a native dep.


Dominated convergence theorem: Each $f_n$ have to be integrable in the assumption?

Question: The Dominated Convergence Theorem on Wikipedia does not assume each $f_n$ to be integrable (although it turns out they have to). However, the same theorem appears in Dudley's book seems to require $f_n$ to be integrable in the first place.

Let $f_n$ and $g$ be in $\mathcal{L}^1 \left(X,S,\mu\right)$, $\left|f_n(x)\right| \le g(x)$ and $f_n(x) \to f(x)$ for all $x$. Then $f\in\mathcal{L}^1$ and $\int f_n\,d\mu \to \int f \,d\mu$.

Is Dudley's book making a stronger-than-usual assumption?
As for why I am interested. It is true that if $\int |f|\,d\mu <\infty$, then $\int f \,d\mu <\infty$ and is well-defined. If we do not require $f$ to be integrable in the assumption, then simply consider $f\to f$ and it is dominated by $|f|$, which is integrable. So $\int f \,d\mu$ is integrable. But if we add the assumption that each $f_n$ needs to be integrable, then we cannot invoke this theorem in this problem. Another situation is where I want to explain if $|f| < M$, then it is integrable. I guess in both case I can go back to writing $f$ as $f^+ - f^-$, but just curious on how to use DCT.
Comment: Each $f_n$ is integrable because it is a measurable function such that $\int |f_n| \le \int g < \infty$.
Comment: @user296602 I think that is what I'm trying to show. No?
Comment: @iseliget Because, each $f_n$ is dominated by an integrable $g$, thus by comparison theorem, $f_n$ is integrable. It is an immediate consequence of the domination hypothesis.  Also, I don't understand what do you mean by "we cannot invoke this theorem in this problem", in _which_ problem, under what assumptions, in order to do what? Usually, DCT requires only some regularity conditions on each $f_n$.
Comment: @Raito I want to show that if $\int |f| \,d\mu < \infty$, then $\int f \,d\mu <\infty$. Let $f_n = f$, then obviously $f_n \to f$ By DCT on Wiki, since $f_n$ (which is really just $f$) is dominated by $|f|$, we conclude that $\int f \,d\mu <\infty$. However, if I use DCT in the quote, I run into trouble because it requires $f$ to be integrable, which is what I'm trying to show.
Comment: @Raito which puzzles me because the DCT that I know does not requite each $f_n$ to be integrable.
Comment: @iseliget Why do you use DCT for this basic property? Why not use $\lvert f \rvert ^{+}$ and $\lvert f \rvert^{-}$ like you mention it in your post? But, anyway, one version of DCT allows you to prove it this way, another version with a stricter hypothesis does not allow you to prove it this way. Either way, you should try to understand what DCT requires to be proved.
Answer: The requirement of $f_n$ to be integrable is irrelevant, because the hypothesis $|f_n|\leq g$ with $g$ integrable implies that $f_n$ is integrable. This is because for a positive function its integral is either finite or infinite, but always exists.
For a non-positive function $f$, for its Lebesgue integral to be defined we need that at least one $f_+$ and $f_-$ (its positive and negative parts) is integrable. Then, by definition, if $|f|$ is integrable then so is $f$.
For your final example, bounded implies integrable only on a finite measure space. But, in that case, again you don't need DCT but only the definition of "integrable".
Comment: Thank you very much. I shall read on this topic more deeply. As a statistics student, we almost always deal with probability space which is finite measure space. Probably that's the point I was missing.


SQL Query txt file named currentdate

Question: in brief
That:
bulk insert Table
from '**C:\PATH\ currentdate_time.txt**'
with (fieldterminator = ',', rowterminator = '\n')

is what i want to do in MSSQL.
example : 13.03.2014_15:18.txt
Comment: Eh? Surely you have to know the file name before you go in? Current date and time seem to have nothing to do with the problem
Comment: Colon `:` isn't a legal part of file names.
Comment: On that note YYYYMMDDHHMM.txt would be a far more useful format as well.
Answer: Something like
Declare @sql varchar(1000)
set @sql = 'Bulk insert ' + @Table + ' from ''' + @file + ''' with (fieldterminator = '','', rowterminator = ''\\n'')'

Exec(@sql)

@Table and what @File would have to come in as arguments, say to a Stored Proc, or a statement.

SQL Query txt file named currentdate


How to import a 2D Array into a JTable from a CSV file

Question: I am trying to implement a text file database system through a CSV file into a Java GUI, I have created the GUI, the database, the methods required to import and export to the file, and the method to convert the information into a 2DArray from the CSV file. I am trying to make a simple password vault but whenever I try adding something to the file I get an error stating:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at TextFileDatabase.readDatabase(TextFileDatabase.java:93)
    at PasswordVault.<init>(PasswordVault.java:97)
    at PasswordVault.main(PasswordVault.java:22)

The method that is returning the error is the readDatabase() one and it is as follows:
public static String[][] readDatabase()
    {
        try
        {
            kb = new Scanner(database);
        }
        catch(FileNotFoundException e)
        {
            e.printStackTrace();
        }

        //since the size of the database is unknown, we'll first work in a temporary 2D arraylist that can dynamically change its size
        ArrayList<String[]> tempDatabase = new ArrayList<String[]>();

        while(kb.hasNext())
        {
            String tempLine = kb.nextLine(); //reads the first/next line of the database
            String[] tempData = tempLine.split(","); //gets that result as a string, splits it up into an array based on commas
            tempDatabase.add(tempData); //adds the string array to the arraylist
        }

        //at this point, the while loop should have traversed through the entire file

        String[][] output = new String[tempDatabase.size()][3];
            //this is the string we'll return
            //the column size is the size of the tempDatabase arraylist because thats the number of passwords we have stored
            //the row size is three because each row is an 1) app, 2) password, 3) description

        //converts the ArrayList to the actual output array

        for(int x=0; x<output.length; x++)
        {
            for(int y=0; y<3; y++)
            {
                //This is line 93 in TextFileDatabase()
                output[x][y] = tempDatabase.get(x)[y];
            }
        }

        return output;
    }

and it is pointing to this section of code in my PasswordVault() class
        //This is line 97
        String[][] data = TextFileDatabase.readDatabase();

        //This will convert the information from the 2DArray made from the file into a table model to use in the GUI
        for(int a = 0; a < data.length; a++)
        {
            String[] row = new String[data[a].length];

            for(int b = 0; b < data[a].length; b++)
            {
                row[b] = data[a][b];
            }

            tableModel.addRow(row);
        }

And the last line the error calls to is just the line calling the PasswordVault() constructor
new PasswordVault();

Comment: *//This is line 97* - yes, well the problem is on line 93 of your TextFieldDatabase class in the readDatabase() method.
Comment: @camickr thank you for that, what is wrong with it
Comment: I have no idea. I don't know what line 93 is. Do some basic debugging and see why the array is empty. Why are you trying to convert to a 2D array? Just keep each row of data in the ArrayLIst. *the while loop should have traversed through the entire file* - don't add a comment in your code. Do some debugging to see the size of the ArrayLIst to make sure there is data.
Comment: @camickr "output[x][y] = tempDatabase.get(x)[y];" is line 93 as I stated in the comment, I am converting to a 2d array so I can convert it into a tableModel
Comment: *as I stated in the comment* - yes, will given you have all kinds of comments in the code that line doesn't stand out. 1) Again, what debugging have you done? We don't have access to your data. Did you verify data was read into the ArrayList? Did you verify the size of the Array created by the split() method? 2) There is no need to convert it to a 2D array to add the data to the TableModel. You just use iterate through the ArrayList and invoke the addRow(…) method for each row in the ArrayList.
Comment: @camickr When I run the debugger, I get the error "[[App Name, App Password, Description], [null, null, null]]".
Comment: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/210842/discussion-between-blake-and-camickr).
Answer: The problem is here:
output[x][y] = tempDatabase.get(x)[y];

TempDatabase try to access a inexistent location. You have 3 elements em ALL strings[] inside tempdatabase? Check it.
Comment: what do you mean by that


Block rendering gets skipped in included template chunk

Question: I'm willing to include a shared code block to templates that extend a different template.
Here's a page that gets rendered and 2 variants of the base template.
page.html:
{% extends "base_form.html"%}
{% block legend %}legend{% endblock %}

Variant 1:
base_form.html:
{% extends "base.html"%}

    {% block body %}
        {% block legend %}{% endblock %}
    {% endblock %}

rendered:
legend

Variant 2:
base_form.html:
{% extends "base.html"%}

    {% block body %}
        {% include "chunks/form.html" %}
    {% endblock %}

chunks/form.html:
coming from a chunk
{% block legend %}{% endblock %}

rendered:
coming from a chunk

So the block gets skipped in the second case. Oddly enough, everything works with django-debug-toolbar enabled.
A bug?
Answer: Looks like this is a known issue - there's a ticket for it which is marked as accepted in Django's bug tracker.


Can receive achievements I missed while playing Need For Speed Payback offline?

Question: I finished the story mission "Double or Nothing" in Need For Speed Payback while disconnected from Xbox Live. Afterwards, I realized I never unlocked the achievement of the same name. I confirmed on TrueAchievments that the achievement is earned from finishing that mission with no other written requirements.
Would replaying this mission allow me to receive the missing achievement? Likewise, is there an achievement for completing Chapter 4: Open Skies? If there is, would it be possible to re-earn that too?
Answer: In contrast to what TrueAchievements states, it is necessary to finish the Double or Nothing race and complete the next mission where you Meet the Broker to earn the Double or Nothing achievement. This was not an issue with Xbox Live, but rather that I didn't complete enough missions to close out the chapter and earn the achievement. This also answers my question of whether there is an achievement for finishing Chapter 4: Open Skies. The Double or Nothing achievement meets both criteria.


Updating view from recyclerview adapter using MVP pattern

Question: I have a fragment called "OverviewFragment" and i have a presenter and Contract for it. I am creating a recyclerview adapter from "Overview fragment".
I have certain doubts regarding how to populate content inside the recyclerview. I have read that an adapter should only act as a View in MVP.
But I have certain conditions to be satisfied to display the contents inside recyclerview. Where should i write this business logic?
Also there are answers in SO that we should not create presenters for viewholder. So basically i need to write business logics inside adapter to populate contents in recyclerview or I need to link that to "overview" fragment and then do the business logic in the fragment presenter.
Which is the correct method?
Answer: This is how I solve this prob. First all business logic located in Domain level, but you can create any other abstraction level to map your Data Models to View Layer Models.
So only specific models located in presentation level. Then our adapter looks like this:
class CustomerCardsAdapter(
    var cards: MutableList<ListItem> = mutableListOf()
) : RecyclerView.Adapter<CustomerCardsAdapter.ItemViewHolder>() {

    lateinit var cardItemClick: (cardId: ClientCard) -> Unit

    override fun getItemViewType(position: Int) = cards[position].getListItemType().ordinal

    override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): CustomerCardsAdapter.ItemViewHolder {
        val resId = when (ItemType.values()[viewType]) {
            ItemType.CARD -> R.layout.card_item
            ItemType.SIMPLE_ITEM -> R.layout.account_simple_item_view
            else -> throw IllegalArgumentException("viewType = $viewType create not support")
        }
        val view = LayoutInflater.from(viewGroup.context).inflate(resId, viewGroup, false)
        return ItemViewHolder(view)
    }

    override fun onBindViewHolder(viewHolder: ItemViewHolder, position: Int) {
        val item = cards[position]
        when (item.getListItemType()) {
            ItemType.CARD -> viewHolder.populateCard(item)
            ItemType.SIMPLE_ITEM -> viewHolder.populateSimpleItem(item)
            else -> throw IllegalArgumentException("viewType = ${item.getListItemType()} create not support")
        }
    }

    override fun getItemCount() = cards.size

    inner class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

        fun populateCard(item: ListItem) {
            with(itemView as CustomerCardView) {
                val card = item as ClientCard
                populate(card)
                setOnClickListener { cardItemClick(card) }
            }
        }

        fun populateSimpleItem(item: ListItem) {
            with(itemView as SimpleItemView) {
                val simpleItem = item as SimpleItem
                populate(simpleItem)
                setOnClickListener { simpleItem.action() }
            }
        }
    }
}

So onCreateViewHolder just inflates Views and onBindViewHolder method calling ViewHolders methods to populate data.
RecyclerView items inherited from View classes and contains logic to actually present our data to Views.
private const val CORNER_RADIUS = 4f
private const val SHADOW_ALPHA = 60

class CustomerCardView
@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
    : LinearLayout(context, attrs, defStyleAttr) {

    private val imageCard by bind<BlurryCardView>(R.id.card_image)
    private val cardNumberTextView by bind<TextView>(R.id.card_number_text_view)
    private val imageIps by bind<IpsImageView>(R.id.card_image_ips)
    private val cardNameTextView by bind<TextView>(R.id.card_name_text_view)
    private val cardActivateView by bind<View>(R.id.card_activate)
    private val cardBlockView by bind<View>(R.id.card_unblock)
    private val imageContactlessPayView by bind<ImageView>(R.id.image_contactless_pay)
    private val smsNotificationsView by bind<ImageView>(R.id.image_sms_notifications)
    private val shadowView by bind<ShadowContainer>(R.id.card_shadow)

    fun populate(card: ClientCard) {
        with(card) {
            cardNameTextView.text = name
            cardNumberTextView.text = when {
                isNotActiveOnlyTokenization -> context.getString(R.string.card_is_not_active_only_tokenization)
                isTokenizationNotActivation -> context.getString(R.string.card_is_tokenization_not_activation)
                isTokenizationAndActivation -> context.getString(R.string.card_is_tokenization_and_activation)
                isBlockedToken -> context.getString(R.string.card_is_blocked_token)
                !isActivated -> context.getString(R.string.card_not_activated_text)
                supportsUnblocking() -> context.getString(R.string.card_blocked_text)
                isActivated && !supportsUnblocking() -> {
                    maskLast4Symbols(number)
                }
                else -> maskLast4Symbols(number)
            }
            imageContactlessPayView.setVisibility(tokens.isNotEmpty())
            smsNotificationsView.setVisibility(isAlfaCheck)

            populateCardImage(card)
        }
    }

    private fun populateCardImage(card: ClientCard) {
        imageCard.setCornerRadius(CORNER_RADIUS)
        shadowView.shadowParams.shadowAlpha = SHADOW_ALPHA
        post {
            val url = ImageUrlFactory.createUrl(card.cardType, imageCard.width, imageCard.height)
            imageCard.populateImage(url, {
                imageIps.populateWhite(card.ips)
                changeVisibility(card)
            })
        }
    }

    private fun changeVisibility(card: ClientCard) {
        with(card) {
            val blocked = (isLocked && isActivated && !isNotActiveOnlyTokenization) || isBlockedToken
            cardActivateView.setVisibility(card.showIsNotActiveIcon())
            cardBlockView.setVisibility(blocked)
        }
    }
}

Comment: I am not so familiar with Kotlin, i am using Java. but i understood till what you are doing inside your viewholder, but when you are inheriting View class, how are you getting Context in there?
Comment: @emilpmp Android View class have method getContext - which is actually context of activity in which window this View located.


"MapiLogonProvider: Network error" with Exchange MAPI Connector

Question: Using Ubuntu 12.04, and Exchange MAPI plugin for Evolution. I have specified the server as an IP address (as found with Google) however when I try and authenticate I get:
"MapiLogonProvider: Network error"
How can I fix the problem?
Thanks
Answer: I have eventually found the reason for this. We have a multi-server exchange setup, and its important to use the address of the exchange server in the configuration that has your mail, and not the server that's configured to do outlook web access.


how to retrieve mobile website html source code, android

Question: I want to retrieve html source code from a mobile version website,
<code>String url = "m.kitco.com";
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);
InputStream in = response.getEntity().getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
</code>
however, the source code that I could get was only the full site source code instead of mobile version. It seems like the web server automatically forward the link to full site.
How can I force it to retrieve the mobile website html source code?
Answer: You need to add android user agent for example
<code>  request.setHeader("User-Agent", "Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30");
</code>


Mobile Tables - Accessibility (iOS vs Android)

Question: iOS - Disclosure Indicators

When this element is present, users know they can tap anywhere in the row to see the next level in the hierarchy or the choices associated with the list item. Use a disclosure indicator in a row when selecting the row results in the display of another list.
Don't use a disclosure indicator to reveal detailed information about
  the list item; instead, use a detail disclosure button for this
  purpose.

Android:

Don't use right-pointing carets on line items

My question is if Android does not use anything close to a 'Disclosure Indicator' how do they pass Accessibility Guidelines? How does a screen reader indicator to a disabled user on Androids that each item is clickable without an indicator or having the text be a different color?
I'm currently having these conversations with my UX team and developers and it is not clear how Android gets away with such a simple approach and not run into Accessibility issues?
Would love any thoughts or information concerning what is outlined above.
Answer: On Android:

a Button should look like a Button, which has affordances to hint that it is a button and thus clickable.
list items in Android are expected to be clickable by default.

To be honest, this is very shallow stuff to get hitched on. Consider long-presses on Android, there are no affordances for that yet long-press and CAB is really the right way to handle multiple selections on Android. Ask your UX Team what CAB means, if they cannot answer then offer them advice rather than taking it from them.
Comment: Seems a little tone deaf to call a question involving accessibility 'shallow stuff'.
Comment: I answered your question and pointed out that there is far more depth to such interactions in Android, making comparisons to simple interactions on iOS without understanding the depths in Android makes the whole question rather shallow. I hope that your pride does not hamper your ability to receive and process new information.


Show that logarithm of Dirichlet function is Lebesgue measurable

Question: I have $\ln (D(x)+1) $. What is the way to prove , that this is a Lebesgue measurable function ?
Comment: What is $D(x)$?
Answer: If f is continuous and g is  Lebesgue measurable, $U$ open in $\mathbb R$:
$(f \circ g) ^{-1}(U)=g^{-1}\circ f^{-1} $ Since $U$ is open and $f$ is continuous and $g$ is measurable, we conclude the composition is....
Answer: $D$ is measurable for first. Then $D+1$ is measurable because of the composition of the continuous map $u\rightarrow u+1$ with $D$, and $\ln(D(x)+1)$ is measurable because of the composition of the continuous map $v\rightarrow\ln v$ with $D(x)+1$.


Exercise (and consequence) for Explicit Riemann Mapping

Question: Set $V:=D_1(e^{\frac{i\pi}{6}})\cap D_1(e^{-\frac{i\pi}{6}})$. Find the (unique) explicit conformal function $f:V\rightarrow \mathbb{C}$ such that $f(V)=\mathbb{D}$ with $f(1)=0$ and $f'(1)>0$.
This result must be a consequence for my first problem here which say that any angular section $U=\{ z\mid-\alpha<Arg(z)<\alpha\}$ ($0<\alpha<\pi$) have a unique conformal function that send it to $\mathbb{D}$. If there exists another way please give me hint, I don't know how to attack this problem.
Answer: Remember that from the viewpoint of the Riemann sphere, circles and straight lines are the same.
The angular sector $U_\alpha = \{ z : -\alpha < \operatorname{Arg} z < \alpha\}$ is a domain bounded by two line segments (circular arcs on the sphere) intersecting in $0$ and $\infty$.
The domain $V = D_1(e^{\pi i/6}) \cap D_1(e^{-\pi i/6})$ is bounded by two circular arcs intersecting in $0$ and $\sqrt{3}$.
If you apply the Möbius transformation mapping $0\mapsto 0,\, 1 \mapsto 1,\, \sqrt{3}\mapsto \infty$ to $V$, what do you get?
Comment: I get $U_{\pi/6}$... so simple! Thanks man.


Are assets affected by any game randomization logic?

Question: Let's say I buy the Nightclub Truck asset, which gives me a truck to pick up the cash, right behind the office where the vault is found, which helps a lot since the crew doesn't have to run the streets carrying the bags of cash.
Is there any randomization effect over this/all assets?
Let's say, in this case, the time for the truck to arrive.
Or if you buy a certain chopper to make your job easier, will the spot where arrives be the same every run or can it spawn somewhere else?
Comment: From what I've seen in the game, selecting each asset in the setup brings up a map that shows you where the asset will be.  I would think it's the same each time.
Comment: Ace Pilot from Day 3 of Rats, for instance, only shows a picture of a Heli Pilot smoking with a brown sexy mustache. Thats it
Answer: NOTE: This answer was written for an old version of the game (around update #15) and might not be accurate anymore.
Some assets are, some are not affected by random chance.

Blueprints,
insider info,
keys,
bag shortcuts,
additional roof access,
bad music,
extra helicopter fuel,
armored vehicle,
floodlights,
ammo and doctor bags and
shutter codes

have no random elements to them, but

Ace Pilot pickup location can change and
camera access location can change.

(This list is probably far from complete)


List first or null item

Question: I'm getting a list and I want the first item or null value. So I made this var foundedItem= db.FindMyItem(new Dictionary<string, string> { { "Name", name} })?[0];
I have an error just on this line. It return "Index out of range" but I'm using "?" so it need to return me null value right ?
Comment: What is the content of FindMyItem?  What is db?  Too many missing details here.  Show your code and at minimum a MVCE.
Comment: So you're asking how to display a *tutorial*? A *splash screen* with news? Seriously, with so many downvotes you should realize the questions you post are bad. It's not the use of English, it's the question itself
Answer: use LINQ query.
var result = myListItem.FirstOrDefault();

Answer: Your Question :
var foundedItem= db.FindMyItem(new Dictionary<string, string> { { "Name", name} })?[0]

function Dictionary<string, string> FindMyItem(string Id){
    return db.Items.Find(Id);
}

With this approach you do not want the list :D

List first or null item


How to get the final URL from a redirect in AS3?

Question: I need to get the final URL from a link that gets redirected. (e.g. if someone is using a URL shortener)
bit.ly/foobar ->redirect-> http://example.com

What the fastest way to do this in AS3?
Thanks you
Comment: @Marcela Yes, an AIR solution would work also for me! :)
Answer: Since you are using AIR, you can listen for an HTTPStatusEvent.HTTP_RESPONSE_STATUS event:
var urlLoader:URLLoader = new URLLoader(new URLRequest("http://bit.ly/1bdDlXc"));
urlLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, urlLoader_httpResponseStatus);

function urlLoader_httpResponseStatus(e:HTTPStatusEvent):void
{
        trace(e.redirected, e.responseURL);
}

The result of the above trace is true http://www.google.com/
This event gives you information about whether the URL was redirected and what the new URL is.


What does the level 3 boss say?

Question: At the end of level 3 of this classic arcade game you fight the green ninja, a boss who can split into multiple copies of himself.
Before he does this, he says.. something.
Does anyone know what he says?  (and preferably an English translation, as my Japanese is a little rusty)
Comment: I didn't know the game before but now I really want to know what he says too :/ You mean the "Owanjitsuac" sounding thing, right?
Comment: Aye, that's it.  If I find out that it's just gibberish, I'm going to squeal!
Comment: should go to the japanese language SE chat and ask them to come take a look
Answer:
Sho daijitsu wasu

It means "multiple targets", or in that context it's the spell name or action he is using to multiply himself.
Answer: According to this video:

 nothing?
It seems it's the protagonist character saying "I'm Bad!".
Comment: I want to downvote the text and upvote the video.
Comment: It's the bit at 2:08.  The level 3 boss.
Comment: That sounds like non-English, maybe Japanese, with some reverb. It also sounds like he says it repeatedly, once each time he makes clones.
Answer: Considering most of the sound effects in the game seem to be either english or just screams and effects, I'm going to assume the ninja is speaking in English as well.
Based on that, the best I can do is hearing 'Watch this one!' as if he's about to show you something kickass. (Which he does, he clones himself a bunch of times)
Comment: By the same token, you could say that Ryu is saying "How do, Ken?" in Street Fighter 2.

I'm hoping a Japanese speaker can give me a definitive answer to the question that's been bugging me for the last 25(!) years.
Comment: First of all, your example doesn't make sense in the context of the game. Why would a guy ask how someone is doing when shooting an energy blast? When not even facing that guy? Second of all, it's not even certain what language the ninja is speaking in. But to each his own I guess.
Comment: I'm assuming, as it's an 80s ninja game, that the guy is speaking Japanese but as my question indicates, I really have no idea.   I know what he's saying -sounds like- (and can do a chillingly accurate version myself) but after all this time, I just want someone to give me a definite answer. I'd hate to go to my grave with this still unknown.

What does the level 3 boss say?


Furnace running.Shuting off for a few mins then starting again.Continued process

Question: Why would my furnace run it's cycle, shut down and then start up again a few minutes later. Continuing this cycle all night?? Thanks
Comment: How long does it stay on each cycle? What is the thermostat set at? What is the outdoor temperature? How old is your home? Is the home drafty? Does the furnace display any error codes? What is the make and model of the furnace?  Is it exceptionally cold outside in your area?
Answer: If the home is maintaining the temperature set on the thermostat (at least AT the thermostat) then it's probable that you are near, but not quite at, "design load" for the furnace. At design load, the furnace runs 100% of the time to keep up with heat loss in the house and maintain temperature - if it gets colder than that outside (below the "design temperature"), the house gets colder than set. At anything less than design load, the furnace runs a fraction of the time, and is off a fraction of the time. The closer the outside temperature is to "design temperature" the longer the run time and shorter the off time. As it gets warmer outside, the off time increases and the run time gets shorter.
Anything that makes the house lose heat faster raises the effective design temperature (doesn't change what temperature was assumed to design it, but alters the actual one.)
Anything that makes the house lose heat slower lowers the  effective design temperature (doesn't change what temperature was assumed to design it, but alters the actual one.)
If the house is NOT maintaining the set temperature AND the furnace is shutting off regularly, something may be in need of maintenance/adjustment.
Answer: As Ecnerwal said, your furnace cannot keep up with heating your home. This could be caused by a number of things.

Your furnace itself is inadequate and cannot keep up with the load. The rating in BTUs is not high enough.
There are inefficiencies in your home which is causing the furnace to work harder than it was designed to.

The furnace requires service.
Insulation in your home may be inadequate.
There could be air leaks and drafts caused by old windows, doors, etc.
Too many leaks in the duct work are causing heat loss.

You are trying to maintain a temperature that is too high for the furnace to handle.

There are a number of services available that will come into your home and do an energy audit. They will be able to figure out what issues you have in your home. They will do tests like the blower door test to determine how many air leaks you have. They also have special tools such as thermal cameras that can see where the heat loss is. They will also inspect your insulation to see if it meets code. I would also recommend that you have a technician come in and service your heating equipment.
Answer: Thank you all for your replies. The issue was simple. My filters were clogged. First thing I should have looked at. Obviously with the dust build up, not enough cool air was coming in to transfer


Are .NET Generic collections slower in multi threading environment

Question: Couple of days ago, I turned up for c#.net developer interview in stock based company where their application had to give frequent updates within second. So, Interviewer told me that acquiring lock or providing thread synchronization on .NET Generic collection like List, Stack, Dictionary is very much slow. So, they use their custom collection.
So, I was wondering "Are .net collection really slow when acquiring locks and releasing locks and even if they are slow, then how we can improve that performance by writing custom  generic classes"
Comment: It's not that the collection is slow. `lock`s are.
Comment: Writing your *own* custom thread-safe collection sounds like a really, really bad idea. Use a collection from System.Collections.Concurrent instead.
Comment: Use a collection in a thread-safe way.  It doesn't sound like a company I'd want to work with if they're disparaging a class for using it incorrectly--in an interview.  Whatever "stock based" means...
Comment: In addition to `System.Collections.Concurrent` take a look at [immutable collections](http://blogs.msdn.com/b/bclteam/archive/2012/12/18/preview-of-immutable-collections-released-on-nuget.aspx).
Comment: There are other reasons, in addition to what MarcinJuraszek pointed out. Mutable collections not optimized for concurrent use usually have to be locked for any kind of access, even reading, whereas concurrent collections may only need to be (internally) locked for writing, or may not need to be locked at all. Regular collections are just unsuitable. However, as JonSkeet pointed out, there are built-in concurrent collections without these issues.
Comment: All, my question is that why lock is slower on .NET Collection, is there any way to achieve synchronization with mutable objects in a more faster way than  what lock provides
Answer: Generics and multi-threading have nothing to do with each other. Given that, I'm not sure what you are asking.

Are .net collection really slow?

...is unanswerable because performance is relative.

how we can improve that performance by writing custom generic classes

You can't because generics have nothing to do with this. You can improve performance by writing custom collections that are tailored to the very specific needs of an application. It is rare that this is a good idea but it can be. For example it is easy to create a class that is faster than the built-in List<T>. Take List<T> as a template and remove all the iterator versioning logic to remove some overhead. This small win is rarely worth the cost.
In case you want advice: Try to use the built-in collections. There's a System.Collections.Concurrent namespace for synchronized ones.
Given the information that we have it is impossible to tell whether it was right or wrong for your interviewer to build custom collections.

my question is that why lock is slower on .NET Collection

You can only use lock with .NET so I'm not sure what you are asking here. Also: Slower than what?

is there any way to achieve synchronization with mutable objects in a more faster way than what lock provides?

Often, that is possible. How this is done depends entirely on the concrete case. If there was a general way to do what lock does but faster then we would not need lock in the first place.
I'm trying to help you by collecting all the different questions you have asked and addressing them. I think if you had asked fewer, more precise questions you would have found the answer yourself or recognized that some questions do not make much sense. Asking the right question often leads to the answer.
Comment: thanks for the clarification and sorry for not posting a succinct question as I was also in confusion. By the way thank you once again


Test react components in Rails with capybara/spinach

Question: I'm building a Rails app which uses React components for layouts, here you can see an example
.pure-g.homepage
  = react_component("SectionA", {foo: @bar}, class: "pure-u-1")
  = react_component("SectionB", {foo: @bar}, class: "pure-u-1")
  = react_component("SectionC", {foo: @bar, foo2: @bar2, foo3: @bar3}, class: "pure-u-1")

I'm triying to test this with spinach, but it's looks like the components aren't rendering in the test, i want to know if there's a way to test React components with spinach and if there is, what i'm missing?
Here's my rails_helper.rb
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
# Add additional requires below this line. Rails is not loaded until this point!
require 'rspec/rails'
require 'support/factory_girl'

# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Checks for pending migration and applies them before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
  config.include RSpecFeaturesHelper, type: :feature
  config.include Devise::TestHelpers, type: :controller
  config.include ControllerHelpers, type: :controller
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  config.fixture_path = "#{::Rails.root}/spec/fixtures"

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  config.use_transactional_fixtures = false

  # RSpec Rails can automatically mix in different behaviours to your tests
  # based on their file location, for example enabling you to call `get` and
  # `post` in specs under `spec/controllers`.
  #
  # You can disable this behaviour by removing the line below, and instead
  # explicitly tag your specs with their type, e.g.:
  #
  #     RSpec.describe UsersController, :type => :controller do
  #       # ...
  #     end
  #
  # The different available types are documented in the features, such as in
  # https://relishapp.com/rspec/rspec-rails/docs
  config.infer_spec_type_from_file_location!

  # Filter lines from Rails gems in backtraces.
  config.filter_rails_from_backtrace!
  # arbitrary gems may also be filtered via:
  # config.filter_gems_from_backtrace("gem name")
  <ReactOnRails::TestHelper class="configure_rspec_to_compile_assets">
    <config></config>
  </ReactOnRails::TestHelper>
end

Answer: Capybara includes support for RSpec and Cucumber switching to the driver specified in Capybara.javascript_driver based on metadata specified on each test.  It doesn't have any support for Spinach built-in though.  If you want to be able to specify which driver gets used per test you will need to implement the equivalent of the two Cucumber before hooks implemented here - https://github.com/teamcapybara/capybara/blob/master/lib/capybara/cucumber.rb#L17 - for Spinach, and then specify that specific tests need JS.  If you just want all the Capybara driven tests to use the JS capable driver, you should specify default_driver rather than javascript_driver
Capybara.default_driver = :poltergeist

Note: The current release version of PhantomJS - 2.1.1 (used by Poltergeist) only supports ES5 max, so for it to work well with React you need to make sure ALL your JS is getting transpiled to ES5 compatible.  It is also limited in what CSS it supports, being basically equivalent to a 7 year old browser.  A better (in terms of JS/CSS support) solution today is to use Chrome headless with selenium for testing which, if using the latest Capybara, can be specified with
Capybara.default_driver = :selenium_chrome_headless

Comment: Great answer, you confirmed my thoughts and gave a nice solution, thanks!


I want to create a Server on a Dell T5400 with two processors

Question: After watching many YouTube videos, I find that the Ubuntu website is not user-friendly, at least to this user.  I have used Mint on another computer; but I want to try to create my own server.  I can't figure out how to choose the right options in the download section.  I asssumed that my Dell would be able to handle the job; but the four options for downloading Ubuntu Server stop me before I can get anything done.  I am trying to use a RAID configuration.  Any help would be appreciated.
Comment: What is your question?
Comment: I suggest using the [Ubuntu Serverguide](https://ubuntu.com/server/docs), in particular the [installation - storage -raid section](https://ubuntu.com/server/docs/install/storage).
Comment: should work just fine
Answer: Thanks for the answers, everyone.  My question was actually about how to simply download Ubuntu.  The screens presented matter that confused me.  Technical terms that are of no interest to me were presented as if they had something to do with my download. I didn't expect that in the Linux world; but I am reminded that Canonical is a business.  So my apologies if I have wasted anyone's time.  I think I did finally do the download correctly.  The things that confused me were not related to my reasons for being on the download page.  Thanks to the person who offered the links.  They are helpful.  Have a great day everyone.


Needing to call stub() and should_receive() in rspec for a view partial spec

Question: I have been having some confusion with should_receive() in rspec (v2.8)
My understanding was that it both stubbed the method - just like stub() does - and sets the expectation that this stubbed method will be called.
However, whilst trying to use it to stub out a helper method being called from a view partial, I kept getting the error:
Failure/Error: render 'invitations/header'
 ActionView::Template::Error:
   undefined method `require_javascript' for #<#<Class:0x7fe21d03d9f8>:0x7fe21cfd0c40>

In the end, I had to add in a stub() method as well to make the test succesfully pass. This code is shown below - when I remove the before block, I get the errors shown above.
describe 'invitation/header' do

  before do
    view.stub(:require_javascript)  # Why is this required ?!
  end

  it "should initialize the expandable section javascript" do
    view.should_receive(:require_javascript).with('expandable_section')
    render 'invitations/header'
  end

  ...
end

Note that I have many other tests in this file, none of which require the stub() method to successfully pass. So I am confused why I need it in this situation ?
Comment: You're stubbing `require_javascript_with_initializer` but you're passing `require_javascript` to `should_receive`. So it's not really clear what's going on here, which may be why you got no responses. Either explain a bit more about what you're doing or add relevant code.
Comment: Sorry - Copy paste error - fixed it now !
Answer: When you remove that stub your test is failing because it expects that view.should_receive(:require_javascript).with('expandable_section').
Stubbing means you are basically ghosting a method call. When you render the view your "stub" acts as if that method would actually return something.
You can read more here: https://relishapp.com/rspec/rspec-mocks/v/2-4/docs/method-stubs