« first day (1608 days earlier)      last day (3565 days later) » 

00:09
nice the teenager was so pissed of that I took his phone today the dumbass punched his TV ... didnt hurt the TV... but he might have a broken hand ...
01:05
Hello world, I need your help or redirection to the right place to find it.
Got a number, containing my binary flags in it, I can't figure a way to extract all the flags set in it, separately.
Google didn't help me :)
I think that should be "simple" (if you know the trick, which I don't). I guess I could loop through it but that seem overkill (especially if such a trick exist) Example:
I have 5 (so 101 in binary)
is there a simple way to get a list containing 4 and 1 ?
(100 and 1 in binary)
@JoranBeasley Is the TV a "Nokia" one?
Jeez, I came exactly when the activity in this room is the lowest…
[(x >> i) & 1 for i in range(x.bit_length())]
will give you the flags from lowest to highest
your example 101 is ambiguous, but 6 would give [0, 1, 1]
[x & (1 << i) for i in range(x.bit_length())]
will give the numbers rather than the flags
so 6 would give [0, 2, 4] (0 being not set, it would be 1 otherwise)
There isn't a magical binary operation? Do I have to loop over it and there ain't any way around it? That's bad :(
oh, you just want to convert the value to binary?
bin(x)
Otherwise, is there a name to that? "Extracting flags"?
No, want a list telling me what flags are on :)
I just gave you a list
{1 << i: bool((x >> i) & 1) for i in range(x.bit_length())}
01:16
Man I thought binary flags were cool :p
That's a dict, so 6 would give {4: True, 2: True, 1: False}
Thanks davidism, I see what I'll be able to get out of that, you helped me, thx! :)
I will see*
you can press up to edit messages, you can use the menu to delete messages
Is 1 << i faster than 2**i?
most likely
01:19
Oh yeah, forgot about that too, thanks :D
(x >> i) & 1 is the same as x & (1 << i) right? (is your solution faster too here?)
no
the first one only returns 0 or 1, the second one returns 0 or the value of that bit position
they were two different solutions since I couldn't tell what you were asking for
Ah but if you bool it, it is kinda the same right? (Then your solution might be faster? Only booling 1 and 0, idk)
@JeromeJ ok, if you really care about performance, time it yourself, but that's probably not your biggest concern right now
the last one is a dict with bools because you seemed to want a combination of the first two solutions
all of them are essentially the same speed, not that it matters for such a small operation
Ah, no worries! I'm just a noob about binary operations, I just wanted to know is one was obviously better, or for the fun of learning, I don't really care about performances here specifically (but in general I guess)
Yup
bit shift (<<) is 10x faster than power (**) at x=1000, so you should at least avoid that one
but then again, if you have a 1000 bit field, you have other problems
01:26
Agreed.
SO is really a double hedges sword for my productivity…
> double-edged sword
Thanks davidism, dont' know what got into my brain there, #brainfart
@WalleCyril 'Cause SO helps me, so, in a hand, actively helps/boots my productivity but then after that I got stuck procrastinating on it :)
all the reasons are good when it comes for procrastinating, that's bad
how do you define procrastination
01:36
Pushing back to latter something you could do now.
postponing
Some are really good at procrastinating, like masters of it,
:)
:D Works everytime!
@davidism In the end, I might just need something like: [1 << i for i in range(x.bit_length()) if x & (1 << i)] (Thanks a lot for your help! Means a world!)
If I'm not mistaken this should gives me [4,2] for 6 for instance
"I might just need" or another way to say that your are solving Y in your XY problem.
I'm grateful you aren't speaking, it helps me not procrastinate. :'D
"greatful" * right?
Nevermind, the first one seems to be the right one.
I should buy a plastic duck. I mean, really. How many times just talking to someone about an issue help us out a lot? Way more often that I would like to admit it personally.
 
3 hours later…
 
1 hour later…
05:25
@AvinashRaj When we say a question is a duplicate, it need not have to be the exact same question.
11
Q: When can a question be closed as a duplicate of another?

thefourtheyeRecently I dup-closed this question (with this question) using the new Gold powers. The close vote was subsequently revoked by another user, saying that it is not the duplicate of the closed question. The question however is very similar to the closed one and the answer of the duplicate question ...

Try the top voted answer in that question and the same can be used to solve this problem.
06:13
haha
Cbg
06:31
I did some more flags
"please read this article" finds lots of NAAs
ssl_version=ssl.PROTOCOL_TLSv1_2 , would it not work on python 2.7.6
2.7.8 works for me
docs.python.org/2/library/ssl.html#ssl.PROTOCOL_TLSv1_2 2.7.9 (and 2.7.8 backports on Ubuntu)
@user1977867 thus try to import it and if it fails then fall back (do not test versions)
@AnttiHaapala u mean i can import v1_2 and run it on 2,7,6 ? Sorry but could you please clarify, what exactly needs to be imported
06:49
no you cannot import v1_2 on python 2.7.6 (usually)
on python 2.7.6 you cannot use tlsv1_2
so what you need to do is something like:
import ssl
ssl_version = getattr(ssl, 'PROTOCOL_TLSv1_2')
if ssl_version is None:
   print("Your version does not support PROTOCOL_TLSv1_2")
   ssl_version = ssl.PROTOCOL_TLSv1_1
or sth like that
import ssl
ssl_version = getattr(ssl, 'PROTOCOL_TLSv1_2', None)
if ssl_version is None:
print("Your python does not support setting PROTOCOL_TLSv1_2, trying hardcoded 5")
ssl_version = 5
actually you could try...
the PROTOCOL_TLSv1_2 is 5
so you can try to supply this number manually
okay... i think i tried it but I used v5 rather than just 5
letme try that
urllib2.URLError: <urlopen error _ssl.c:316: Invalid SSL protocol variant specified.>
class HTTPSConnectionV3(httplib.HTTPSConnection):
def __init__(self, *args, **kwargs):
httplib.HTTPSConnection.__init__(self, *args, **kwargs)

def connect(self):
sock = socket.create_connection((self.host, self.port), self.timeout)
if self._tunnel_host:
self.sock = sock
self._tunnel()
try:
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv3)
except ssl.SSLError, e:
print("Trying SSLv3.")
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=5)
nope it does not work
I will answer
openssl s_client -connect www.connect2nse.com:443 -tls1_2 makes the connection
07:07
wait a sec
it does not matter
I just started a bounty on my self-answered question. Hope I can award that bounty to myself :D
hahaa :D
you cant
it will be 0 points
@user1977867
import _ssl
_ssl._SSLContext
what does it say?
>>> _ssl._SSLContext
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name '_ssl' is not defined
>>> ssl._SSLContext
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '_SSLContext'
07:29
@user1977867 yeah, it is clear...
@user1977867 just use sslv2v3
it will try to use tls1.2 on your machine
but it will try to downgrade down to sslv3 if the server forces
Cbg y'all
cbg
hows pyramid?
I was thinking I could do a helpful addon for pyramid that can be used to include all sorts of handholding stuff
Not had a chance to use it yet :) But I am going through the docs, and am gonna try a sample project today.
Maybe I should document what I found hard about it
@Ffisegydd cbg
good idea
What I like so far: they don't assume you're using a Mac
07:35
I can make a case with pyramid ppl about a person who has used n + 1 frameworks and wants to try out Pyramid...
This is actually how to make Python beat Ruby, if such a thing is desirable: make it as easy on Windows as it is on Unix and all the windows devs will prefer it. Which is quite a few, and probably going to increase as MS do more and more nice stuff to sucker us back in
@AnttiHaapala cool, I'll do my best
hehe though windows users will hate everything with compiled extensions
so you're using windows, do you have the compiler installed for python extensions?
@AnttiHaapala self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_TLSv2v3)
AttributeError: 'module' object has no attribute 'PROTOCOL_TLSv2v3'

self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv2v3)
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv2v3'
@AnttiHaapala Yeah, well exactly. But they may love pypy more quickly than unix people do
@user1977867 how can you fail in copy paste?!?
PROTOCOL_SSLv23
says my post
if you get a syntax error then check you copy paste correctly
@RobertGrant well I do not care about windows much :D
07:40
@user1977867 this is a good sign you shouldn't be doing security coding
@RobertGrant this is just to connect to some service :P
0
Q: python ssl error voilation of protocols

user1977867I'm trying to use python to login and download some files, using the code: import sys import urllib import urllib2 import httplib, ssl, socket class HTTPSConnectionV3(httplib.HTTPSConnection): def __init__(self, *args, **kwargs): httplib.HTTPSConnection.__init__(self, *args, **kwargs...

Oh okay, phew.
@user1977867 you know: your code forced a shitty protocol
you forced the broken ssl3
@AnttiHaapala Sorry but I already tried PROTOCOL_SSLv23 and it results in:
File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 8] _ssl.c:504: EOF occurred in violation of protocol>
now the server admins disabled the sslv3 that has been broken for 15 years
what is your full code
connect function
07:44
import sys
import urllib
import urllib2
import httplib, ssl, socket


class HTTPSConnectionV3(httplib.HTTPSConnection):
def __init__(self, *args, **kwargs):
httplib.HTTPSConnection.__init__(self, *args, **kwargs)

def connect(self):
sock = socket.create_connection((self.host, self.port), self.timeout)
if self._tunnel_host:
self.sock = sock
self._tunnel()
try:
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv3)
except ssl.SSLError, e:
print("Trying SSLv3.")
you are not trying my flag
see there ^
you are using sslv3
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv3)
Hey up all
please bear with this 1 but I tried...
try:
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv23)

is this okay ?? Isnt it what you have mentioned
@user1977867 I edited my answer
or shud i remove the try block ?
07:52
try everything and do not do any copy paste mistakes
hmm is there a tunnel_host there
i'm not sure how do i find that, lsof command should help me i think?
Reading through the fun from last night
yeah, pity those students :d
yay 410 helpful flags
@Ffisegydd you are losing the battle for mjölnir
whoaa I might get it even today
988
python × 483
within like maybe 1 week... 1000 days online, will get 500 helpful flags, 20k, mjölnir :P
Eh. I stopped fighting :p
If you want easy flags, go to the "new answers to old questions" in the 10k tools. Look for "I have this issue too please help" and NAA. Got 100 flags or so in less than a week.
hehe
I have other means
I searched for "please read this article", "http://www.google.com/search" etc.
that removes old answers and then roomba gets to remove some shitty questions
08:00
@AnttiHaapala before i search for tunnel_host, I think there is no copy/paste mistake now. And I think v23 doesnt work.
try:
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv23)
except ssl.SSLError, e:
print("Trying SSLv3.") #This got printed
# self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_TLSv2v3)
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv23) #This gives protocol violation error
then print:
except ssl.SSLError, e:
print("trying sslv3.", e)
so that we get to know what the error is!!!
ok
('Trying SSLv3.', SSLError(1, '_ssl.c:504: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'))
ok so this old version tries to use sslv3
so then next fix attempt
ssl.PROTOCOL_TLSv1 ^ in the try block
('Trying SSLv3.', SSLError(1, '_ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure'))
Ah, the unexpected calm times where you've booked a room for a conf call and no-one's dialled in yet.
08:07
I could dial in and pretend to be your client or whatever.
Cool :) Pop to the Ubercool corporate UK office and get on the internal network :)
"So Bob! How's the things with the stuff going!? WELL THAT'S NOT GOOD ENOUGH!"
Wow, that does sound familiar
@user1977867 I can connect with SSLv23
In python 2.7.3 too
Set-Cookie: JSESSIONID=vCwJVBJRsNQVLx4R9zK6bVZLLnlwwDT8HRXxXtNQWF92LHlLVJvY!-267954745
@AnttiHaapala should i remove
cookie = webpage_headers['Set-Cookie'].split(';', 1)[0]
print >> sys.stderr, "Set-Cookie:", cookie
08:13
I just said your code works in all the pythons I have tested
I cannot think of anything really
cbg
if possible try to update your python to 2.7.9
okay ... strange then :( actually i was trying to avoid upgrade becoz many script may get affected ... but how come its working on 2.7.3 ... even im using the same , is it some url issue? what url did u use, could you confirm
your url
your password your username
all your code
from the question, just changed it to use v23
yes ... evn im not sure now how its working on your system basically
https://www.connect2nse.com/iislNet/Login.jsp doesnt open directly in chrome browser, it gives error (mentioned in my post aswell) so i just thought if tweaking the url may be the case
08:20
it gives the error
because you need to authenticate
you are not authenticating
ohh yes...im being stpid here
the server expects to get your authentication credentials in POST request,
you are submitting GET and the badly written server code gives error 500 when it cannot find the parameters
that will give invalid username now
yes....
but it connects, no ssl errors, nothing
so ssl.PROTOCOL_SSLv23,ssl.PROTOCOL_TLSv1 both didnt work for me , with different errors
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure' and
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure' respectively
:(
08:27
did you put TLSv1 in above?
that does not look like TLSv1
pasting again from my code:
try:
# self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv23)
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_TLSv1)
except ssl.SSLError, e:
print("Trying SSLv3.",e)
# self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_TLSv2v3)
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv23)
and tried on another system with python 2.7.6 same error occurs
Cabbage!
how do we upgrade to python 2.7.9 from 2.7.6 on ubuntu
09:31
build it yourself?
@Ffisegydd I love being the one to put on hold. Smells like...very mild signal to noise victory
There is now an online version of Cards Against Humanity that you can play over the browser O.o
I am ever so very tempted to start a game for the room :P
Unfortunately it says "you need to be in the same room to play" really :( and we probably couldn't discuss the cards in chat, as they are grossly inappropriate.
Yo
You should really, really, really upgrade from 3.1.4. — Ffisegydd 1 min ago
3.1.4 O_o
10:00
Can a comment be flagged as spam?
office cbg
@Martijn I'm in a dressing gown in the kitchen making a late breakfast cbg :)
@JonClements show-off cbg
@Martijn well, it's sausage, bacon, eggs, mushrooms, toast and beans... so you wouldn't like half of it anyway
10:15
@JonClements true that.
After 25 years I've come to the conclusion that I don't really like "Full English" breakfasts.
I much prefer so-called "continental" breakfast.
Well, I was going for a bit of melon and some muesli... but I had two small probs with that
You had no melon or muesli?
Indeed... (damn, you know me too well... must be more subtle...)
I had home-made granola with some fresh apple plus some added oatmeal, topped with home-made kefir. And tea.
This is Twitter, right?
................................................................................‌​............................................yes, it's twitter
@Ffisegydd I rarely have full English; prefer yoghurt to most stuff :)
My perfect breakfast is bread, cheese, and some cold meats (salami, etc)
Maybe a croissant or something.
I'm normally happy with some juice and cereal, but I've got lots of stuff to clear out
We go for breakfast sometimes to a place that serves pears that have been poached in rooibos, yoghurt, and a bit of honey. Amazing.
10:25
my brother was supposed to come around for breakfast yesterday, so I got a lot of stuff in... he had to cancel to go to work instead, so it needs eating
I think I'm right that that Q is OT, but would appreciate comments if people agree/disagree
It's gone
It was Kabyle with a new account.
He self-deleted.
I typed setup.py develop instead of python setup.py develop watches PyCharm load
10:38
@Martijn wow... you're useful for free flags on MSE :p We might just keep you around :p
Glad to be of use for something.
Awww... the room wouldn't be the same without our resident Ninja!
stackoverflow.com/questions/28985724/… is there anyone on whose system TLSv1 or TLSv23 works?
@Martin wow... so much wrong with that code
I can already see the next questions
I know nothing stays the same, but if you're willing to play the game, it's coming around again...
Ironically, I actually have an in-house library that does just that, but also major towns and districts...
it's a paid for dataset though, so... me no share...
wow... pd.read_clipboard() is amazing (once you've installed xclip anyway)
I know dude...so amazing...
I like using io.StringIO and pd.read_csv together for reading in strings easily for Qs
it's a fairly hefty install - has loadsa dependencies but wow, is it useful
reduced 190 lines to 9 for a client's system
11:06
@Jon one thing you may like (and not know about) is using regex as a separator in reading stuff in. So using r"\s+" will treat any amount of whitespace as a separator.
I did know about that, and like it :)
just need to get some more experience down, and some matplotlib, then be warned, this puppy might be stepping on your turf... muhhahahah muhahaha muhahaha
Come at me brah.
DSM
DSM
Way-too-early morning cabbage for all.
@Ffisegydd Ken and Ryu stuff yeah? :p
@DSM yeah... what the cabbage are you doing up now?
DSM
DSM
Been up for a few hours; woke up early and couldn't get back to sleep. :-/ Sunrise is about to happen, which I haven't seen in a while.
11:13
The way you say that makes me think of people in the arctic who don't see the sun for weeks during winter.
@Jon also, if you're going to look at plotting with pandas, probably worth your while to look at seaborn. I'm sure our Canadian-sleepy-friend would recommend it too.
Not only does it make matplotlib look better in general, it also adds some very nice plotting functions.
DSM
DSM
@Ffisegydd: there's also delim_whitespace=True. My favourite is "\s\s+", which covers 3/4 of the cases I come across which would otherwise be annoying.
What's the difference between "\s\s+" and "\s+"?
Surely \s+ is just "one or more whitespaces"
@Ffisegydd already using seaborn
Which is the same as \s\s+ Which is kinda the same as :P
DSM
DSM
>>> re.split("\s+", "see what happens  here")
['see', 'what', 'happens', 'here']
>>> re.split("\s\s+", "see what happens  here")
['see what happens', 'here']
11:18
\s{2,}?
Ah okay touché.
I usually just handle numbers and so haven't come across that issue with words.
In which case @DSM you may want to edit this answer stackoverflow.com/a/15026839/3005188 :P
Not strictly necessary in that case but it's the top result for "pandas regex separator"
DSM
DSM
If I was going to fix some historical stuff I should fix some of the Excel-reading answers, because the preferred methods have changed significantly..
Mind you, blatantly not an expert of pandas as DSM has pointed out better ways in my last two answers
DSM
DSM
I spend a lot of time working with tabular data. :-/
I spend more time with trying to get data into anything useful
11:26
@thefourtheye: you around?
I have a contact for you to send your CV to.
I normally get - "what can you do with this data"? me: "Whatever you want, what's in it?", them :"not sure, but you can work it out right?"
goes a-huntin' for an email address.
@Martijn if he doesn't respond, I'll send his email privately on G
@JonClements Thanks, I'll take that now and send him an email.
@Ffisegydd AAAAUUUGGHGHHGHGHH
That is all.
11:29
Cool.
Well said.
Also cabbage @BoltClock.
DSM
DSM
I would've had more As and fewer Hs, but okay.
@poke Ah, right
11:31
Anything in particular we can help you with? :P Or have you just come in to have somewhere to scream?
@BoltClock That’s an odd message you are replying to now… :P
Ah it does indeed all make sense now :P
@BoltClock welcome... is this an "official" visit, or just er... tropes and screaming? :p
We suspect the user has another account, that isn't currently banned on the main site but is banned from chat for a month.
The account uses a different name, but asks the exact same questions on the same content. And once said "photography chat is dead" and when someone went to photography chat found one of the SO-banned accounts in there, not his Kabyle account.
Circumstantial evidence :/ but we're all pretty sure from speaking to them that it's the same person.
11:36
yeh, reached 10k profile views in short period of time.
i think it's all because of regex.
Err, this person can't be serious, surely?: stackoverflow.com/questions/29008359/…
DSM
DSM
I think the question is serious, although deeply confused.
11:49
@Ffisegydd Given that he's said stuff like this
yesterday, by Kabyle
One day I will create a website where people can ask very low level and rubbish questions. That is kind of discrimination that only very smart people can ask questions here
I'm really unsure whether he's trying his very best to hide it or no
@Ffisegydd the account got deleted
@JonClements just the small b account
@BoltClock also see here - they have a habit of keeping getting new accounts
@JonClements Yes that's what led him to getting his main account banned the next day
@BoltClock since we already know how to identify him, and if he breaches this room's rule (which let's face it, are fairly lenient), and we have to kick them (which isn't done without much deliberation), would it be fair to flag for mod and explain this again?
11:57
I forget the criteria for kicks creating automatic mod flags, but if you know it's him go ahead and flag
@BoltClock ty... the team here doesn't really want to be carrying out such actions - they're only done if needs be - but we appreciate your input
(the curse of being an active and populated room with a widely used language - I guess)
@MartijnPieters Thanks :-) What do they expect actually? I don't have Python work experience
Will that be okay?
@thefourtheye you know enough Python to get by... show them some of your great answers on SO, woo them in the interview with them etc....
@thefourtheye You know enough to answer well on Stack Overflow.
I have more faith in your Python abilities than the candidates that I've seen posting to the coding challenge they set up.
Thanks Guys :-) Thats really encouraging :-)
12:09
They want web developers, you know JS and Python. You'll do fine.
Cool, I ll prepare my resume over the weekend and send it to him, CCing you @MartijnPieters.
cbg
@Ffisegydd what was the other username?
if @Martijn wasn't sure you could do it, he wouldn't take the effort to suggest it to you @thefourtheye :p
@JonClements That's what I am more afraid of. I should not let him down badly in the interview :(
12:20
@thefourtheye don't worry about it... just do your best - that's all anyone can do
Yup, I ll go through the documentation over the weekend, that should give me some confidence :-)
puppy's unite! go for it :p
@thefourtheye: I'll let Madhu know; I don't know what their timelines are.
cbg @Antti
12:27
@thefourtheye: really, the quality of submissions I've seen to the coding contest they've set up to try and find candidates is rather abysmal. I'm pretty sure you'd have done a lot better.
@thefourtheye: note that I know next to nothing about the Chennai work environment however. Don't hate me if you hate it there. :-P
DSM
DSM
Okay, now that it's approaching normal hours I should begin a normal day. Rhubarb for all!
@MartijnPieters Well, I can fit in any workplace as I have very less expectations. My only worry would be the pay. I am not sure if they can match the expectation in that front. But that comes after the interview. So, nothing to worry now I guess :)
12:48
Phew, My KS documentation is finally done. Now I can link to important reference documents, such as https://github.com/kms70847/KevinScript#is-this-a-joke

« first day (1608 days earlier)      last day (3565 days later) »