I had like 8 terminal windows open monitoring logs. A coworker of mine asked what are those I explained her for like 5 minutes and her question was: Why is the text green?
@khajvah That's a natural reaction. Ordinary people are scared when they see a terminal window, and even more so if the text in it is green - she's probably assuming you're a hacker now.
But if she wants a sensible answer, the lower contrast of green text on a black background (I hope your background IS black!) reduces the contrast and therefore eyestrain.
@Cro Please note that neither SO nor this chat are a “give me code” service. If you didn’t find examples using Google, chances are very high that nobody here will be able to give you one as well. You are welcome to ask questions about specific problems you encounter while working on something yourself, but please refrain from repeatedly asking for some code.
In addition, live streaming is kind of a complex topic, so I doubt this would even remotely work with some simple code snippets. And in addition to actually streaming the data as a client, the server has an even more complex job. And without knowing how the server works, what protocols it uses etc, it’s impossible to say anything about the client.
That being said, if you want video livestreaming, you could look into HLS which is a TCP and HTTP based streaming protocol, which is not too difficult to implement.
@Cro for your information: people under the age of 13 can't be users of Stack Overflow. If anyone discovers that a user is below 13, they have to destroy the account. Whether they like it or not. So...nobody should probably want to admit to being under 13.
The Children's Online Privacy Protection Act of 1998 (COPPA) is a United States federal law, located at 15 U.S.C. §§ 6501–6506 (Pub.L. 105–277, 112 Stat. 2681-728, enacted October 21, 1998) 19 years ago.
The act, effective April 21, 2000, applies to the online collection of personal information by persons or entities under U.S. jurisdiction about children under 13 years of age. It details what a website operator must include in a privacy policy, when and how to seek verifiable consent from a parent or guardian, and what responsibilities an operator has to protect children's privacy and safety online...
ironically, if users want to participate and don't want to "report it" - then there's no obligation - it's one of those weird things where if you can claim you didn't know - it's fine.
@poke there's even a separate option on the "Message the CM team" as to about a user that's specific to that legislation... sadly, they have to take it seriously - it's either they do sign up requiring consent and prove that consent, or just not allow it
@AndrasDeak oh that's good - you didn't read the room rules that said in white text on white background: "we own your soul - with love - the Dark Council"? :p
There’s not even a clear guideline for __repr__ although that’s more often than not expected to be “runnable code” (with runnable being in very big quotes)
In general, if you can, make it executable to recreate the object. If you can’t, make it as useful as possible by providing as much relevant information about your object as you can
For example, a user object might return something like User(id=123, name='Foobar') which is “enough” to reproduce it (using the user id), and has information for the user to process it (using the name). – Even though such a constructor may not exist
@khajvah don't feel bad, those pre-interviews are never very good anyway... smartest guy I know got rejected from twitter before even an on-site interview
@khajvah I asked to a friend of mine who was doing for her PhD a few years ago, if it is better to be prepared when luck comes or just prayed for the luck to come and when it comes, not be prepared enough
@WayneWerner yeah people in my area have a somewhat negative view of google because they find them to be elitist, and also their interview process to be relatively favoritist towards certain groups
For reasons that I'm not quite able to articulate, I decided a couple of days ago that it'd be fun to write a program that could grab an SO chat message from the transcript & print it in the shell. I almost wrote something quick & dirty using regex, but I resisted the temptation. Besides, I'm all regex'ed out, after doing that Batman program in sed. ;)
But I didn't want to use a 3rd-party library, so I refreshed my knowledge of the HTMLParser module, which I haven't touched for 6 years (and which is now called html.parser). To get myself started, I wrote a simple HTML dump program.
It will also parse a single section from a file. Just pass it a chunk of the file that starts with the start of that section, and it'll stop parsing when it gets to the matching end tag.
@Rawing :p The original version uses f-strings, but I changed it to %- formatting for those that don't have 3.6. FWIW, %-formatting is faster than the format method or function. But f-strings can be faster than the old ways.
And here's its big brother, the chat parser. It's not perfect: it inserts a couple of unwanted spaces in a few non-critical places, but it doesn't mess up code blocks.
If you think that code looks scary, take a look at the HTML it has to parse. :) Actually, the chat transcript HTML is rather well-structured, but there's quite a bit of variation in what those "content" divs can contain.
@PM2Ring: full points. I've seen people "ooh" and "aah" and use a manifestly uglier approach because it saved them 150 microseconds on something they'll do a hundred times in their program.
@PM2Ring No joke. Today I saw someone comment "You should time if {'a': self.a, 'b':self.b}[name]() is faster than if name=='a': self.a() else self.b()".
Some of my timeit tests were written purely to create hard evidence of stuff that I was already certain of, eg that it's faster to do membership tests of a set than of a list. New programmers should be aware of that stuff, and also have an idea of how it scales, so they don't waste time building a set from their 5 element list purely to do a membership test on it.
But sometimes the results are surprising, eg that in Python 2 shuffling with the random.shuffle function is slower than using Timsort with a random key.
I don't know what the current state is, but I think it used to be a little faster to do one-off membership tests on small literals if they were tuples or something. So you had a bunch of people using tuples where they shouldn't (conceptually, anyway). Then I think (can't remember because this isn't the sort of thing I care much about!) they changed this so set literals were as fast, and then _that_ became the new standard. Or something. The differences, of course, were completely trivial.
@AndrasDeak Sets are definitely the fastest if the collection is large, being O(1) (amortized) instead of O(n). And yes, small sets are pretty damn fast these days. But if your collection is small, and you need it to be a list or tuple anyway because you need it to be ordered &/or indexable, it can waste more time building a set from it just to do a couple of searches than the time you save from using a set.
Plus it adds clutter to the code, and wastes development time. But if your collection length > 100 and you're going to do lots of searches, then you should build that set (or dict).
@khajvah that's what __repr__ is much more suitable for!
@wim it's called being practical/efficient. a print is looked at quickly, and often more than enough. a debugger OTOH interrupts the flow since you probably end up breaking or even get a new window (e.g. with wdb opening a browser window to debug)
class NotStr(str):
def __hash__(self): return id(self)
print({NotStr('spam'): i for i in range(4)})
#output
{'spam': 0, 'spam': 1, 'spam': 2, 'spam': 3}
@Andras I mostly meant that whatever way it is should work on any page, not just the profile page which conveniently lists the badges. If that method ends up being an AJAX request to the profile page then be it :/
@DSM Oh.. So I am assuming there are no issues with not using Venv right? Unless you are going to use some libs which might not be compatible with others.
@Anarach: it's still a good habit to get into. I admit it's less of a problem if you're on a system which doesn't use Python as part of its basic architecture, but on Linux, if you start installing things into the system Python you can really get yourself into trouble.
I actually think venv is counter productive since you have to keep track of whatever you installed for one env and if you are doing another project in another location you have to painstakingly install all the libs one by one all over again!!
well, some programs need python 2 to work, and some stupid things happen every now and then. System upgrade reverts the python command to python2, pip installs modules for python2 per default... that kind of stuff
I regularly swap between environments (as I've occasionally complained about, there's one team I work with still using 2.7) and it makes my life quite simple.
@PM2Ring Ok , this i dont understand, Whern i create a new VENV and type "Pip freeze" it shows nothing..but my default python has tons of packages installed in it..
A "cache" is a typically-hidden store of data for performance reasons. It doesn't mean that every virtualenv will inherit the same libraries, that goes against the whole point.
@DSM I understood that we create a venv so that we can have seperate dependencies for each project , what i am trying to understand is what if I have to create a new Venv with a similar project which i already did using another Venv , I now have to install all the Packages for this new Venv right? But if i dont use a Venv i dont have to install everything no matter how many times i create a project
Speaking of dupe-hammering, there are 4 suggestions here, but none of them really answer the OP's question because he wants the password to print as asterisks, not be blank. OTOH, that's not easy to do, or advisable, and the OP has gone AWOL... stackoverflow.com/questions/44657215/…
Is "don't show password length while it's being typed" actual security, or just security theater? While we're at it let's require all passwords to have three instances of !@#$%^&* but not any of ()\/
Ehh, I kind of like seeing the dots. And any password for which knowing its length provides any actual advantage to the attacker is a terrible password to begin with.
My Windows login shows the dots. My work internal portal login shows the dots. The ATM at the corner store shows the dots and beeps incredibly loudly per pin number entered.
Hi, I'm looking for people to help me on writing a lightweight Factoid Question Answering Engine for my project Dragonfire. The Q&A engine will follow the similar design pattern with YodaQA.
On a related note, increasing the length of a password is much more effective than increasing the size of the set of symbols used. The only benefit of adding punctuation marks or non-ASCII chars to a password is to make simple dictionary attacks a bit harder.
If the attacker is in the room with you peeking at your monitor, he can just as easily simply peek at your keyboard and get your full password instead of just the length. If the attacker is watching your monitor remotely, how incompetent is he that he infected your computer with a trojan monitor-watcher and not a keylogger
Hence "actual". Yes, if you know my password length is 12, it means you don't have to look at all passwords of length from 1 to 11, but that's trivial for anyone who can do 12 anyway.
In [18]: import string
In [19]: q = string.printable[:-5]
In [20]: len(q)
Out[20]: 95
In [21]: len(q)**12
Out[21]: 540360087662636962890625
In [22]: sum(len(q)**i for i in range(12))
Out[22]: 5748511570879116626496
I just don't see what the plausible attack vector is where it would make a difference. Attacker is peering through your office window which is small enough to reveal your monitor but not your keyboard, despite them being three inches apart?
Attacker is watching you give a presentation where your monitor is displayed on the projector but the keyboard is obscured by the podium, and for some reason you log in after being hooked up to the projector instead of before?
To play the devil's advocate for a moment: Visually, it's easier to get a sense of length from how many stars were entered, compared to trying to follow their fingers if they're fast
@DSM No, probably not, I agree -- but it does simplify the parameters / search space a bit and saves some time, which may or may not be negligible depending on the attacker's patience
@davidism It's just like with range: if you only give 1 arg it's the stop arg, not the start arg, so the function has to do stupid things to make that happen. FWIW, here's the source, it's quite short.
concerning password dots: our school or university computers showed 3x dots per character entered...didn't make cracking any harder, but made the life of regular users such as myself miserable
I have a defense against the 5$ wrench attack: I barely remember my passwords at the best of times. It's all muscle memory, which will fade after they bash me a few times.
A little while ago, someone mentioned their computer overheating. That reminded me of a question I saw last night. The OP was doing a modified version of Collatz, dividing by 4 instead of 2. His starting number had over a dozen digits, but he was puzzled that his while loop had been running for over two days without a result. If he had written it properly, with while x > 0 instead of while x != 1 it would've run to completion in less than half a second. :)
We at Stack Overflow are interested in setting up a security bug bounty program to begin rewarding users monetarily who report serious security vulnerabilities to us, and we want to know what the community thinks. This program will be run through HackerOne where we are currently testing features ...