« first day (1574 days earlier)      last day (3377 days later) » 

10:01 PM
@AnttiHaapala as I recall I'm doing the same, requiring TSL and using SMTPS out. I don't remember to be honest -- it was a while ago and the whole thing has been very hands-off
@AnttiHaapala Honestly the coolest part has been on-the-fly creation of virtual users when I want to sign up for something but don't trust the company to not sell my email address
 
wrote a little script to edit postfix's config, hash it, and restart so all I have to do is ssh mail.domain.com, authenticate, and sudo mkvirtualusr virtual_username real_username
 
user2555451
@AnttiHaapala - Yup, he went to Meta: meta.stackoverflow.com/questions/285545/…
 
It's so weird to use other SE sites. My edits have to be reviewed.
answered a Python question on Super User: superuser.com/a/874717/303164
"don't overwrite system Python!"
 
I had a weird python-related error I almost asked about on superuser a couple days back
spun up a virtual machine to learn Django on
got virtualenv and virtualenvwrapper set up on Python3, made a virtualenv, was in that venv
 
10:14 PM
I hope it's not this room that is DV-ing that meta question into oblivion
 
went to run python manage.py migrate (I think?)
 
It is not a feature request
 
I didnt down vote it
 
and it threw a bunch of ImportErrors trying to import django modules from the system python27
 
I dont down vote much these days .... it has to be really aweful
 
10:15 PM
Hey guys\
In python...
s = socket()
 
Hmm, I downvote very liberally on main sites, rarely on meta
 
doesn't work
'module' object is not callable
 
@StaticCast socket is not a built-in method, so no it doesn't
 
Yes, I did import socket...
 
if you've done import socket, then you'll have to use a function or class inside the socket module
I don't ever use socket so I don't know what it is you're trying to do, but calling the module isn't it :)
 
10:16 PM
Despite doing import socket, if I added socket.socket() it worked
 
that makes sense
 
import socket

port = 1234

s = socket.socket()
s.bind(("", port))
s.listen(1)
this works
 
import modulename just puts that module in the namespace so you can use its functions and etc
you still have to tell Python where those functions live
 
Cool. I don't know much about python. I tried diff language, that's why I'm trying python ;)
 
user2555451
"Namespaces are one honking great idea -- let's do more of those!"
 
10:18 PM
# foo.py

def bar():
    print("I spam egg'd!")

# baz.py

import foo

foo.bar() # I spam egg'd!
 
user2555451
From the Zen
 
cool
 
@iCodez I read the list of the questions he gave, and I think all of the others are very good except the C++ book question
 
You can import in different ways to change your call signature, but that's the simplest and easiest to follow in 10 years when you have to modify your code and don't remember what it does
a common one you'll see in tkinter applications is import tkinter as tk so you can do tk.Tk() instead of tkinter.Tk()
 
user2555451
I hate the book question, but its locked so I can't attack it. :(
 
10:19 PM
#baz.py

import foo as foobar

foobar.bar() # I spam egg'd
 
the probelm with the book question is as I said, he has too low rep to see the removed answers, though I did phrase my comment not quite the most constructive way :D
 
or you can literally pull specific functions into the same namespace you're in. This isn't a great idea because it's less easy to follow where certain functions come from. However you'll still see stuff like
 
the "explain JS closures to a child" question seems pretty off-topic for SO today... isn't that the kind of question that shifted over to Programmers?
 
from collections import OrderedDict

a = OrderedDict()
a['key'] = "blah"
 
And "what is RESTful programming" is crap
 
user2555451
10:21 PM
3005
Q: The definitive guide to form based website authentication

Michiel de MareForm based authentication for websites We believe that Stack Overflow should not just be a resource for very specific technical questions, but also for general guidelines on how to solve variations on common problems. "Form based authentication for websites" should be a fine topic for such an ex...

 
user2555451
That question. ^
 
user2555451
It is way too broad by today's standards.
 
^ Kind of a bad example though, it's a FAQ attempt
with Jeff Atwood's fingers in it
 
yes, some of them might be offtopic for stackoverflow
 
user2555451
Yea, we'd only be starting fights by closing it. But my point is it would be off-topic today.
 
10:23 PM
but the C++ book is just plain bad as a Q-A for any site
 
@iCodez To be honest I think that depends on how it comes about
There is some leeway for contrived wiki questions
canonical/FAQ type
When the need is shown
If a user just came and asked that kind of question naively, yeah, it'd get nuked in a hurry
But if a group of gold badge users in a tag came to meta and said we're going to make this canonical wiki Q&A, I think something very very similar to that question might fly today
Some network sites seem more into that sort of thing than others
Would be less of an issue if tag wikis were less invisible
 
Hey guys
what does
s.listen(5)
do?
 
user2555451
Eh, if the question was carefully constructed and introduced, it might work. But I'm wary of questions like that because soon you'll have everyone trying to start a FAQ for useless topics.
 
wut
oh nvm
I don't understand how to receive messages
from udp
ah socket.socket(socket.SOCK_DGRAM)
That would make it UDP
So with:
import socket

port = 52552

try:
s = socket.socket(socket.SOCK_DGRAM)
s.bind(("0.0.0.0",port))
s.listen(5)
print('here')
except socket.error:
print('Failed to create socket')
It binds to any local ip, with the port
then it listen(5)
Should I be running that in a while loop/
?
 
@StaticCast you don't listen to dgram sockets!
 
10:31 PM
why not?
 
you recvfrom from dgram sockets
listen is for TCP
 
Oh okay
that would be s.receive?
 
"The sockfd argument is a file descriptor that refers to a socket of type SOCK_STREAM or SOCK_SEQPACKET."
no, recv or recvfrom
 
What?
 
that is for "listen"
 
10:33 PM
ah
 
remember, python did not write the socket library
it is a thin wrapper over the C socket library or winsock
so always better to read the C library documents to understand deeper
 
s.bind(("0.0.0.0",port))
s.recv(1024)
 
anyway, you'd do s.recvfrom()
bc with recv you do not know who sent you,
 
recvfrom return address
 
and then you cannot answer
 
10:35 PM
Well I don't need to answer
I'm not trying to create a client
"Failed to create socket"
 
packet, address = s.recvfrom(65536)
 
oh yes
i forgot how easy python was xd
 
or even better client,address = s.accept() and then read directly from that client
 
@JoranBeasley udp
 
10:36 PM
name packet not defined
packet, address
 
its fine you can just say stfu you dunno what you talkin bout fool
 
how to instantiate without knowing type?
 
@AnttiHaapala
 
@StaticCast you forgot address family: socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 
import socket

port = 52552
packet, address

try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("0.0.0.0",port))
packet, address = s.recvfrom(65536)
print('here')
except socket.error:
print('Failed to create socket')
How do I define those variables, or are the in the s?
 
10:37 PM
@JoranBeasley nope, I am trying to learn to not make ppl think I am a jerk, remember
 
packet = 0
address = ""
 
i'm not knowing where to close the db connection.. if i close it at some point, after the first call, one cannot make another ajax call since the connection is closed
def getArtist(myQuery,id):
global cursor_ready
print cursor_ready
if cursor_ready:
cursor = cnx.cursor()
#query = ("SELECT * FROM Artist LIMIT 10")
query = myQuery
cursor.execute(query)
columns = cursor.description
artists = [{columns[index][0]:column for index, column in enumerate(value)} for value in cursor.fetchall()]
cursor.close()
#cnx.close() #where to close the connection
return artists
 
correct?
 
@StaticCast they will spring into existence by mere assignment
packet, address = s.recvfrom(65536) is enough
this is python afterall
 
10:38 PM
Oh cool
 
if i close it there, all other calls after the first call will be refused
 
yes, 'tis python
Okay, so now it's not accepting the connection
I'm assuming because two different clients?
 
if i close it..
i'm sure i should close it somewhere but actually wondering where should i do so
 
@StaticCast ah you cannot listen to the same port in 2 programs...
@JoeSaad I never close connections to sql db... that is because I use sqlachemy that handles it for me
 
ok, i'm using mysql.connector you have any idea if i should close there or not?
should i actually consider using sqlachemy ?
 
10:42 PM
@davidism laurel at that meta
 
seriously, that guy just does not get it
 
so funny, now he says "It wasn't too broad, davidism just answered my question perfectly on the other Q"
I and davidism voted on duplicate
 
DSM
"advanced Python" what now?
Oh, wait. Could very well be trolling by one of the usual suspects.
 
@JoeSaad sqlalchemy rocksorz
 
From his perspective, it's certainly frustrating. Your question is a dupe! Well, no, it has this other aspect... Okay I edited my answer to MAKE it a dupe! Well, wait, the question is different... Well now we closed it as too broad! Wait, I thought it was a dupe... Well now THAT question is too broad, too!
 
10:44 PM
looking into it now
 
Hmm
So how could I listen to the same port on two programs
Can I simulate another network adapter?
Or do something similar to the way wireshark does it?
 
DSM
@AirThomas: that's true, which is why in his place I'd defer to the locals and get on with my day.
It's often hard to figure out alien customs.
 
@AnttiHaapala lull calling you out
 
"When in Rome"
 
@StaticCast closing as too broad. you cant. make 1 program use 54321 and the other 54322, thatsit
 
10:46 PM
Wait what?
what do you mean they use two diff
 
you said "cannot create a socket"
 
im still sad that console ports of minecraft are actionscript
 
because the port is already taken?
 
oh yeah
I meant
 
@StaticCast you can't have two programs listening to the same port. That's the way that ports work :P
 
10:47 PM
Could I use another cheap network adapter
 
You can't bind the same port multiple times.
 
So then how does wireshark work
 
user559633
you could write a program that dispatches off the requests :)
 
...
 
To bind the port multiple times you must utter its true name in the language of the ancient machines.
5
 
user559633
10:47 PM
@StaticCast via libpcap
 
you can bind them on multiple interfaces yes and all sorts of things but no
 
@tristan You mean program that listens to the port then copies and redirects to both?
 
your problem was "how can I test udp sockets"
 
user559633
or makes a decision of where to send the data
 
and now you are talking about making virtual interfaces and wireshark and whatnot :D
 
10:48 PM
you could always use zeromq, you can do all sorts of crazy stuff with its sockets
 
@tristan is this possible in python, or C++?
 
user559633
tcpdump works by putting the interface into promiscuous mode, which fires off the packets to the cpu, which then decides where to send the packets
 
(that was not a serious answer, as zeromq would only work if what you are talking to uses zeromq)
 
So could I put the interface into prromiscuous mode through python?
 
user559633
@StaticCast nothing is possible in python or c++ and it's a sisyphean exercise, driven by hubris, to try
 
10:49 PM
Or should I look into C
 
user559633
you should look into nodejs as it's the only programming language that will give you the speed you need to do this
 
user559633
horse:car::all other programming languages:nodejs
 
0
Q: Python sockets: how to enable promiscuous mode in linux

przelaczAccording to python documentation we can build simple sniffer like : import socket # the public network interface HOST = socket.gethostbyname(socket.gethostname()) # create a raw socket and bind it to the public interface s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP) s.bi...

 
yes, it is possible, I have done it all and everything, but why oh why
I just said you need to have the listening address different from sending address
 
I was just linking a question that might be related
 
user559633
10:51 PM
hahaha i really want to see this done
 
meaning the (source_ip, source_port) != (dest_ip, dest_port)
 
see wut b dun
 
user559633
because the next week will be "oh god help i can't stop drinking and screaming"
 
hey are any of you guys on a linux box
?
 
DSM
Always. Well, mostly always.
 
10:52 PM
can you tell me if this works stackoverflow.com/a/28376205/541038
 
always
 
(b'E\x00\x00oY\xe1\x00\x00@\x11\x00\x00\xc0\xa8\x01d\xad\xc1\xc0\x1a\xcdH\x13\xc‌​0\x00[0UZ\xe4\x00\x01\x00\x1c\x9a{e\x06v%\x07\x01\x00\x04\x00\x00\x00G\x00\x00\x0‌​0\x00\x00\x00\x05\x9d\xf3\x02\xfd\x00\x02\xf5h\x00\x02b\x00h\x00\x02b\x00i\x00\r\‌​xbb\xb9b\x02i93\x0b\xa9b\x01z\x00\x07bdbdk\xf1\xc3k\xf7\xbek\x03\x0ek\x01ek|(\xf4‌​b\xc9', ('192.168.1.100', 0))
 
@JoranBeasley not yet run
 
DSM
@Joran: dunno. What's it supposed to do?
 
but stdin is linebuffered
 
10:53 PM
oh so it wont work
bleh
deleting
on linux I thought you could do that for non-blocking single char input
 
for that there is a duplicate already
 
i was just imagining things
 
you need to put the terminal to uncooked mode etc...
but that q sould be closed as dupe!
 
@Joran it just exits immediately for me
 
DSM
10:54 PM
I don't think -u affects stdin on 3, if memory serves.
 
it is a bit difficult to do right so no way shoudl repeat bad answers all the time
this is beyond stdin
 
the terminal is line buffered
in kernel
 
An operation was attempted on something that is not a socket
 
fair enough
 
10:54 PM
@Joran and if I pipe input in it just infinitely prints "Read:"
 
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP, socket.SOCK_DGRAM)
 
yeah I deleted it ... it was a garbage answer :P
 
How can i convert recvfrom to ascii?
I get things like b'E \x004(S@\x00u\x11\x1c12\x16\xcc\xf2\xc0\xa8\x01d\x13\xc0\xf8Z\x00 \xf8\\\x00\x00\x00\x019,G\xa21\xa6\x80d\x05\xff\x01\x00\x00\x00\x00\x0c\x00\x00\x0‌​0<'
 
you can't
that is not ascii
 
...
 
10:57 PM
or... well ... now that IS ascii, when you copy it here
 
That's not what I said
Well yes.
I mean, how can I convert that to something more readable
 
it is
 
@StaticCast usually you use struct.unpack
you have to know how to interpret that string
 
print(s.recvfrom(65565).struct.unpack)
?
 
10:58 PM
equally well one could say: "how to convert FGSgeotiidsogpsopdisdoprt34o5pislfmfb" to English?
 
Didn't think so
 
@StaticCast how to convert a JPEG image to ascii" -> it does not make sense
 
struct.unpack_from('bbbbbbUUUUUQQQQllllL',recieved_bytes)
lol
 
that data looks like it does not make sense to convert to ascii.
 
oh thats a jpeg
 
10:59 PM
no, just an example
 
I think it needs to be unpacked ... its likely coming from a sensor of some sort
 

« first day (1574 days earlier)      last day (3377 days later) »