« first day (2698 days earlier)      last day (2264 days later) » 

6:03 PM
I've now spent 30 mins on finding something that I am shy of posting, well done 30-min-past me
Yessssss, finally found the oldest (stupid chat case-specific-search, "Hello"). Good ol' times when Jon Clements and InbarRose were around.
 
Aug 14 '12 at 11:05, by Martijn Pieters
I did my best
 
@AshishNitinPatil I really only want to except the error for that one instance, how might I do:
 
At least @poke is still around :-p
@MartijnPieters That's what you want to think :-p
 
    try:
        return requests.get('https://xkcd.com/'+str(comic_number)+'/info.0.json').json()
    except JSONDecodeError if comic_number = 404:
        continue
[in a way that's correct syntax]
 
@AshishNitinPatil “visited 2806 days”
 
6:12 PM
@toonarmycaptain Do you want to catch the error as well as the comic_number 404 ? Or are they related? Your ask isn't very clear.
@poke But have you improved your efficiency‌​? :D
 
I think this is my first message:
 
I’m pretty sure I am way more efficient than Jon now (in terms of rep) :P
 
@AshishNitinPatil I only want to except the error for comic number 404, as that's the only one that should return no data because the page doesn't exist. Otherwise (say that error on 543) I don't want the error handled by the except clause.
 
@toonarmycaptain then you already have your answer, your if comic number 404 block would encompass the try except, not the other way round
 
6:16 PM
@Code-Apprentice Those were the times
 
That seems to be before my time here
at least as a regular
hmm...my latest streak is only 71 consecutive days. I must have missed a weekend.
 
@MartijnPieters ?
 
@RobertGrant ??
 
<removed>
 
Oh, I see. The message was before you said that.
 
6:19 PM
On a train, messages can get out of sync.
 
@AshishNitinPatil Seems like an unnecessary overhead to compare to 404 each time though...
 
Obligatory "have you benchmarked your code and confirmed that the one if response == 404: conditional is your biggest bottleneck?" comment goes here
If you're fetching fewer than a million pages I wouldn't worry about it
 
wim
if you're doing any network request I wouldn't worry about it
you could check if code == 404 a thousand times just to be sure, any overhead compared to the actual socket stuff will be minuscule
Jul 4 '14 at 16:44, by wim
hello world
 
6:33 PM
Fair enough
 
Somebody post that one chart that says "If one CPU instruction was one second, then..." followed by a bunch of things like "a cache miss would be five minutes" and "a ping would be a million billion years"
 
wim
a warm welcome from Martijn. What happened to Zero Piraeus ?
not familiar with the chart, sounds interesting!!
 
I couldn't find it after two googles ;_;
 
@Kevin LMGTFY
user image
7
 
27 quatloos have been credited to your account
 
6:37 PM
how much is that in furbies?
 
wim
I do remember a post where someone or other (John Carmack maybe?) was saying they could get a packet across the world faster than they could get a pixel rendered on the screen
 
wim
Jul 4 '14 at 17:14, by Badger Girl
@wim hi
Huh, there was a Badger Girl
 
I think I remember that.
A moment of silence for all of the Internet friends that were last seen 1000 days ago
 
wim
6:43 PM
time.sleep(60)
 
I can send an IP packet to Europe faster than I can send a pixel to the screen. How f’d up is that?
 
user6568562
Pretty f'd up
 
And he shows his work at superuser.com/a/419167/116696
 
As a European, I might be less impressed than I should be
 
My first message:
May 10 '17 at 4:34, by toonarmycaptain
Hi, was looking at the sopython What Should I Read http://sopython.com/wiki/What_tutorial_should_I_read%3F
May 10 '17 at 4:35, by toonarmycaptain
Was following the links, looks like there's a Python 3 edition of Learning Python the Hard Way now, was wondering if anyone had an opinion, also wanted to suggest someone update the site? Don't know where to comment aside from here.
I was very new...
 
6:59 PM
I think my first ever comment here was "hello". :-)
 
My first conversation was with Andras eating my head about my fgitwing
 
We've all come a long way, haven't we
 
wim
@Kevin Wow, carmack actually came to answer the Q himself. Props!
 
Ah here is an early one:
Oct 27 '17 at 0:05, by Simon
No I think he is. When I come here (not always logged in) he is always there. I may be here anytime between 8am and 2am (next day) and he is here longer than me.
This was about AndrasDeak btw.
 
wim
these are only a few months old
 
7:07 PM
Well I did not arrive here until quite late, this was one of my earliest messages though.
I also remember when everyone here had much more rep than I did. ;)
 
can a socket sendall request timeout? if so what would be the cause?
 
I discovered something interesting today. Escape sequences now work.
Windows included.
 
Please elaborate. Escape sequences have always worked on my computer.
 
7:23 PM
For example print(chr(27) + "[2J") no longer returns [2J.
It now clears screen. Colours can be printed, new freedoms for Windows users!
 
wim
you're still screwing around with clear screen stuff?
 
Yes and I succeeded. I will update my repo later today.
 
Interesting. When did this happen? 3.6?
 
wim
why the bizarre obsession with clear screen
 
Unpopular opinion: you really can make better-looking textual UIs if you can clear the screen.
 
7:27 PM
@Kevin It's Windows actually not Python. Windows added inbuilt support for ANSI with the Windows 10 build. It does need to be activated.
 
Yes, 99.9% of applications are just fine being an unbroken stretch of the history of every input/output that occurred in that session, but for that last 0.1%...
 
wim
why would print(chr(27) + "[2J") ever returns [2J
print always returns None
I think you're getting confused somewhere
 
s/returns/outputs/ I presume
 
@wim returns prints
 
wim
oh, well that has nothing to do with Python and everything to do with the terminal you're running in
 
7:29 PM
Mm hmm, and now the windows cmd terminal treats it as an ANSI escape code, which is new
 
wim
and if you're on Windows, you probably have a broken terminal and various other broken things
 
One less broken thing than yesterday :-)
 
wim
because most windows users are scared of the terminal and like to clicky clicky
 
The use is unusual though:
import os

print ('Hello World")
os.system('')
print ("\x1B[2J")
 
If you're saying "you have to do os.system('') before windows will recognize escape codes", that's weird, because they work straight away for me, no system calls required
 
7:33 PM
Today, I taught the intern how to use a debugger
 
@Kevin No mistake it's required or it won't work.
The problem arises for those under Windows 10, there is still no support. I found a solution for that as well using colorama.
 
wim
@Code-Apprentice tomorrow, teach them how not to write bugs :)
 
he already has a natural talent for that
 
wim
the easiest way to write no bugs is to write no code
 
7:37 PM
oh...my brain elided the "not"
i.e. "how to write bugs"
 
wim
wow that's some bogus clear screen, it should leave the prompt at the top of the window
what happens if you do ctrl+L ?
 
@Kevin Are you are running from cmd. Try running by double clicking in a file you will see what I mean.
 
@wim It puts "^L" in the prompt.
 
Windows is great :)
 
what happens if you type another python statement?
 
7:41 PM
@Kevin How did you take that? I want to show you what happens on my system.
 
@Simon Ok, I'll try it... Hmm, it prints "" instead of clearing the screen.
 
Created a month ago and it has 18K+ stars? Must've gone viral on reddit or something...
 
@Simon I use GifCam but I'm sure there are a dozen other good gif recorders out there
 
wim
@cᴏʟᴅsᴘᴇᴇᴅ likely. the issues and PRs are huge
 
@Code-Apprentice It displays them pretty much normally
Leaving a blank spot where all the previous statements were
@wim 1,649 issues XD
 
7:45 PM
Quite clever though
It has more stars than the cpython repo /facepalm
 
So I guess the cmd terminal is different from the terminal that appears when you double-click on a .py file. If nothing else, the icon is different.
Possibly I could solve this mystery by looking up the default file associations, but meh
 
It is I certainly cannot do that.
@Kevin I'll show you what I get later. Got to go.
cbg
 
Name: .py | Current Default: Python. Ok then.
 
wim
gosh, I'm one star below Kevin on the starboard starboard
 
Deploying attack spiders now
 
8:02 PM
Hey guys, is there an alternative to dict i can use to prep data for writing to a json
I need to write it like this:
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
{"name": "CommunityStructure", "size": 3812},
{"name": "HierarchicalCluster", "size": 6714},
{"name": "MergeEdge", "size": 743}
...
 
wim
dict is your best bet
 
can dict support multiple things of the same name though
 
wim
no but you don't have multiple things of the same name
 
They're all at different levels, right? shouldn't be a problem.
>>> {"a": {"a": {"a": "b"}}}
{'a': {'a': {'a': 'b'}}}
No errors here.
 
wim
fun fact, you can actually parse json with dupe keys
and you can even do it without losing data by using the object pairs hook
don't ask me how I know this
 
8:06 PM
hmm
 
Your data structure works, provided you replace that ellipsis with the right number of ending brackets
(Never mind that the order of the keys has changed. Use OrderedDict if that matters)
 
So atm I can easily zip up each name and size value
so I can hardcode name and size
 
> The chances of re-entry are slightly higher in northern China, the Middle East, central Italy, northern Spain and the northern states of the US, New Zealand, Tasmania, parts of South America and southern Africa.
so...like everywhere except India
 
@Code-Apprentice i wonder if you could use laser ablation on things like that
 
What's laser ablation?
like shooting it with a laser?
 
8:18 PM
 
@Code-Apprentice yea, you cause for gassing to occur that causes an impulse in the opposite direction
 
This vexes me
 
The three human caused plagues
 
I have yet to use PHP, been doing Python based web-dev, do i count as a web-dev?
 
what is the one technology that identifies you as a web-dev?
 
8:21 PM
TCP/IP? :-P
 
well.... I have nowhere to go with that because it is very true.
In other words: You can't rally if you're always going for the winner.
 
I may as well Well Actually my own post: there are webs other than the internet, so the internet protocol isn't mandatory
 
I thought that was covered more generally with "interwebs"
 
@Kevin I hope this isn't too fast but here it is on my system:
http://i.stack.imgur.com/NlcHm.gif
That is from cmd.
 
@Simon Most curious.
 
8:29 PM
Let me try that in PS.
Nope same under PowerShell
 
@Simon @Kevin What version of windows?
 
Windows 10 Pro
 
@Code-Apprentice Windows 10 Home.
 
wim
what does existance mean
 
I have Pro before on my old other PC so I'll test it sometime. Not available at the moment.
@Kevin Lucky you having Hyper-V that means you can use x64 OSes on VirtualBox, we Home users don't have that :(
 
8:34 PM
Completely wasted on me I'm afraid
 
Same effect in Python prompt as well.
 
hmm I guess it's of no importance - but what is "faster" in python? dict.keys or dict.values (in my case both are unique, and I create a list, grab all data from a db and then fill in the other again - so I'd iterate over the keys or values twice anyways)
 
@Kevin Thank you for telling me about that software that is useful to me. :D
 
GifCam is a very useful tool when you're in the business of being right and proving to everyone else that you're right
 
I noticed. Ideal for the green bean who does not know what a terminal is. :)
 
8:40 PM
@paul23 I suspect it's keys, by a nanosecond
Let's see. Their definitions are right next to one another at github.com/python/cpython/blob/master/Objects/… so they should be easy to compare
They're almost completely the same except for the interior of the final for loop. dict_values has, like, one extra layer of pointer indirection.
 
wim
dict.keys and dict.values are both attribute lookups, and should be the same speed.
if you want a better answer than that, give a better question
 
@wim Meh the better quest is: if you have both unique "keys" an "values" (from a list or something). - you need to iterate over one ('A') of those for processing. and then you update the corresponding other ('B') based on the results. Should 'A' or 'B' be the key or the value of a temporary dict?
(And no I can't just iterate over the list and do the updating in place: I am in the process of speeding up my application and part of the updating is connecting to a database, so I'm combining htat in a single query)
Chose 'A' to be the key as that seemed also more logical
 
Well it's easier to update a value than a key. d[1] = 2 is fast, d = {3 if k == 1 else k: v for k,v in d.items()} is slow
Or are you saying that you're constructing a new dict from scratch? It's pretty much a wash then
 
def load_task_orders(self, task_list, order_table, connection):
    orderids = {task.order_id: task for task in task_list if task.order_id is not None}
    stmt = order_table.select().where(order_table.c.orderNr.in_(orderids.keys()))
    res = connection.execute(stmt)
    for order in res:
        tsk = orderids[order['orderNr']]
        tsk.order = order  # disputing with myself if I should convert this from RowProxy to a simple dict...
 
@MartijnPieters you're not unique any more. J.S. Bueno got bronze in :P
 
8:52 PM
If your loop involves database I/O then that's definitely going to dominate runtime so you shouldn't fret too much about processor cycles
Even if you only talk to the database once and update the dict a thousand times
 
@Kevin 900 times actually :). - And previously the "tasks just loaded themselves" on updating the order_id.
Using a property. - But those 900 connections turned out to be deal breaking bottleneck.
 
Mm hmm. I remember your problem from the other day. I had no useful advice so I just sent positive vibes. Did you get them?
 
heh I didn't turn insane yet!
 
I also changed my facebook header to "in support of reasonable connection speeds" to raise awareness
 
I've been working on this problem for about 3 weeks now, first in js where it wasn't so much a speed problem but the async/await caused impossible to debug memory leaks. After two weeks I just reported it to the ORM library. So now I'm just redoing the whole background process in python.
Worst is: this is my first "officially paid job". And I'm having such a delay/problems on the first thing I do.
 
8:58 PM
My officially paid job is like 95% cursing at libraries that don't work right
 
hey guys
 
github.com/balderdashy/sails/issues/4313 25 days and still no reply :(
 
how do i tell json to ignore commas as a seperator for pretty printing
 
Mm I don't know if you can exert that much control over json's pretty printing
 
@Skyler I hope you don't mean if it's in JSON format.
 
9:02 PM
the json library .dumps() function can do formatting if you pass the indent arg
i just want to exclude commas from said seperators
for when it writes to the file
 
wim
haha
 
readability preference
 
Yes indentation is one thing, removing commas is like murdering JSON.
As far as I know anyway.
 
@Simon yaml?
I thought yaml was a strict superset of json; and it doesn't use commas
 
Indeed no commas but json parser cannot parse yaml.
 
9:04 PM
keep the commas, just dont do a newline after them
 
wim
>>> d = {'k1': 'v1', 'k2': 'k2', 'k3': 'v3'}
>>> json.dumps(d, separators=('', ''))
'{"k1""v1""k2""k2""k3""v3"}'
jury is out on the readability gains ... :)
This is quite nice though:
>>> json.dumps(d, separators=('spam', 'eggs'))
'{"k1"eggs"v1"spam"k2"eggs"k2"spam"k3"eggs"v3"}'
 
Wow yeah lovely and readable.
 
lol
I mean I get this
    {
        "size": 112008.0,
        "name": "1 GENERAL FOREMAN OF HOISTING ENGINEERS"
    }
 
wim
use indent=False
 
1 sec, not quite rendering right
    {
        "size": 112008.0,"name": "1 GENERAL FOREMAN OF HOISTING ENGINEERS"
    }
even better would be this:
 
9:08 PM
Why are you "pretty printing" then in the first place?
Why not just use json.dumps?
 
because I end up with 2008 elements in one line
its a nested json so pretty helps until it gets to the deepest layer
 
Yes but you want that right? (as I see above)
So you want indentation but only up to the second to last layer?
 
yea, though I guess dont you mean last layer?
 
Well that's probably a thing you'll have to do by hand. And I guess it's easier to do by first loading the json back in again.
 
also I just noticed something weird
my "name" entry of the parent most element gets renamed by a "name" of a child element
dmain={"name":"chicago",
    "children":dchildren
    }
chicago gets replaced with the last "name" of an item in dchildren
 
9:15 PM
That shouldn't happen. It means something is wrong.
 
^ about all we can tell. Maybe post some code if you need help.
 
for dep, item in test_df.groupby('Department'):
    tmp1 = list(item['Employed'])
    tmp2 = list(item['Job Titles'])
    tmp = dict(zip(["{0} {1}".format(a, b) for a, b in zip(tmp1, tmp2)], list(item['Annual Pay '])))
    d = {"name": dep,
         "children": [{"name": key, "size": value} for key, value in tmp.items()]
         }
dchildren.append(d)
Employed is how many people of a Job Title were employed and so this zips those together, then zips the sum annual pay of 22 Software Engineers with that title
done over many departments each with many job titles, appends to dchildren then goes off to dmain
 
any reason why my code still returns "too large" when I enter a negative number? pastebin.com/qnKzdh6h
 
that doesn't look like python
 
@CoderCat wrong room
 
9:21 PM
@CoderCat Maybe try chat.stackoverflow.com/rooms/10/loungec You have the wrong room for C++ this is the Python room.
 
@Simon irrelevant
 
I forgot the identation on the append there as i copied it over, append is in the for loop
cant edit now though
 
@Skyler it's hard to understand what's going on. But as always just walk through it with a debugger and print all containers you create by comprehension. (print(d))
 
man data cleaning can be such a pain in the ass
I've already cleaned this data too, just have to reformat it
 
9:26 PM
I need that book!
 
@Simon you just managed to piss of a room full of SO chatters...
 
i dont see pissed comments
 
<insert annoyance here />
 
@Code-Apprentice Probably the whole of SO actually :P
 
9:28 PM
Got a copy already :P
 
c++ is idle
 
@Skyler that's cuz you aren't in the room where Simon redirected someone to ask a C++ question
 
isbns??
 
so I thought I should try here since python is like c++ but worse
3
 
XD XD XD
 
9:29 PM
I mean simular
 
@CoderCat thank you for your interest, good luck elsewhere
 
@CoderCat You're doing this on purpose right?
 
Erm OK, that is a first
 
jk rowling
 
eyeroll.gif
 
9:31 PM
normally the javascript room is more helpful than the c++ room but its busy in there so
 
@CoderCat There's also this thing called stack overflow.
 
there is indeed
 
@CoderCat the room rules are pretty explicit on the subject, this is not up for debate.
 
from * import * as *
 
Garlic, insert pic of cat
 
9:33 PM
 
i was an idiot
 
@AndrasDeak that was a perfectly acceptable cat tho :D
 
But tbf, the answer for your problem is kind of silly. Just look into datatypes and what happens if you overflow/underflow an integer.
 
@CoderCat Do you also go to the doctor to ask for financial advice?
 
@vaultah RO cats are superior ;)
 
9:34 PM
i wasnt writing dmain to my dumps guys
 
maybe next time
 
I feel angry that a C++ question has been posted here but also amused because they reckon it's like Python, wow that must be a world first XD
 
I don't think this needs any more discussion
 
folks are getting triggered here
 
9:35 PM
and doggos
 
@Skyler Yeah, we now have a picture of a cat but not of dogs.
I demand equality!
 
 
I have a little piece of code that I've been trying to make it work all day long could anyone have a look at it?, it is supposed delete images in a folder taking as input coordinates that are supposed to be linked by their index, but it is having an offset in the image part, coordinates are well divided but images deleted doesn't look that way link: dpaste.com/2QJCP35
 
last time I asked in c++ some fools downvote rigged me!
 
@paul23 Your wish is my command!
 
9:40 PM
@CoderCat I've been there. But just make sure you exhaust all already written material before you post questions. C++ especially is a language you really have to "learn before trying": The problem you posted now is a typical text-book problem (though more C related than c++) and if you had read about overflows & what unsigned means you'd have found the culprit.
 
Could you please use the C++ room for C++ discussion
 
right
 
9:56 PM
@CoderCat I suggest you read the help section for some tips on improving your questions.
 
is it possible to eager load poloymorphic entities ?
 
Pet peeve: When people post a question stating they "want to get rid of those u-prefixes" without giving an actual reason
 
"u, gross!"
 
no, u
 
Because at that stage of learning, they are probably unfamiliar with join() and so do the following:
lst = [u'a', u'b', u'c']

with open('somethin.txt', 'w') as outfile:
    outfile.write(str(lst))
At which point, the u has mysteriously appeared so is one more thing to tackle on top of the [ and ]
(Assuming that they didn't actively define the strings as unicode in the list)
 
10:25 PM
... you know what, that is probably closer to the truth than I like to admit.
Then the complains start rolling in that the "jason file" is incorrect
 
wim
@Aran-Fey tell them to upgrade to Python 3, no u prefixes :P
it's technically correct, and they go away for about 10 seconds
 
The best kind of correct.
 
I know jason. He's a cool cat.
 
wim
I wonder if anyone has named their kid json
 
Searching for that is giving me an uncomfortable number of results
 
10:31 PM
What number of results are comfortable?
 
0
 
Yeah, that's true
 
[] it is!
Kids have been tortured more with few other names i suppose.
 
From what I can tell, the big spike in people called Json pre-dates JSON though
 
wim
the potty training would be called json.dumps
8
 
10:35 PM
Reminds me of an article I read recently about some parents with a terrible naming sense. Buckle yourselves in if you plan to click this link.
 
The first name literally "ate" my head, so I stopped reading more :/
 
@Aran-Fey "How to Make your Kid HVIII You for the Rest of their Life"
 
If you edit it 5 more times I can make a "8th time's the charm" joke
 
g'night
Bit of a shame, for a second I thought the conversation would move on to how people struggle with roman numerals
 
10:49 PM
I have a sudoku solution as a dictionary where 'A1' represents the first integer of the sudoku. I'm trying to convert that into a 2D NumPy array. How do I do this?
 
you should create a nested list which you pass to np.array, probably
 
@Aran-Fey Centuries of inflation would have rendered them pretty cumbersome to use anyway. Also, they can't represent half of the population's balances (zero or negative)
 
or just allocate an empty array and set each element in a loop over your dictionary
of course your situation is unclear but whatever gaps are in your description should be straightforwardly filled by you when solving the problem
@AshishNitinPatil what if I told you that there are uses for numbers beyond money? :P
 
@AndrasDeak Thank you!
 
I was just pointing out obvious flaws relevant even during that time. Forget about the future.
 
10:55 PM
My history is patchy but I don't think there were bank accounts back then
 
Debt has always existed in my history books :-p
Plus, splitting something (fractions) wouldn't go so well either
 
not to mention easily breakable python code: I = L
 
We'd get SO questions like "X * V == L giving False, send help (PS - Romans have captured me)"
 

« first day (2698 days earlier)      last day (2264 days later) »