« first day (1846 days earlier)      last day (3114 days later) » 

12:00 AM
to contradict myself....sometimes you gotta do what you gotta do :P
:D
 
12:22 AM
@JonClements A cabbage coloured Zebra? What do you mean? :)
 
user559633
@KevinGuan I think he @ mentioned the wrong Kevin earlier
 
user559633
550 rows processed. Total duplicate row count: 1089. hmmm
 
user559633
Either I've made an important breakthrough in databases or my code sucks and I should put on some coffee
 
12:40 AM
@tristan Well, maybe :P
 
1:18 AM
Ah, good evening
 
hey Aaron!
 
hey idjaw
I've been working on packaging up my html stuff
I think I've decided on an MIT license
 
oh cool. How's coming along?
 
I'm probably getting the cart before the horse on everything, but I need to get it up on github, or I'll look like a loser who never follows through.
I did a git init today. I need to define some __all__'s and I think it'll be ok to put up.
After it's up, I'll need to come up with some TODO's
which will include unittesting, wheel setup, travis setup, docs, etc...
 
awesome. :) let me know when it's up. It's not the biggest thing, but coveralls is a fun little thing to add.
just to add MOAR tags to your git :P
 
1:31 AM
what does that imply?
 
coveralls? or the tags?
 
If that means I want contributions, I'll want incremental changes. Any architectural changes will need some one on one discussion.
 
nono
 
MOAR?
coveralls?
 
non..I'll reword :)
s/tags/badges/. What I meant by that was the badges you add on your github from tools like travis, where you can set the status of your builds
coveralls uses coverage so show the % coverage via unittests
 
1:34 AM
oh, cool. yeah, sounds good.
 
this is mine just to give an example: coveralls.io/github/idjaw/dot-manager?branch=master
 
I think I need an end-to-end acceptance test that tries to use every feature and compares that, parsed, to a static page.
@idjaw Stuff like that is what I want.
 
I only use travis and coveralls, but codecov is also an alternative for coverage
 
oh codecov looks interesting
 
after using continuous coverage for a while, I've grown to quite like it, especially for running tests on platforms I don't readily have access to
travis now does OS X, although beta
 
1:42 AM
Yep. That's very helpful. I've encountered issues with certain network tests that broke on Mac but not linux
 
it's a bit of a pain to set up right due to different system level package management
 
Agreed, but I find it a necessary pain. A solid test environment is priceless.
 
my most recent project for fun ends up being able to support OS X so I wrote this .travis.yml for it, if you want to see how one might do it
 
nice! Makes sense though. :)
 
stole some ideas from other projects that are much bigger, so I simplified it into one file. Splitting out platform specific things into its own scripts probably make sense for those larger projects.
 
1:48 AM
absolutely. That's what we do with our puppet recipes. Putting it all in to once massive set of conditional statements is just asking for trouble.
 
Leaving it like this until travis formalizes their OS X support. It's just a toy FUSE thingy right now
 
yeah, your travis file is fine. It actually gives me some ideas on what to do with mine. :)
 
:) cool!
 
I'm realizing that I should tighten my tests to validate platforms too.
so travis can help with that
 
I only found out they had OS X support just recently too, and given FUSE does have an OS X equivalent (under a slightly different name) it made building this rather interesting, but to see it actually work was quite rewarding.
still no Windows support, but I think it's on their tracker still.
 
1:55 AM
I'm intrigued with how well the windows coverage will go. :)
 
github.com/travis-ci/travis-ci/issues/216 they closed it after getting OS X support up, but said will update that when they have ideas on how to do Windows
 
hmm licensing...that's a good point
single license...single instance....single queue of people waiting for their tests to pass haha.
 
I guess they can make that a subscriber only feature if costs are a concern... unless they can convince Microsoft to sponsor that
 
that would be pretty impressive if MS got onboard for something like that.
 
dev.windows.com/en-us/microsoft-edge/tools/vms/linux They did something like this, so maybe it's already being worked on
 
2:04 AM
hey that's pretty neat. I feel silly not knowing about this. That's really neat.
oh cool vagrant
 
it's actually a good thing that Microsoft is taking testing more seriously these days
 
I didn't think I'd ever be this interested in testing as I am.
 
The power comes when changes are needed. Build all the tests, make sure they all pass, then change this one critical thing/refactor/whatever and see whether things still work the way they should - and when they do great, when they do not, even better because it shows the problems either in the change or the original concept, or whatever.
 
yeah. It really gives you the confidence you need in your code to know what each change brings to the overall system. It might seem slow at first, but it just makes things so much faster in the overall process.
 
2:21 AM
basically like any good investment: some upfront cost, receive good payout later.
 
3:18 AM
yay, squashed some commits into one.
 
3:39 AM
oops, forgot to tackle the __all__
 
3:57 AM
I thought wheels was supposed to mean no setup.py?
ok, I'm making one regardless, I guess.
anyone around?
 
4:27 AM
I'm here now.
 
5:15 AM
still here?
 
Yep.
 
I'm sticking my version string in an otherwise empty file called VERSION in the package for the package __init__.py and the repo's setup.py - sound ok?
 
Maybe if you have some kind of config or .ini file, the version could be an entry in that file?
 
would that go in the package root or the repo root?
The package shouldn't expect the rest of the repo to be there, right?
 
I'm really not sure.
I don't work with git much (at all).
 
5:32 AM
I've been following this guy's blog on the subject: hynek.me/articles/…
 
@PM2Ring right :-)
CBG all
 
Cbg sir.
 
5:54 AM
Hi mate how is you day
 
It's Antti!
I'm about to catch you!
 
6:07 AM
Ah, so my __init__.py and my setup.py both find the VERSION file with a relative open - in __init__.py it's just open('VERSION') and in setup.py it's open('html/VERSION') Is this likely to be problematic?
If the working directory of the process is different, it won't work, will it?
 
Hi everyone..
 
Yep, won't work... gotta find and use the absolute path...
this should do it to get the dir?? HERE = os.path.abspath(os.path.dirname(__file__))
 
Am trying to calculate the CPU usage of a single PYTHON program, i tried using "resource" library in windows and i was unable to achieve the desired result. I hope "resource" library will be working only in Linux.. Any suggestion to work in windows?
 
@Mathan try psutil
@AaronHall what are you trying to do with the version?
 
6:23 AM
dry
 
@idjaw I tried psutil too, its calculating the entire system usage data but i like to calculate particular python program details.. Can u help me out in this?
 
particularly on something that should be incrementing all the time.
 
@idjawI tried psutil too, its calculating the entire system usage data but i like to calculate particular python program details.. Can u help me out in this?
 
@Mathan did you try this method? stackoverflow.com/a/27933304/1832539
@AaronHall do you have something committing back to your version to increment it?
 
The closed/reopened thread seems to have stabilized after a mod closed and reopened it.
 
6:29 AM
Nope
Anyways, I think I've got it sorted, I'll use the __file__ attribute to give me the directory.
 
I haven't done this with travis, only on jenkins, but maybe in the after_success you can do a git commit for an incremental value
 
cool, maybe I'll try to do that.
 
can probably make use of git tags too in that process
some more info on tags with travis: docs.travis-ci.com/user/deployment/releases
sleep time. rbrb
 
7:04 AM
you can use git tags for sure
git tag v0.0
git commit --tags -m "added tag"
git push --tags
I think thats it ... I dunno I always use tortoise
@AaronHall
and then you can get it later with git describe --long it will look like v0.0-23-asdasdd
the v0.0 is your tag you pushed
the -23 means it has had 23 commits since that tag
so you can use that to generate major/minor/revision type versions
(although I would recommend also storing the hex hash (that clearly isnt hex in my example) ) as that is really how to get back to that point in time
 
7:31 AM
ok
 
Today's mystery user. He has 38 gold badges out of which 35 is for famous questions.
 
So I totally mostly didn't rip off any one thing to create my setup.py, it's pretty much from scratch, please review: github.com/aaronchall/HTML5.py/blob/master/setup.py
 
Well, he's been a member for quite a while, with some old classic questions.
 
@JRichardSnape thesis? :)
 
@AaronHall to be printed tomorrow
 
7:40 AM
He as also answered seven questions :P.
 
Score
Master's thesis?
Anyways, my setup.py probably has too many classifiers, and I just noticed I still haven't put the packages arg into it.
ok, 3 hours past my bedtime, goodnight everybody!
 
7:56 AM
Night night. :)
 
Hey up all
@JRS you're a hero and an inspiration.
 
8:23 AM
Cbg :)
 
Cbg!
 
8:53 AM
Cbg Autobot
 
*Maximal
Okay, Autobot is fine too.
 
9:14 AM
Is it possible to add 2 arrays with different dimension....e.g A = (5732,1), B = (529,1)
and I want C as (5732,529)
 
'add'? C = (A[0], B[0])?
zip(A, B)[0]?
 
a kind of like tat
 
next(izip(A, B)) would probably better if you only care about the first element
 
9:39 AM
good morning
wanted to make a list of lists,
nodes=[[]]


nodes[0]=[3,1,2]
nodes[1]=[4,1,2]
it works for the first node, but on the second one i get an index out of range error
 
That outer list only has one element.
Starts with [[]], turns into [[3,1,2]], then you try to access the second element that doesn't exist.
What do you want to end up with?
 
first of all , thank you for helping me :)
have a bunch of nodes, they have an index.. and several integers connected with them
so i wanted to make a lists of lists
outer list for the index, inner list for the integers
i know, i could probably load something like numpy and put it all into a matrix
 
I mean, what would your resulting data structure look like?
You can think about nodes as a dictionary instead: nodes = {0:[]}.
Then with nodes[0] = [3,1,2], you'd have {0:[3,1,2]}.
But, as you see, there's no key of 1, so nodes[1] would fail.
 
is that preferable to lists within lists, i later have to manipulate and combine these nodes
in some contraction algorithm :)
 
Not preferable, I'm just clarifying that there's no second element to replace.
What nested list structure did you expect to get after nodes[1]=[4,1,2]?
 
9:49 AM
that the element 1 in the outer list
contains the list 4,1,2
 
There is no element 1.
Please write the actual object you wanted to get.
 
i am sorry.. i dont understand object in that context :( i wanted somethign like nodes[x]=[y] where x is the index... and y is a list
 
If you did print(nodes), what do you want to see from that?
 
oh all my nodes,, sorted by their index and then their list content
like nodes[0]=[....] nodes[1]=[...]
 
print(nodes) would only do that if you had something like nodes = 'oh all my nodes,, sorted by their index and then their list content'.
I want to see the actual list you expect to end up with.
Don't just give me a high-level description; that's not helping.
 
You expect to get all that from just nodes = [[]]; nodes[0] = [3,1,2]; nodes[1] = [4,1,2]?
 
i am aware that i have to read in the data
but i wanted to see if the structure works first
 
This is like telling me you're trying to add floating-point numbers, and you're doing 0.2 + 0.1 but it's not right. You could tell me all day that you want 0.2 + 0.1, and Python will do that, but if you said you wanted 0.3, that would explain what you want and why you weren't getting the result you expected.
You still haven't told me what you expect nodes to be after nodes[1] = [4,1,2].
 
a list of lists, where the element with the index 1 contains a list containing 4,1,2
 
Obviously, the idea of what you think it should look like and the idea of what it would actually look like are different, as it works in your head but not in the interpreter. I need to see what it looks like in your head.
Don't describe it in English; show the literal list. Please.
 
9:59 AM
outer list : 0,1,2,3,4...
inner list the numbers above
i really dont get it
 
That is not a literal data structure.
I mean something like [1,2,3] or ['a', ['b', 2]].
The thing you actually want to end up with.
 
[0][1,2,3]
[1][4,6,7]
 
That's a syntax error. Please just show me what you thought you would get with a print(nodes) if your code didn't produce an error.
 
exactly that above, and that is why i came here :( because it does not work like i thought it could
 
Enter the above into an interpreter. It will say SyntaxError. What did you think you would get with print(nodes)?
Since it doesn't work like it thought you would, describing it in general terms isn't enough.
You're talking about the second element in a list... a list that only has one element.
I don't know if you want to append something, or if you want to change one of the elements, or what.
 
10:04 AM
i want to fill it
 
Look.
 
i first wanted to create an empty lists of lists
 
I don't know what you expect to see in nodes after the code that produced an error.
If I don't know what you wanted to get, I can't tell you how to get there.
 
:(
 
And your description of "the second element" doesn't help, because there is no second element.
Do you really not understand what I mean when I ask what you expect the result of nodes to be?
 
10:06 AM
i guess i really dont.. i am aware that there is no second element.. i just wanted to create one
at position 1 in the outer list
 
>>> nodes = [[]]
>>> print(nodes)
[[]]
>>> nodes[0] = [3,1,2]
>>> print(nodes)
[[3, 1, 2]]
>>> # nodes[1] = [4,1,2] # magically works
>>> print(nodes)
what goes here?
If Python worked the way you expected, what would that last line say?
 
[0][3,1,2]
[1][4,1,2]
 
It will never say that.
Each of those lines is two lists mushed together.
Are you unfamiliar with list structure?
 
it seems so
 
Do you want [[3,1,2], [4,1,2]]?
 
10:10 AM
yes
 
WHY COULDN'T YOU HAVE SAID THAT HALF AN HOUR AGO?
 
i am sorry ?!
was not trying to prank you
i thought it was clear from ? nodes = [[]]
 
Heh.
This is why I don't help people anymore :P
 
mh seems that now its clear what i would like to do.. iam not getting told how to achieve it.. thats unfortunate
 
I'm sorry.
What you need to do is start with an empty list and append to it:
nodes = []
nodes.append([3,1,2])
nodes.append([4,1,2])
 
10:22 AM
oh .. appaerently i did not even know that
nodes[0]=[3,1,2]
so that is just wrong
 
This will produce [[3, 1, 2], [4, 1, 2]].
Yes, that syntax is only when you want to change existing elements.
 
damn yes...
thank you very much !!
 
Well, now you know about append(), and much more importantly, what people mean when they ask you what literal object you were expecting to get (especially with print(x)).
 
You should probably read some python tutorials as this is pretty basic stuff
 
i googled list of lists, and clicked on every result on the first page.. unfortunately i did not understand it, or it was not applicable
 
10:25 AM
cabbage: I love python community for example: nedbatchelder.com/blog/201207/…
 
thank you very much for that link, i will
 
10:59 AM
nodes[int(component[0])] = [int(item) for item in component[1:]] ,get object has no attribute error.. browsed stackoverflow..people said it was a parenthesis error in similar cases.. looked up how to read stuff into a dict, but it looks alright to me when i compare it to the tutorial
 
@hmmmbob what's the rest of the error? You aren't explicitly accessing any attributes, there.
 
TypeError: 'builtin_function_or_method' object has no attribute 'getitem'
with open(abc) as data:
for line in data:
#print line
component=line.split
nodes[int(component[0])] = [int(item) for item in component[1:]]
thats my whole code
 
'line.split' != 'line.split()'
 
no idea why there are no tabs shown anymore
 
You can't index into the method str.split.
 
11:06 AM
i thank you very much
i will shoot myself soon though
all that was missing was()
now it works like a charm
 
Had you tried print component you'd have spotted it pretty quickly
 
seriously thank you, i did not even think about a mistake i maybe made earlier
 
As it would have been <built-in method split of str object at 0x...> rather than a list of strings.
 
Hey,

I am using Django ORM and PostgreSQL, but i can't take any rows by field numeric which must contains more than 10 digits.


In [1]: Person.objects.get(person_long=1234567890L)
Out [1]: <Person:0x000000ccc000000>

In [2]: Person.objects.get(person_long=12345678901L)
Out [2]: Error trackback
His sql prints like that SELECT "person_id", "person_long" FROM Person WHERE "person_long" = NULL

Strange bug from the newest django, what i have installed on Windows.
 
11:31 AM
@EdChum, right now you told me that SO is not a code-writing service, that's why I didn't write the code. — user2393267 16 mins ago
 
Cabbage folks
 
cbg
 
What's the best way to work out all the potential exceptions that a function can throw?
 
I've never found a particularly good one - read it to see which it throws explicitly, and then think about which the wrong kinds of inputs would lead to (generally TypeError or ValueError).
If you're lucky the dev already did this and listed them in the docstring!
 
Gorram it.
That would make an excellent little standalone code analysis tool
 
11:39 AM
That would be a pretty tricky task, I suspect.
 
Aye, it'd be a hellish little mix of code coverage analysis, and working out if specific things are caught.
 
There's an answer here for exceptions that are explicitly raised: stackoverflow.com/a/1591432/3001761
But the other class would be a nightmare!
 
I've found to avoid going through complicated steps like that, a good IDE will allow you to go through the code quite nicely and you can work accordingly once you find out what exceptions will be raised on the method you are calling. This is a case where imo digging through the code would be more beneficial than trying to predict what the code might do.
Also, if a particular package is well unit tested, this information would be easily found in the unit tests, so you can handle accordingly as well.
 
Even then, I suspect you'd only see tests for errors that should explicitly be raised, in many cases
 
11:57 AM
Hey folks!
Long time no talk :)
How are you all doing?
@IntrepidBrit Bro! You're still alive :)
 
cbg @GamesBrainiac
 
@jonrsharpe! Its been a while since edx, how've you been?
 
Good thanks, how are you?
 
Pretty good. Drinking tea, actually :)
 
Me too!
Small world
 
12:00 PM
So, hows life? Doing anything interesting?
 
I'm about to start a new job, actually - as of the 23rd, I'll be a Senior Software Engineer at Pivotal Labs in London
7
 
cool, congrats jon
 
@jonrsharpe Hey! Thats pretty neat!
 
:o) thanks
 
Congratulations are in order :D
So, what technologies do they mostly work with?
 
12:04 PM
@jonrsharpe Congrats!
 
I think their go-to is Ruby on Rails, but it's consultancy so whatever the client is working in.
 
Hmm, well good luck man!
Super happy for you :)
 
stackoverflow.com/q/33543981/3001761 (dealer's choice on no MCVE or trivial typo!)
And thanks all, appreciate it
 
12:23 PM
is there a canonical dupe for this, it comes up a lot: stackoverflow.com/questions/33544234/…
 
wanna hammer it? :)
 
jon hammered it a minute after it was posted. :)
 
@jonrsharpe Nice one, Jon!
 
\o/
 
12:25 PM
python-list-of-lists-changes-reflected-across-sublists-unexpectedly is the usual dupe target.
 
@PM2Ring but then you risk "but these are dictionaries, not lists"
And that way lies despair
 
Good point.
 
sigh...true
 
@idjaw Good shout going through any unit tests. Praise cabbage for open source.
@GamesBrainiac Hey stranger, how's it going?
 
@IntrepidBrit Doing all right mate.
 
12:28 PM
A comment explaining that the same principle applies to any list of duplicated objects can help. But not necessarily.
 
Then you get into mutable vs. immutable, and might as well have just written an answer in the first place!
 
@jonrsharpe congrats :)
CBG all
 
ta :o)
Lunchtime - rbrb
 
It's not every day that I can hammer a question as a dup of one of my own questions.
 
12:53 PM
morning all
 
If you are going to post a question to the exercise I gave to you, please translate it correctly. As @Kevin said: the exercise was to check if one of the rectangles completely contains the other rectangle. — Turing85 1 hour ago
Mmm, "teacher found out" style schadenfreude.
 
@TigerhawkT3 I added a comment to that question. I hope I made my point clearly enough. :)
 
Looks more like mild annoyance than "I'm giving you a zero" though. Fireworks unlikely to ensue.
 
Sadly replaces packet of popcorn into cupboard.
 
dis_gon_b_good.gif plays disconsolately backwards.
 
1:01 PM
@Kevin Teacher's best answer has 17 upvotes + a 200 point bounty: stackoverflow.com/a/31213903/4014959
 
He almost seems more annoyed that one of his students posted a bad question on SO.
 
Yep. He obviously doesn't have a problem with students using SO, per se.
 
More like "how dare you make me look dumb by rephrasing my wonderful question into an ambiguous mess"
 
That too.
 
I think this question is an implicit duplicate of this
If that is the case then the answer to it is pretty bad :p.
 
1:16 PM
@VigneshKalai yes, that answer isn't very helpful, although defining the list in that way would solve the problem
 
That "just add commas!" answer reminded me of the Ned Batchelder article that Xavier linked earlier: nedbatchelder.com/blog/201207/…
From stackoverflow.com/questions/33543566/… "please can you either comment the code or explain it". I was so tempted to comment the code in the OP. :) They obviously didn't do much research - the top Google result for their question's title is the relevant Wikipedia article, complete with commented Python code.
 
"Help us out please, thank you, in python please" - at least they're politely lazy!
 
1:31 PM
"The linked duplicate was one of the top results when Googling your question's title" is something I have to say far too often.
 
@jonrsharpe Sure, I'll help you out. Just click here!
 
Haha, that's nice
I've often used this
 
My new gif is 5 MB and I'm beginning to question the wisdom of displaying them all at once on my repository's readme.
 
Ooh pretty
 
1:41 PM
Having no images in the readme seems bad, since I don't want people to click around my directories to find stuff.
 
Those would probably be more efficient to as videos. Can you use HTML5 video tags on that page?
 
Nice, Kevin.
 
Not sure. I assume github markup is similar to SO markup.
I could have static images linking to each animation, but that's not automatable and some animations don't have an "interesting" frame. I could downsample each animation to be smaller and use fewer frames, but that may blow out the fine detail of the line based ones, and make the fast-moving ones choppy. I could do some kind of asynchronous load carousel thingy, but only if I can execute arbitrary scripts on my page, which I don't think I can.
 
@TigerhawkT3 I assume you mean some kind of mp4 file. Depending on the player, looped stuff tends to glitch at the loop point, which can be somewhat distracting. Also, mp4 is crappy for line art, since it uses an extension to the same techniques that JPEG uses for compression.
 
My stuff is like 80% lines :-/
The ideal solution, I think, is "discover that the gifs can be losslessy compressed much more than what ImageMagick does by default"
 
1:49 PM
No rasterized copy is going to have the same perfect quality and small size as the original vector animation. You'll have to choose between the bulky GIFs and compressed MP4s. =\
 
You could do (some of) your in real-time in JavaScript, rendering to a <canvas> element, like my Pendulums thing I posted the other week. Although then there are problems with browser differences: eg, I was showing the pendulums off to someone today on their Windows machine running some version of Chrome: the balls all came out in grey rather than in colour. :(
 
@jonrsharpe "A friend told me it was rockin' though. cough"
 
@IntrepidBrit "My second hand, though, knows all about it..."
 
Another alternative is SVG, which has some native anim abilities, but it can also be animated via JavaScript. It looks great for vector stuff, but it can be glitchy when doing anims of bitmapped data in SVG, as I discovered a month or so ago.
 
@Kevin though you could use the wiki of your repo ;)
 
1:54 PM
@Kevin ImageMagick's generally ok for GIFs, but I still prefer gifsicle.
 

« first day (1846 days earlier)      last day (3114 days later) »