« first day (1067 days earlier)      last day (3881 days later) » 

12:30 AM
guys why did I go into computer science?
 
becuase you enjoy it
 
but I don't
 
12:50 AM
well then why do you do it?
 
because I've lost control of my life
 
1:05 AM
I gotta go now, rhubarb guys
0
Q: strange deletion behaviour after removing last reference

Peter VaroI have a strange problem while trying to delete the last reference of an object. The code is: import sys import weakref class Ref: def __init__(self, name): self.name = name self.ref = [] def reference(self, obj): name = obj.name self.ref.append( ...

 
 
4 hours later…
4:39 AM
cabbage
 
5:30 AM
cb
*cbg
 
cabbage
 
5:47 AM
cabbage
 
5:59 AM
@PeterVaro the reason for MVC is that when there are multiple views (for example a cad software) then having all logic in a single presenter would mean lots of ifs. OFC if there is ever going to be just 1 V then the MVC<->MVP does not matter.
another reason would be a stateful view (so complicated)
 
6:14 AM
hello, there's any one know how to kill/terminate/stop a thread on python, just a single thread started from the same program? ( Just a thread ), I'm thinking on put exception on a method and call it to stop that thread :s
 
cannot stop from another thread right away, but within the thread, use thread.exit()
internally it throws the SystemExit exception, so things will not work if you use except: without any class...
 
nice tip just use exit() inside that thread
 
no, thread.exit()
well, sys.exit works the same way as well...
but also then not...
 
don't see anything about that method on python thread's doc
:s
 
that is bc you are looking into threading not thread
yet another reason to use python 3
in python 3 this silliness is now gone (threading vs thread)
 
6:33 AM
cabbage :)
 
well I'd start by rewriting your question, after skimming through it was very unclear what you were actually asking :D
and you have code formatting errors
ah now I understood. You have lots of extra code that only hinders understanding
you want to keep the 1st selected service in a hidden field
then with list comprehension filter it out from the choices rendered in the <select> or so
 
for the page 1 and 3 yes
the page 2 and 4 will be a simple form
 
7:11 AM
import antigravity
 
7:34 AM
 
cabbage vol
 
7:49 AM
Cabbage.
 
8:12 AM
Cabbage all Pythonistas. How goes world domination?
 
Cabbage guys
 
hello,
 
howdy @siluaty
 
I've marked an answer that I've given as "community wiki", can I put it back to normal?
 
@siluaty you have to flag the post, specify other, and say that's what you'd like
 
8:19 AM
ok, I'm going to do that...
 
Okie dokies :)
 
done, thanks :)
 
Welcome to the room btw
 
I'm going to wait for a moderator...
 
It might take a while as it's not really urgent, so you may have to be patient
 
8:23 AM
by the way, we've talked in another time about "xodul", a game...
 
Have we?
 
www.xodul.com
 
Yep - I saw that from your profile, but it certainly doesn't ring any bells...
 
yes, it's not well publicized
 
morning
 
8:31 AM
how goes the day @Paolo?
 
@paolo hello!
 
fine thx :) how's going there in the old Albion?
hi @siluaty
 
Albion!? We haven't called it that since I was growing up :P
 
ahaha :D i love that name :D
 
Not quite sure if the quality of Python questions is getting better, or just err, different
 
8:37 AM
@JonClements Why do you say that?
 
Can't be specific - just not quite the same questions that were asked a year ago (which is good) but... ummm... just feels different
 
i see a lot of very basic and easy questions... is this your feeling?
no efforts at all... but it's not limited to SO... sadly :/
 
@JonClements There's not a lot thats complicated in requests.
Its pretty easy to follow.
 
@GamesBrainiac are we having the same conversation?
 
@JonClements Sorry, I misred, I thought you were talking about Python requests! :P
But yea, I personally believe the quality of python questions are getting worse.
 
8:45 AM
we talk like those old men at the bars... sitting around a table commenting everything.... "when i was young.... we were taming pythons with bare hands! no ide, no debug! lucky ones had oscilloscopes!"
 
Yeah... what the hell was wrong with the abacus ?
 
hmm... it doesn't support recursion
 
Oh, you didn't have Abacus 1.1 then? It was limited edition...
 
argh.. i knew i was missing an update!
 
Yup - ours took 9 months to arrive, what with the invasions and such
 
8:49 AM
:D
 
heya @Paco
We're not far off making the top 4 rooms on the chat room listing
Not sure if that's a good thing/bad thing
 
it's probably only the evolution.... :D
 
heya @mino
 
9:08 AM
Hey @JonClements
_o/ everyone
 
\o_ Paco
 
sorry, was afk
 
9:48 AM
why do we have a minecraft tag?
0
Q: Coterie Craft Texture Pack 1.6.2?

Mạc Quốc Hưnghow to install Coterie Craft Texture Pack 1.6.2? http://www.5minecraft.net/

 
471 questions :P
make a meta post.
this is not a computer game support site
nor is it a support site for people who want help with mods/plugins creation/usage for games.
 
@JonClements How did you even find that
 
@Haidro appeared when I refreshed the homepage
 
Should I make a warcraft3 tag? and ask for help coding some triggers? :P
 
I have a scary feeling that may well be legit :)
 
9:54 AM
oh my
there already is a world-of-warcraft tag
 
Well, Excel should be SU
 
I need a project in python... Something to make...
 
and lots of posts about lua
 
but, Excel has VBA, so is assistance with VBA in Excel an SO/SU question
 
isn't there a excel.se ?
 
9:55 AM
Well, systems (be them games or not) that have languages...
 
lol
24
Q: Which Stack Exchange site is best for Microsoft Excel questions?

snthWhich Stack Exchange is the best site to ask questions about Microsoft Excel (as well as potentially other Microsoft Office and VBA questions)?

StackExchange is like rule 34. If you can think of it - someone already made a post of it somewhere.
 
Rule 34 ?
 
Don't ask
Don't look it up, too.
Umm, can someone explain this line to me, it's in a pygame example:
>>> size = width, height = 320, 240
How does this work?
 
size is a 2 tuple, and width=320, height=240
 
How though
 
10:02 AM
It's like i = j = 0, but with tuple unpacking included
 
view it as width, height = 320, 240
 
Ahhh
 
then size = width, height
 
That's pretty sneaky, I've never seen it before
Thanks both of you
 
it's pretty nasty
 
10:02 AM
Haha, you see it a lot in code golf ;)
 
It doesn't even look like valid syntax
 
Well, item, = item_with_one_item looks wrong as well
 
Oh, this makes pefect sense in the context of pygame
 
It does
 
Indeed, but a namedtuple would make more sense - they just weren't around when pygame was :)
 
10:04 AM
What's a namedtuple? I've heard of it before
 
lol
 
Still so much to learn
 
and you have like 3x my rep
How can you not have learned about named tuples?
 
Pretty much a cross between tuples and classes
 
10:05 AM
@InbarRose I guess that shows that the most intelligent don't have the most rep ;)
 
@Volatility you mean dictionaries?
 
hmm, maybe
you access them like attributes though
 
you can
its like a combination of all 3? :)
 
but you also can access them like normal tuples
:)
 
I don't see what you use them for
 
10:08 AM
for ease of use
 
For example you want a simple datatype that doesn't need any methods attached to it
 
same way you use a dictionary instead of declaring a million variables
 
You don't need to create a whole class
You just use namedtuples
 
its like a struct in C#
 
I don't know C#
 
10:08 AM
C, then
Same concept
 
Amg you guys know way too much compared to me @@@
I'm such a noob
 
Just like you make a dictionary to hold info like...

peoples_ages = {'Haidro': 14, 'Inbar':24}

instead of doing:

Haidro_age = 14
Inbar_age = 24
 
Lol
I'm 15 in 5 days :)
 
that's not good enough :P
 
10:11 AM
pls.
Oh, I think I get them
 
They're just overall easier to use than tuples
You don't need to keep track of which index represents what, etc.
 
So when @JonClements said "Indeed, but a namedtuple would make more sense - they just weren't around when pygame was :)", how would you use one
namedtuple(size, ['width', 'height'])?
 
pretty much
 
Size = namedtuple('Size', 'width height')
size = Size(320, 240)
At least something like that
 
okay, I think I get it
and then you can do
size.width and size.height
 
10:16 AM
yep
 
yeah
 
Helpful
 
indeed.
because you can obviously use getattr() on that with code a lot more readable than getter()
 
uh oh
Inbar, prepare to facepalm
I don't know what getattr is/does :x
 
wow
 
10:18 AM
facepalm
 
To be honest, I've never considered looking at it
But I guess I will now
 
Let's pull up the docs
 
docs.python.org/2/library/functions.html <-- Handy thing to bookmark :D
 
Thanks for the named tuples, I didn't know! It looks pretty good
 
Wow, getattr is just gaming the system
 
10:19 AM
@Haidro ... all objects have attributes
obj.attribute
but if you want to use that dynamically
you need getattr
 
Oh, right, GETATTRibute
 
getattr(obj, 'attribute')
 
lol
 
Sometimes I'm silly
No, I'm always silly.
 
10:19 AM
Let's see, any other functions I don't know...
 
not to be confused with __get__, __getattr__ and __getattribute__ - but let's not go there :)
 
hehe :)
 
And __getitem__? Or did I just ruin it
 
hasattr and delattr, perhaps? ;)
 
10:20 AM
Can we use getattr with the current module to get functions ?
 
__getitem__ is for indexing
 
Not to be confused with operator.itemgetter()
 
@AnttiHaapala no one mentioned a single presenter, as a matter of fact in both MVC and MVP you can connect several view+presenter/controller to a model -> that's how your example a CAD system is working. Although MVVM is a different beast, you can use the same viewmodel with any number of views, thanks to its binding mechanism. So my question is still open: why are people using MVC over MVP?
cabbage folks!
 
@Paco I believe so
 
It expects a string
 
10:21 AM
@Volatility Yes I know that, but I just said it because it starts with "get" :P
 
getattr(__main__, 'func_name')
 
Oops, forgot setattr :P
 
stahp it
Although I could understand what it would do...
brb
 
a small code-snippet I keep around...
class AttributeDict(dict):
    """
    allows the dictionary to be accessed by dic.attribute.
    dic[key] == dic.key; both for get and set.
    """
    def __getattr__(self, attr):
        if attr in self.keys():
            return self[attr]
        else:
            return None
    def __setattr__(self, attr, value):
        self[attr] = value
 
@InbarRose I tried with '__main__' and __name__.` __main__` is not defined
but None of them work
 
10:23 AM
are you in idle?
 
I tried with a script i.py
TypeError: getattr(): attribute name must be string
 
did you even read the error?
copy your code
 
Yes, I did
def bla():
print 'a'

getattr('__main__', bla)()
 
ugh
 
getattr(__main__, 'bla')()
You had it the wrong way
 
10:24 AM
Oh yeah /o\
I am not fully awake
Thanks
 
I keep on typing getattr as gettatr
It's very frustrating
 
getather :P
"get at her"
nevermind.....
 
` getattr(__main__, 'bla')()`
`NameError: name '__main__' is not defined`
Nevermind
It's probably something stupid that I am doing
I'll check that later
Thanks anyway
 
Is __main__ even a thing?
 
getattr(sys.modules[__name__], 'blah') will work
or strangely, so would just blah :)
 
10:32 AM
@JonClements
 
bbiab
 
thanks, it works :)
 
Hey guys, I have this query working perfectly: stackoverflow.com/questions/18846345/postgresql-group-by-or-not
When I try to put that in python code, I get this error:
Exception: Unexpected data type <type 'datetime.timedelta'>
 
How are you getting the data ?
something like cursor.execute(query); cursor.fetchall() ?
 
cr.execute("select
agenc.name,
sum(cast(servic.end_hour as time) - cast(servic.begin_hour as time)) as time_
from
services as servic
join services_jobs AS jobs ON jobs.id = servic.job_id
join agency as agenc ON agenc.id = jobs.agency_id
where servic.id = %s
extract(month from servic.service_date) = %s and
extract(day from servic.service_date) = %s
group by
agenc.name", [5, 9, 16])
Yes. value = cr.fetchall()
 
10:37 AM
First of all, you need to use triple quotes for this multi line request
 
Yes, I'm using. I didn't put in here. I use something like:
cr.execute("SELECT ......" \
"......" \
".....")
 
You don't need backslahes ;)
 
Use a multiline string though
It's much cleaner
 
I need because I want to have the code perfectly seen, if not the query will be too long.
I'm using multiline string.
 
Using single quoted strings with backslashes is not using multiline strings
Multiline strings are something like this:
"""Here is
a multiline
string."""
 
10:39 AM
I don't think my problem is on the mulitiline strings or backslashes.
 
I know, I'm just a strong advocate for clean code
(when not golfing, of course) :P
 
Ok, I found the line where I'm getting that error
sheet.write(linha_, i + 1, values[1], style_main)
Where values[1] = to this: sum(cast(servic.end_hour as time) - cast(servic.begin_hour as time)) as time_
Is it because I have group by clause, and the column 'time_' isn't in it?
 
why do I have a feeling you're trying to populate an Excel spreadsheet from a SQL database?
 
It's from a postgreSQL database, yes.
 
right.. well keep going :) My crystal ball only has so much power...
 
10:50 AM
What else do you need to know?
The whole query is on top of this conversation.
 
From your query, do you get errors when you do the fetchall() ?
 
Ahh, I think I'd just found where it could be.
The column "time_" returns (for example) 10:00:00
And it should return 10:00
And I'm quite sure that's why I have that error.
I tried to split, but it says datetime.delta has no split attribute (or something)
 
yeah, that's a timedelta
how are you using it ?
 
Where?
 
the value that contains the timedelta
what is the line that causes the error
 
10:59 AM
Ahh, this one: sheet.write(line, 1, values[1], style_main)
 

« first day (1067 days earlier)      last day (3881 days later) »