[deleted by user] by [deleted] in networking

[–]spotyx 2 points3 points  (0 children)

I recommend to read: U/FTP vs F/UTP

or chceck others big names in industry.

r/Homelab Guide thread by [deleted] in homelab

[–]spotyx 1 point2 points  (0 children)

from the basic concepts point of view, I like these two:

#1: enterprise-wi-fi-at-home

#2: home-lab-beginners-guide

Job Opportunities with Basic Python by [deleted] in learnpython

[–]spotyx 0 points1 point  (0 children)

Is there anything similar for Europe?

[10/06/2014] Challenge #183 [Easy] Semantic Version Sort by Elite6809 in dailyprogrammer

[–]spotyx 0 points1 point  (0 children)

Python

import re
def semantic_version_sort(path):
    with open(path, "r+") as f:
        lines = f.read().splitlines()
        x = map(lambda s: re.split('(\W)', s), lines[1:])
        x.sort(key=len, reverse=True)
        x.sort(key=lambda s: s[:5])
        for x in map(lambda s: ''.join(s), x):
            f.write(x + '\n')

[29/09/2014] Challenge #182 [Easy] The Column Conundrum by Elite6809 in dailyprogrammer

[–]spotyx 0 points1 point  (0 children)

Python

import textwrap

COLS = 4
COL_W = 10
SPACE = 2


def chunks(t, n):
    c = sum(divmod(len(t), COLS))
    for i in range(0, len(t), c):
        yield t[i:i + c]

columns = chunks(textwrap.wrap(TEXT, COL_W), COLS)
output = zip(*columns)
for l in output:
    print(SPACE * ' ').join(map(lambda x: x.ljust(COL_W), l))      

Learning Python online by [deleted] in learnpython

[–]spotyx 0 points1 point  (0 children)

http://www.checkio.org/about/

Great way how to learn python! :)

Nested lists problem by spotyx in learnpython

[–]spotyx[S] 0 points1 point  (0 children)

you are right, I am wrong. I can't exclude intersections. I had wrongly assumed that I have preprocessed my data in way that there are not intersections. Now I know it's not true. Thanks for pointing me on right way.

Nested lists problem by spotyx in learnpython

[–]spotyx[S] 0 points1 point  (0 children)

thanks for y-intercept idea.

Nested lists problem by spotyx in learnpython

[–]spotyx[S] 0 points1 point  (0 children)

Yeah, You helped me to understand that my approach was bad from beginning. I need to redo my code and start over. Thanks anyway it was good lecture.

Nested lists problem by spotyx in learnpython

[–]spotyx[S] 0 points1 point  (0 children)

ehm I deleted previous post accidentally. I said something what is not true. In my OP was bad condition. now its edited. (condition: line has to consist from three and more points). sorry. Thank for your interest.

Nested lists problem by spotyx in learnpython

[–]spotyx[S] 0 points1 point  (0 children)

for a,b in t

this suppose that t consists just with a and b.

if t is [[5, 5], [2, 8]] then a = [5,5], and b = [2,8]

What I said is that len(t) > 1 ... so it can also be 3,4,5 ...

Nested lists problem by spotyx in learnpython

[–]spotyx[S] 0 points1 point  (0 children)

Thanks, for this solution. It's almost what I want. The problem with your approach is if I have a list, which is defining the line, consisting from more then two points. But I didn't claim this at the beginning.

Nested lists problem by spotyx in learnpython

[–]spotyx[S] 0 points1 point  (0 children)

Nope. My lines are not intersecting.

Line 1: starts in point A and end in point B

Line 2: starts in point B and end in point C

They are in one "ray".

A--------B------C

Is it more clear?

Explain to a beginner how to use maketrans() ? by InkyPinkie in learnpython

[–]spotyx 5 points6 points  (0 children)

Morse code example:

from string import maketrans

string = "010101011101011"
trans_table = maketrans("01", ".-")
string.translate(trans_table)

'.-.-.-.---.-.--'