« first day (1439 days earlier)      last day (3520 days later) » 

12:38 AM
@Humdinger The default is copyright law, which is the most restrictive situation: if you don't licence your software, no-one has a right to redistribute it at all. Licences say "I give you extra rights A, B and C that you didn't have before, under conditions X, Y and Z".
 
I've the following issue
http://pastie.org/private/jhthw7oo7uwpofuvnplea its returning UnicodeEncodeError at /user-profile/mrfestus/
'ascii' codec can't encode characters in position 394-395: ordinal not in range(128) any ideas?
any one has an idea? I will appreciate it
I dont seem to get it fix
 
12:58 AM
My guess would be that it's your line if str(html) == "None": ... you're converting unicode to str without specifying an encoding with that str(html), which is problematic. For example:
>>> html = u"<p>This paragraph contains non-ASCII characters: Róisín Murphy is awesome!</p>"
>>> str(html)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 50: ordinal not in range(128)
Why not just compare against a unicode string?
if html == u"None":
 
mmm
what you think a possible solution to be?
 
Why not just compare against a unicode string?
 
unicode(html) == "None":
you mean that?
 
No. It's already unicode.
The line I gave you already :-)
 
ooo
let me try
 
1:05 AM
The general rule is to only work with unicode "inside" your program - decode any incoming bytes on the way in, and encode unicode to bytes on the way out. It's a bit of a pain in Python 2.x because you have to stick that u in front of all string literals, but it saves you a lot of grief in the long run.
 
it worked
but now i get this Universit\u00c3\u00a4t T\u00c3\u00bcbingen
instead of the proper text
should i encode it as utf-8 ?
string = self.experience.encode('utf-8')
 
That's the result of decoding UTF8 as ISO 8859-1 ... no idea where in your code that happened.
I think you need to read some tutorials on proper unicode handling in Python ...
>>> print u"Universit\u00c3\u00a4t T\u00c3\u00bcbingen"
Universität Tübingen
>>> print u"Universität Tübingen".encode("utf8").decode("iso8859-1")
Universität Tübingen
 
 
2 hours later…
3:35 AM
anyone here?
 
I am; not sure for how much longer though.
 
@ZeroPiraeus got a python question for you. Something that I didn't think was possible
http://stackoverflow.com/q/26007970/198633
How does that list indexing work? I've never seen it in python before
 
Does this help?
>>> pair = ["no", "yes"]
>>> pair[1==1]
'yes'
>>> pair[1!=1]
'no'
Further hint: int(1==1)
That's actually a quite fascinating question ... OP has got something that gets kinda-sorta close to the result they want in the specific case given by sheer coincidence.
They appear to think they're going to get the object in the list with an id attribute equal to a particular string, whereas in fact they're just getting (e.g. in the first example) the 0th element, because the builtin function id() is not equal to the string "obj1", and the integer value of False is 0.
 
4:00 AM
well, I get boolean addressing, but OP is using class specific variables in the indexing
 
hi all
 
No, they're not. They just think they are.
Try id == "obj1" in a brand new interpreter session.
 
but then how does list1[id=='id1'] not throw an "id has not been defined" error? id shouldn't be defined in scope at all
 
I have a quick question, though it is not a python question, maybe you can help me. So, how to minimize running programs on linux through ssh,
Any idea?
 
4:03 AM
@CoKoder: minimize, or suspend?
 
@inspectorG4dget, minimize
 
if you're doing ssh -X or similar to forward the x-session, then the minimize button should be available to you
 
what does minimize mean, run in the background?
use screen or tmux to detach your session
 
@ZeroPiraeus: I know about id(...), but OP is using id as a variable, no?
 
@inspectorG4dget It's just a coincidence because they used the name of a builtin as an attribute - list1[zip=="dedoodah"] would have the same reult.
 
4:05 AM
So I am trying to get a screen shot to get teamviewer password, but i cannot see the teamvier when i take a screen shot due to other opened programs
 
d'oh! I just realized where I went wrong in my thinking. I feel stupid now
 
@inspectorG4dget That's just it ... they aren't. They just think they are. They're actually testing whether the builtin function id is equal to a string, and of course it isn't.
 
@CoKoder: if this is over an ssh session, then you are almost certain forwarding the x-session, which means that you should see the titlebar and the three buttons (minimize, maximize, restore)
 
That code could have been designed to be confusing ... I almost wonder if they were getting trolled by someone.
 
@ZeroPiraeus: indeed. Eff! That was annoying. Also, I think it's time for me to go to sleep -- given that error on my part
 
4:07 AM
@inspectorG4dget, yes i see when i take a screenshot, but how to click it over ssh
 
with a mouse... no really!
 
@inspectorG4dget, :)
 
if you are forwarding the x-session, then you should be able to use the mouse; or am I missing something?
 
@inspectorG4dget, how to forward the x-session?
 
If you see the windows on the remote machine, then you already are
if all you have is a commandline interface, then you are not
if you want to forward the x-session, you must do ssh -X user@host
 
4:11 AM
@inspectorG4dget, i am trying to access the linux box from windows using putty
@inspectorG4dget, can i do x-session on putty?
 
eff! hang on. I know there's a way to do this, but I don't have a windows box handy at the moment.
@CoKoder: this is going to be a little tricky, but I'm going to try. Open a new instance of putty, and tell me what menubar items you see (File, Edit, ...)
 
click on the "+" next to SSH
... and send me another screen shot
 
Click on "X11".. and screenshot
 
4:16 AM
Enable X11 forwarding?
and X display location
 
I think so. That sounds about right...
 
X display location is an edit box, do i need to enter something?
 
try without that for the moment. We'll worry about it if it doesn't work without that option
 
It did not work out
i still see the command window
only
 
x display location might be where to send the display, i.e. the filepath of the monitor on your windows box
that will still happen. See if you can get a window to popup - try firefox
did you see a firefox window popup?
 
4:23 AM
I did not get it
what you mean ?
how to know the filepath of the monitor on your windows box?
 
forget that for the moment. After enabling the x11 forwarding, you said that you got a blank command window
in that command window, launch firefox, with the command firefox
You should now see a firefox window (after a slight network time lag). If you do see this window, then x11 forwarding is working
 
no i do not see anything when i type firefox
 
hold on
 
you need to install an x server, install and run xming: straightrunning.com/XmingNotes
or cygwin's x server
 
... and now @CoKoder, you are in better hands than mine
 
4:44 AM
any luck?
 
4:59 AM
@Veedrac
 
@Jeeva Hello
 
I finished my implementation using multiprocessing. But just got to know that i need to extend it further for distributed nodes. which one would be good? do i have to completely change the pool.map part?
 
You mean on different CPUs?
Or what?
 
yes. in cluster
multiprocessing use the CPUs in single node. but i need to utilize the nodes in the cluster
 
I've never had to do anything like this, so I'm the wrong person to ask.
 
5:13 AM
Umm... check out openmpi. I believe there's a python module to use mpi
If that doesn't work, you could do the "dumb" version, with a lot of SSH and bash to basically run one instance of your program per node
 
oh.. but i cant do ssh because my program will be automatically distributed to the nodes by scheduler
i guess open mpi
but i need to change program right? i cannot use multiprocessing then? isnt it?
would suit
 
I don't think you can use multiprocessing: stackoverflow.com/questions/5181949/…
 
OMG.. thats a bad news... :(
i need to rewrite a lot then
 
multiprocessing is for local processes
 
yup right
 
5:24 AM
you can use celery, pyro4, or any number of other distributed solutions depending on exactly how you need to interact with the jobs and data
see also the section "cluster computing" on this python wiki page: wiki.python.org/moin/ParallelProcessing
 
ok thanks. I just read few of them, but the problem is that this needs to be installed in every node of the cluster which is something i need to get lot of approvals.. :(
 
You can't get around that, each node needs to be running a worker or however communication is established.
 
5:54 AM
Anyone have any experience with exercism? Is it worth checking out for a brain teaser now and then?
 
@Jeeva yeah that might work, I've never used it before, didn't even realize it was there.
still need to install stuff on each of the nodes though, that's not going to change
That seems really low-level though, celery or pyro abstract that and make it easier
 
6:15 AM
cbbg
the problem with celery is
it is P.O.S.
it is the django of multiprocessing, forces everything to work the one way
and hard to rip apart or embed
 
@AnttiHaapala yeah, after using it in production I'm realizing that
it's also incredibly prone to memory leaks, either in the workers or in the rabbitmq queues
 
hmm that I do not know
just recently tried to embed celery nicely to an already running worker daemon :D
 
do you have a recommendation for another library?
 
no
that is the problem, usually such projects are like "well, but we want to use celery bc it is more widely supported"
 
I was thinking of rolling my own for the next version, mostly because we're not doing anything that complicated, mostly just large background tasks. Nothing chained or anything like that.
 
6:22 AM
btw how come the rabbitmq queue leaks memory?
 
no idea
 
@davidism before that we just used multiprocessing.connection to put stuff from web workers to 1 background daemon
 
there's a few implementations celery exposes, I switched to rabbitmq-rpc and it got better, but have still had to restart on occasion
 
it worked like a dream, but we just thought would want to have a messagequeue for chained multiprocessing or so
erlang does not leak memory
 
I used the wrong term
 
6:23 AM
rabbitmq then I would guess also does not leak memory
so I'd guess celery just forgets some queues or so :D
 
Celery likes to set up a ton of queues, one per message sometimes, and fails to expire them for days
the rpc backend helped
 
yeah, that does not seem right at all
 
the nice thing about celery for us is the cron scheduler
If I roll my own I'll have to implement that too.
 
maybe I should write my own system with erlang
just a simple json queue
 
I was looking at Elixir now that it's 1.0, it looks really interesting.
ErlangVM but with nicer syntax and other sugar, as well as what seems like a good build/env/distribution toolchain.
 
6:42 AM
cbg
 
6:53 AM
Cbg :)
 
cbg
 
 
1 hour later…
8:19 AM
cbg
 
1 message moved to Trash can
@user123 please see the chatroom rules sopython.com/pages/chatroom - in particular please do not post newly asked questions.
 
@davidism grrr... why is it such a pain to use a sqlalchemy declarative base from flask?
 
I'd imagine you've missed him.
 
Ah... think I've got it anyway :)
 
8:42 AM
Unfortunately, I'm still awake.
 
D:
Minecraft?
 
Arghghghgh
Nope.... don't haveit
 
@JonClements are you using flask-sqlalchemy? have you seen how easy I make it look in sopython-site? ;)
 
@davidism well... don't fancy changing all my Base to db.Model
 
You can subclass the SQLAlchemy class and override make_declarative_base to return whatever you want.
So if you already have a Base, you can return it there.
 
8:46 AM
Well... I'm sure I've tried 3/4 different ways now and getting a little frustrated here :(
 
It's not exactly the same, but sopython does it here: github.com/sopython/sopython-site/blob/master/sopy/ext/…
 
Okay... umm....
So if I have something like:
 
Inside make_declarative_base, I define a different model base, but you can just return an existing declarative base rather than calling declarative_base.
 
from sqlalchemy import BigInteger, Column, Date, DateTime, Float, ForeignKey, Index, Integer, Numeric, SmallInteger, String, Text, Time, text
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class CCTransaction(Base):
    __tablename__ = 'CC_Transactions'

    CC_Trans_ID = Column(Integer, primary_key=True)
there's about 300 models in that file
so I've basically got the output for sqlacodegen
I'm just finding a lot of conflicting information on how to make it easily accessible via Flask
There's a github ticket on it, but that doesn't appear to work for me for some reason
 
It's 2 in the morning without sleep, but just using a subclass that returns that Base should work. I agree though, it's not clear how to use externally defined models. I was thinking of writing a new extension to replace flask-sqlalchemy.
 
8:51 AM
I'm tempted to kick-mute you to make you go sleep.
 
so subclass flask.ext.sqlachemy.SQLAlchemy ?
 
@Ffisegydd just decided to work on work now, while I'm inspired, rather than going into the terrible off site office and being annoyed and distracted all day again.
 
Ah ok
 
@Jon yep
 
Umm... even trying to import the base I get sqlalchemy.exc.ArgumentError: Column must be constructed with a non-blank name or assign a non-blank .name before adding to a Table.
 
8:53 AM
But it works if you use it normally?
 
If I set an engine manually then import it, it's cool
If I attempt to just execute the models.py file, it fails with that message... so
 
Something wrong with the generated code. Didn't assign a name to a column somewhere.
Once you get that sorted, the SQLAlchemy subclass should work.
Anyway, I'm going to try and sleep, good luck.
 
Right... so one of the RemoteNetwork = Column(String(50)) is snafu'd?
@davidism looks like you were right - columns with leading underscores... :(
 
9:37 AM
Cabbage all!
 
cbg @Intrepid
 
Remind me to slap anyone who said "at least all the referendum chat" will be over after the vote
shakes head
Anyway, how's everyone else doing the day?
 
cbg(all)
 
cbg(person for person in pysochat)
 
@PeterVaro Cababge
Cabbage @Antti
 
9:41 AM
@Ffisegydd that's my workplace
 
@Ffisegydd And I'm not that beastly. I do my best not to bite people
 
cbg()
 
waits pensively to see what happens
 
@IntrepidBrit I get told off if I bite people :(
 
@JonCle did you get flasqlalchemy done+
 
9:45 AM
@JonClements See, I find that unfair. A dog bites someone, he gets put down. Suarez bites someone, he gets a slap on the wrist...
 
@Antti Yes... now trying to get out of Django ORM thinking and swearing at trying to set up a relationship
 
I am not Anti, I am Pro
3
frankly I do not understand the value of flask-sqlalchemy per se, it just makes everything more complicated :D
@JonClements you can always bind the engine later?
Base = declarative_base()
then at some convenient point you can do
Base.metadata.bind = whateverenginetheflaskwantstouse
in our app, we use pyramid, and we have a func that creates the engine from settings:
def session_factory_from_config(configuration, prefix, **kwargs):
    engine = engine_from_config(configuration, prefix, **kwargs)
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    return DBSession
 
@Ffisegydd you must have scared them off with your comment - it's gone :)
 
I don't know why I'm one-word-commenting all these urls.
 
Now I want to make a wrapper around stdout that plays a note for every character...
 
10:26 AM
Or you could encode every letter with a musical note and "play" your Python code.
Hello to you too.
 
10:53 AM
@itmard I suggest you read the notice stuck to the top-right of the screen: sopython.com/pages/chatroom
 
@Veedrac to be fair it was asked two days ago :)
 
@JonClements to be fair , cbg() :)
 
cbg @Swordy
 
Yeah, I'm more worried about the fact he seems to have already left and the whole "should usually only link it when having been asked by others". That's two out of three failed :/
 
1 message moved to recycle bin
@Veedrac hadn't noticed he'd left :)
 
11:11 AM
Hi everyone! Can help me anyone with socket ??
def setSensor(sensor, value):
sensor[sensor.keys()[0]] = value
print sensor
# Here we should send sensor value to the service !!!
# p.send( sensor )
p.send('test')

With this function I cant send data only once. The second attempt is p.send('test')
socket.error: [Errno 32] Broken pipe Where is the problem ?
 
Something like stackoverflow.com/questions/11866792/… maybe? You should really make a minimal example. Minimal examples are really good for debugging.
 
12:06 PM
Dupe of the "nested dicts" link mentioned in the comment
 
Should stackoverflow.com/q/26014802/3005188 be closed and deleted?
 
I receive socket on my android device. Can anyone give me example for true python client, send data to server.
 
The socket module documentation has some examples of how to use sockets to send data.
 
Please give me url, because I'm android developer, and need to be implement some stuff on python =(
 
@Ffisegydd "I used \ instead of /" could reasonably be interpreted as a "typo", I think
 
12:11 PM
cbg
 
I agree. Voted as such. Need 1 more.
 
will just hang out.
I will probably be a lot more idle.
 
cbg @Martijn
 
but I'll just take that in my stride. :-P
 
The documentation for modules in general can be found here. socket is in there somewhere.
 
12:13 PM
@Kevin thanks
 
hello again
what is ? TypeError: must be string or buffer, not dict
def setSensor(sensor, value):
sensor[sensor.keys()[0]] = value
print sensor
# Here we should send sensor value to the service !!!
p.send( sensor )
 
It's telling you that you cannot pass a dict object and it must instead be a string or buffer
 
@Ffisegydd hmm.. tell me more how can resolve this ?
please
 
don't pass a dictionary to send. pass a string.
 
Where exactly is it presenting this problem? p.send( sensor )?
 
12:39 PM
By the way, I don't think this is the cause of your problem, but sensor[sensor.keys()[0]] = value looks like a dangerous piece of code. Dictionaries are unordered, so sensor.keys() can return the dict's keys in whatever order it wants. there's no telling what key will be updated with value. Consider using an OrderedDict instead.
 
Cbg guys
 
yo
 
@Kevin Thanks again
 
Building a new pc, the DIMM disappeared from the stock at the delivery day (it was there when I ordered it) :(
So I have no working pc at the moment
 
12:54 PM
I'm impressed that you can still chat with us, in that case.
 
From my phone
 
I always forget we have a mobile site.
 
:)
 
I use the mobile site a lot
 
Interesting that the average phone made today has more processing power than the ship that took us to the moon, but we don't usually regard them as "computers"
 
12:59 PM
Doesn't the average graphical calculator have more processing power than the craft that took us to the moon?
 
I'm beginning to suspect it's less a matter of "we don't appreciate modern technological wonders" and more "it doesn't actually take that much math to go to the moon"
 
Anyone here adept at Bash?
 
Or at least, most of the math can be done ahead of time on Earth
 
cabbage everybody
 
The fact that even I can get to the Mun (without calculations) on KSP says it all really...
 
1:02 PM
@Soviero what do you want to know ?
 
1. Point rockets in opposite direction of Moon. 2. Engage rockets. 3. Wait.
"Landing"? That's not in my job description.
 
Isn't that what ejector seats & parachutes are for?
Oh whoops, there goes Wimbledon
 
I need to dump the /etc/shadow files for PCI stuff, but I need to mask the hashes. How do I print the line with the hashes masked?
@XavierCombelle ^
 
Soviero why would you don't want to do it with a python script
it would be cleaner
 
@JonClements is Narnia worth watching? (maybe @Kevin?)
 
1:06 PM
@XavierCombelle Because this is part of a larger bash script, and I dont want to shove Python in there, also, some of the servers are really old
 
Haven't seen it, but I liked the books as a kid
 
@Soviero that is good reason
 
I never picked up on the "Aslan is an allegory for Jesus" thing, so I don't know if that's grating if you're aware of it.
 
@Kevin it is strange that it didn't get as much attention asas the HP or the LOTR
@Kevin back to my days near at church I knew a lot about C.S.Lewis
and therefore the whole allegory of Narnia (not just Aslan)
(although I have no idea who Aslan is :))
 
It kicked off a persistent trend of young adult fantasy novel movie adaptations, so it must have done something right (or did HP come first?)
 
1:09 PM
@Soverio sudo cat /etc/shadow|cut -d':' -f1,3- should do the job
 
@Kevin HP came first (2001) Narnia later (2005)
 
LOTR was first same time as HP.
 
@XavierCombelle I need to show that the hashes are there...
 
@Ffisegydd ahh, thanks for the update
 
Yesterday I completed watching Parks and Recreation (or at least what Netflix has available), and am now two episodes into Bojack Horseman.
 
1:12 PM
@Soviero what do you mean by show the hashes are there can you give example (in paste preferably)
 
Seems fine so far. I'm not sure whether giving Patton Oswalt three roles in two episodes is a deliberate casting choice or a budget problem.
 
@XavierCombelle ksoviero:$HASH$:16148:0:99999:7:::
Just something like that ^
 
4chan says they liked the ending, and they usually hate everything, so that's a pretty big vote of confidence
 
@Soviero so sudo cat /etc/shadow|sed 's/:[^:]:/:$HASH$:/'
 
You like 4chan?
 
1:15 PM
@Soviero it's kind of magic because sed just replace the first occurence if g modifier is not specified
 
@Kevin it starts to be unique at episode 3 or 4
it finally stops mimic the Family Guy and other stuffs
 
@Soviero but I did a mistake it should be sudo cat /etc/shadow|sed 's/:[^:]*:/:$HASH$:/'
 
and became something else -- for me at least => something unique
 
@vaultah In small portions, yeah. the comics board is fairly civil. I like to read the "post your favorite funny panels" threads.
 
which is worth wathing
 
1:19 PM
@XavierCombelle Nevermind, I'm just going to use Python, this is more complicated than I thought... They want to keep the algorithm details, just mask the salt and hash. I'm just going to do it in Python after all
 
@Soviero eheh
 
cabbage y'all
 
@XavierCombelle FYI, this was the solution that did what I wanted: pastebin.com/YNG6a8bJ
 
@inspectorG4dget, thanks for the help. Last night, i lost the internet connection and could not try anything.
 
cabbage @DominikNeise
 
1:31 PM
@Soviero nicely down it could be done in bash but less readable
@Soviero however it fail if there is a $ in a line and not in password line
 
New problem, anyone know how to place a Python script inside a Bash script? I tried something like cat << EOF | python, but it didn't work.
 
@you should try dpaste.de/Tcqw
 
Potato Intrepid?
 
@DominikNeise Banana melon, potato?
 
@Soviero you can but it's dangerous
python -c '
print "hello world"
print "second line"
'
 
1:39 PM
Bananas even, Melon
 
@Soviero better write it in a separate file
 
@PeterVaro I didn't really get into the Narnia films
 
@XavierCombelle FUCK YA! That worked, thanks.
 
@Soverio until it will not work write in a .py file
 
@XavierCombelle It only has to work between today and Friday, then this script will never be used again, I'm okay with temp solutions
 
1:45 PM
@Soverio oh in this case it's ok but I seriously doubt it
 
@XavierCombelle It pulls stuff from the servers for PCI testing... I won't be in charge of the next PCI audit, so my script won't be used again.
 
@Soviero if your successor could have this script it would be nice for him
 
Is there an easy way to determine whether a string could be turned into an integer, without doing try: int(my_string)? People are bickering about using exceptions as control flow on one of my posts.
 
@XavierCombelle Fuck him, the last guy didnt give it to me
 
I'm thinking str.isdigit but I'm worried I'm forgetting some corner case
 
1:50 PM
@Soviero you are at a better place than me to judge
 
@XavierCombelle Sorry, I'm an angry sysadmin, go on with your happy-go-lucky dev lives
 
@Kevin that's your corner case? "-3".isdigit() --> False
 
@Soviero actually I'm an happy dev without job (and happy so)
 
good one.
 
@Kevin also: "+3".isdigit() --> False. And " 3 ".isdigit() ---> False
 
1:54 PM
which post @Kevin ?
 
@Kevin love lxml?
 
Not especially.
I have no strong feelings towards XML one way or another.
 
what does invalid predicate error mean?
  File "<string>", line unknown
SyntaxError: invalid predicate
thats all i get when using the answer to my latest question..
Google searched and someone used xpath to fix it..
 
This guy looks at a quote taken directly from docs.python.org, and says "You'll have to present better sources for your claim". What does he want, a written statement from the BDFL?
 
1:58 PM
this guy who?
 
Sounds like a fool.
 
The guy in the comment I linked to
 
His main tag is php.
 

« first day (1439 days earlier)      last day (3520 days later) »