« first day (2630 days earlier)      last day (2543 days later) » 

00:25
Cabbage
what's cabbage
00:38
hey u cbg
wim
wim
@ArneRecknagel I reused part 1, and just wrote a new "wtf" opcode. github
~3 lines change from the part 1. You do have to understand the loops of the original code though.
 
2 hours later…
02:26
what is an acceptable way to create a synonym method.

    class A(object):
        def x(self):
            return 2

        def y(self):
            return self.x()
personally I'd do y = x
Though that may be undesirable if you want to have different documentation for each function (or a different .__name__)
02:48
Even then, do you specify it directly below?
def x(self):
    return 2

y = x
I know that works. I'm after your opinion and you've share it and I'm appreciative
 
1 hour later…
04:37
@AnttiHaapala :D I had 98, and then it got one downvote. I don't think I can get anymore on it in time to be honest.
 
3 hours later…
07:46
cbg
does someone have any idea about Common Crawl and how to parse or search in it
08:23
@piRSquared Usually yes, unless there's a whole family of functions that do similar things like x:
class Product:
    def buy_with_cash(self):
        ...

    def trade_for_immortal_soul(self):
        ...

    def buy_with_card(self):
        ...

    # make a convenience function using our preferred payment method
    buy = trade_for_immortal_soul
08:35
what is cbg?
cabbage?
thanks buddy.
i couldnt figure that out and it gave me a headache lol
green bean
 
2 hours later…
10:51
cbg
got a question: can print be considered as a method?
not exactly a method, but it is a function (Python 3), and keyword in Python 2.
11:23
Well, it's absolutely not a method, because it belongs to no object
11:44
Stupid question. I'm looking at some code for cartesian to spherical coordinates which is currently like this:
def CART_to_SPH(selfs, vals):
x,y,z = vals
r = np.linalg.norm([x,y,z])
phi = 180./np.pi*np.arctan(y/(x+1e-18)) + (x<0)*180
theta = 180./np.pi*np.arccos(z/(r+1e-18))
return np.array([r, phi, theta])
I have two questions about it; the + (x<0)*180, is that just so that everything is from 0 to 360 instead of from -180 to 180? And if I were to instead remove that and add - (z<0)*180 to the last line, would that essentially be the same but then making it -180 to 180?
I think it doesn't. But I'm having trouble with programming a driver that uses cart to spherical, where z is much larger than x and y, and x and y fluctuate around 0 due to noise, causing the (x<0)*180 to keep flipping which I'd rather not have it do.
12:45
Cabbage
12:58
@user129412 Yes, (x<0)*180 adds 180 if x<0. But you should probably be using numpy.arctan2. Also see numpy.degrees.
@user129412 you can format your code in future with Ctrl + k or ``.
Hey, I'm trying to use psycopg2 and I found out that I need the PostgreSQL database server running. Why do I need a local database server running at all??
@user129412 The 180° / -180° border can be annoying. In this answer I show how you can test if an angle is within a given range, you may find it useful.
Thanks, I will have a look at that. It's giving me a lot of trouble
@nobism "Psycopg 2 is mostly implemented in C as a libpq wrapper, resulting in being both efficient and secure. It features client-side and server-side cursors, asynchronous communication and notifications, COPY support."
13:08
@Simon and why do I need a local database server running at all?
To be both client-side and server side it would need to be on a server.
PostgreSQL is also a database server
Psycopg is a wrapper for libpq - C Library. To run libpg you need a database.
PostgreSQL.
13:34
For those of you who use pycharm, is it normal that it takes up 1.244 MB?
And this is when it's sitting idle not doing anything.
Sadly, it is
Is it possible to bring it down?
I think it automatically uses less memory if you don't have enough. You're only at 65% though, so does it really matter?
It tends to freeze from time to time. I am not sure if it's because of the memory though.
I guess it was an update in the background that was causing the problem-
On Windows, that's very likely, yes.
13:45
Do you guys think it is a ok idea to create a FAKE bot-net out of threads and queues? We are talking like 5-10 threads.
The question is why?
Why would you do that?
Just a fun idea to test, and maybe teach some ppl. about something along the way/ learn some stuff myself(duh).
13:58
rbrb
14:09
cbg.
What part of a computer is most used when a thread is initialized(CPU, RAM, idk GPU?)?
You know what scratch GPU, dumb idea, :P
\o cbg
what do u mean what scratches gpu
The GPU(graphics processing unit) is best suited for trigonometry, and most 3d shape s you see on a computer screen are made out of triangles.
scratch GPU = forget about it
Sorry
Didn't see the user who asked.
14:21
I know what a GPU is... also a GPU is really good at doing arithmetic not just "trig". But I don't understand your question about ;what scratch GPU'. Maybe Cold is right and we should move on
Sorry, I meant thinking that the GPU is used intensively when initializing a thread is a dumb idea, not my idea, my bad
rbrb!
 
1 hour later…
15:28
@AshishNitinPatil +1
16:14
Well this could be neat: numworks.com
Python graphing calculator
With a trial online emulator
heard it on Python Bytes this morning
where does it say it's a Python graphing calculator ?
interesting.... I wonder how it deals with the floating points :D
though it seems like it's their own engine that also is able to run Python
I don't think the calculator part is built in Python
ahh that would make sense
now I'm wondering if they have eval or exec :P. Maybe they just expect iterable of numbers to be returned...
16:21
For a calculator that's supposedly the first one to have Python on it, the Python details are lacking :|
99$ is cheap for a calculator... I remember buying a certain model that my university required me to use. It was well over 150 and this was online used... the store at my university had it around 250+
$99 is pretty close to curiosity buy territory for me, despite their woefully feature-lacking site
their support forum is a subreddit that's mostly in french
And this is their user manual
this is how I get myself into trouble on Kickstarter
:P
I'm on the same boat as you when it comes to backing random things I find "cool" on kickstarter.
my god my AoC day 13.2 solution is taking forever to run. Is there a non brute force solution ?
DSM
DSM
16:37
@cᴏʟᴅsᴘᴇᴇᴅ: again, at this point, every one-line answer has multiple dupes.
Fifteen-minute cabbage for all.
cbg
The TI-85 is a graphing calculator made by Texas Instruments based on the Zilog Z80 microprocessor. Designed in 1992 as TI's second graphing calculator (the first was the TI-81), it was replaced by the TI-86, which has also been discontinued. The TI-85 was significantly more powerful than the TI-81, as it was designed as a calculator primarily for use in engineering and calculus courses. Texas Instruments had included a version of BASIC on the device to allow programming. Each calculator came with a cable to connect calculators (simply a three-conductor cable with 2.5 mm phone connectors on each...
^^ I've still got my old one of those in a drawer :)
DSM
DSM
I lost mine. :-( A friend had one of the kits so you could program it remotely and I wanted to port Marble Madness to it..
@JonClements Do you use it for everything?
@Simon well yeah... how do you think I'm online now, hey? :p
Just thinking: " I don't want to know the age or OS of his computer"
16:43
@DSM that first bit sucks... I know I've come across a few website into it as a retro-thing and how to interface with it and competitions for people to do gaming on it etc...
re-cbg. I still use my Casio programmable, although it's not as powerful as a TI-85, and it doesn't do graphs. IIRC, it has a 4 bit CPU.
I feel sorry for this OP. I hope he hasn't put too much work into his photo editing program, since he's going to need to make major changes to it. And if he's like a typical newbie, his code won't be very modular... stackoverflow.com/questions/48009783/…
cbg @DSM, sad news for the oldest goalie to ever win a cup eh.... I assume your family watched him play before....
my day 13.2 on repl.it takes 70 sec to run :\
DSM
DSM
@MooingRawr: my father did. And Bower's on my potential list of exceptions..
wait Horton... Nathan Horton ? sorry I just realized who was on your list... Also I really wished he could have seen us win a cup before the end... :\
HP 48GX was my baby. Purchased with my first student loan
The HP 48 is a series of graphing calculators using Reverse Polish Notation (RPN) and the RPL programming language, produced by Hewlett-Packard from 1990 until 2003. The series include the HP 48S, HP 48SX, HP 48G, HP 48GX, and HP 48G+, the G models being expanded and improved versions of the S models. The models with an X suffix are expandable via special RAM (memory expansion) and ROM (software application) cards. In particular, the GX models have more onboard memory than the G models. The G+ models have more onboard memory only. The SX and S models have the same amount of onboard memory. Note...
16:50
70 seconds is nothing. Check out some of these timeit results I posted a few days ago. All times are in seconds. stackoverflow.com/a/47925603/4014959
Guess we gotta win one for him
@PM2Ring did u just like the tutorial site :D ?
@MooingRawr Sorry. Clipboard mixup.
@piRSquared I've never seen the HP 48 calculators... it's all TI 85s where I went to school :\ Was it reliable durable as the Ti85
@DSM No complaints there. Added my answers to the original question.
Yes, it was beautiful. But the reverse polish removed it from the mainstream. I'd say it was Betamax to TI's VHS
@MooingRawr
16:55
@PM2Ring huh interesting... I know 70 isn't long for some brute force but for the AoC question it does seem so :( but I'll take it I guess..
VHS... now that's a thing I haven't heard of in a few years... Gotta protect my childhood VHS' :P
@piRSquared So sad. RPN is sublime. Now I want a RPN version of Python. :)
@PM2Ring let's not be silly now. We'd lose every Django dev and all the attention Python gets with it.
Use to work with a bloke that had his own RPN calculator - he was the only one. He couldn't get his head around using normal calculators and no one wanted to borrow his :)
@JonClements Sounds like my days with dvorak keyboard and IT support
Oh - if you use dvorak - that'll make two people I know of that do :)
16:59
@piRSquared I'm not suggesting that RPN Python replace normal Python, just that it'd be nice to have it as an option. OTOH, I guess I can always just do a bit of PostScript programming if I feel the urge to do RPN stuff. :)
@JonClements sounds smart actually. He didn't have to deal with lending his calculator to people...
Not anymore... I switched to querty to "Fit in". Who is the other.
Oh - some guy that's fairly decent at Python - last seen wearing a ninja costume and santa hat :)
@JonClements I had an HP RPN calculator back in college. I loved that thing.
Oh, nice! I liked it better. But was really annoying sharing any hardware with anyone. Partner at my old firm tried to teach me a lesson about leaving my computer unlocked. He'd planned on leaving a nasty surprise... but couldn't when he discovered none of the keys were in the correct place.
17:02
@piRSquared just checking you know I was referring to Martijn, right? :p
anyway guys - gotta run for a bit - laters.
yes (-:
rbrb
@piRSquared that's the one I had, too
@Code-Apprentice agreed, I loved that thing
my physics prof let us put anything we wanted in the calculator's memory
had all my formulas. Even learned to use the built in equation solver.
spent many a math and physics class browsing through the tome of a user manual
lolwut! progressive prof.
17:05
and I bought the full programmer's manual for it, too
Yeah, my non-math/science professors were curious about me using a calculator on exams :P
you used it in other classes?
cheater!
I'm trolling you now (-:
@piRSquared Don't worry. I'll flag you. :)
@MooingRawr Those timings are a great illustration that the speed of Python code can be unintuitive because stuff that runs at C speed is just so much faster than stuff that runs at Python speed. And so an algorithm that's essentially O(n²) can do better than an O(nlogn) algorithm until n is quite large if the O(n²) stuff is running at C speed.
17:14
Thanks @Simon glad you're looking out (-:
Anything helpful!
(I'm also after the flagging badge) :D
 
1 hour later…
18:36
500 flags?
You can write an SE Apps script that makes API calls to flag comments. Build a ML classifier (MNBC should do) that identifies spam like +1, thanks!, or me too!
...and flag it.
@Simon It's pretty easy once you figure out the kinks of the auth related stuff
SE? Stack Exchange? ML? MNBC?
Machine Learning? Naive Bayes?
@PM2Ring fair points, but at the end of the day, my solution is running at 70 seconds on average :P and that's what I was bummed out about :P
@cᴏʟᴅsᴘᴇᴇᴅ Thanks. Not sure I'm that desperate to flag +1 and thanks.
Your call. It's the laziest way to a marshal badge.
18:46
@MooingRawr Fair enough. I don't do AoC, and I haven't been in Chat for the last few days, so I have no idea what a typical speed for that task is.
@cᴏʟᴅsᴘᴇᴇᴅ Yeah like not doing anything at all.
Will consider it though.
idk either it's okie, I hope your holidays has been treating you well PM.
@cᴏʟᴅsᴘᴇᴇᴅ correction... laziest way to a marshal badge
@piRSquared That is the embodiment of a deep desire for minimal conflict.
You're just here to learn and teach, not be a janitor.... that's cool too.
I should let you interpret all of my behavior
19:01
@piRSquared I have my own style :)
But hopefully it's similar to yours.
37/500 by the way.
@Simon It would be nice if you could modify your style slightly. Try to consolidate your chat messages a bit better. Eg, those last 3 lines could have been a single post rather than 3 separate posts.
I might consider it. I just realize there's more to say when it's too late.
@Simon I appreciate the camaraderie but it's the ratio that matters. Your ratio is (37 / 692) vs my (21 / 104321) You are ~250 times more prolific relative to your reputation.
So i just compared wim and David's day 13.2 to mine.... I see I still have a long way to go :( and I over complicated my answer like usual... :\
@MooingRawr 2017? I ask because I'm working on 2016 right now.
19:09
2017....
basically I had David's solution but bloated through a class and some other module ;(
@piRSquared What does that mean. I'm afraid I don't understand (again).
@Simon You're allowed to spend a little more time thinking before you submit. ;) Each post is a separate record on the server. I have no idea how efficient the storage mechanism is, but I assume it's somewhat more efficient to store a single message than multiple messages. Of course, we have lots of server space, but it's still nice to be efficient.
You've worried me about talking now.
@Simon It's me being silly. I'm using silly ratios to extract meaning. You compared your low 37 to my low 21. I'm pointing out that my low 21 is stretched over a much broader usage base and its miniscule-ness is more exaggerated. Again, me being silly.

@MooingRawr my 2017-13 was very short... but I didn't time test it.
Sorry, I didn't mean to worry you, but it would be appreciated (by me and several other room owners) if you could avoid those streams of single-line posts.
19:17
@piRSquared @PM2Ring Ok I understand now. Thank you
@piRSquared it can be done a in like 3 or 4 lines from what I saw.... :\ sigh time to tkae a break from AoC ;\
19:43
Hello gentlemen. I don't wish to interrupt anything, but I was hoping to get some insight into an HTTP POST request using Python's requests library.
I'm using Mouser Electronics' SearchAPI, specifically the SearchByPartNumber operation:

https://www.mouser.com/service/searchapi.asmx?op=SearchByPartNumber
What is your question, good sir?
I've been given a custom API key from Mouser. Using requests.post(), my understanding is that I will need to provide the following:
1. `url = 'http://api.mouser.com/service/SearchByPartNumber'`
2. `data = {'key':API_KEY, 'data':post_data}`, where `post_data` is the entire block of text with placeholders changed?
*shudder* a SOAP api...
json dump it before passing it to data. You might need to encrypt your stuff, depending on how secret your key is.
I don't know how to do that.
I don't think data is going to look anything like that. This is xml, not json
19:51
Yeah, I think it is xml
I was wondering if I could replace the placeholders in the entire text box with my part number and then pass that into the data variable.
Disregard my earlier comments then, I know next to nothing about SOAP except that no one uses it
I use soap!
So there is this example post: stackoverflow.com/questions/18175489/…
19:53
I'd hope so!
We're talking about capital soap though
Although I'm not sure how to include my custom API key
I notice something about pandas questions is that they come in bursts, and during certain slots in the day. Interesting, I caught the last wave, but I guess that's it for a while.
You'd think we'd be able to analyze and predict when those bursts happen and then optimize our time to catch the waves (-:
As data science men, it'd be shame on us if we couldn't :D
19:56
^!
I don't think those API docs even mention what you're supposed to do with your api key
and it uses soap
I'd probably just scrap the project
lol
Yeah, and life is hard enough...
 
1 hour later…
Okay curiosity killed the cat but I keep seeing cbg in this room and have not a clue as to what that means.
that means you haven't read our room rules: sopython.com/chatroom
the answer is there :D
quietly moves to rules page
Ahhh makes sense. Thanks @MooingRawr
21:35
recbg
21:45
One of the best things about the Python room if you ask me.
come for the conversation, stay for the cabbage
woah woah woah. I came for the people stayed for the cat cute animal pictures.
MGE
MGE
22:14
hey
how can I convert 0.00000070 into 70?
I mean 0.00129
turn to 129
0.000003 -> 3
uh, you can't. Why does 0.00000070 become 70, and not 7? Or why does 0.000003 become 3, and not 30?
MGE
MGE
I want to get all the numbers after the last 0
I mean
well I guess you can if the inputs are strings, not numbers
MGE
MGE
0.0000030000
it should take all values after first number that is not 0
in this case 30000
Hmm, I'd use regex I guess:
>>> import re
>>> re.search(r'[1-9].*', '0.0000030000').group()
'30000'
22:22
@MGE what is the type of the input? Is it a string or a float?
s.lstrip('0.')
Not tested
...I knew there had to be an easier solution
also s.split('.')[0]
Now, my brain may be fried, but I still find it hard to believe that that ^ produces the expected result
Not tested huh? :P
22:29
I mean s.split('.')[1] (-:
Nope, doesn't strip leading zeroes
fine, I've been shamed into testing... '0.0000030000'.split('.')[1].lstrip('0') Which is silly compared to s.lstrip('0.')
Yeah, vaultah definitely won this round. Unless the inputs never were strings to begin with, in which case we're all losers.
/shakesfist
22:56
I never realized coding in a team could be so difficult... I'm currently debating whether to completely rewrite this junkheap of a class or to copy/paste some very-similar-but-not-identical lines of code into 17 separate places
23:07
if won't get fired:
    do it correctly
else:
    if integrity is more important than having a job:
        do it correctly
    else:
        sell out
what if this is an uni assignment that's unreasonably big and we might not be able to finish in time?
sell out
Sir, yes sir! o7
and fire the freeloaders
We don't have any of those, surprisingly.
23:19
in that case my follow-up of "or execute" won't be relevant
doesn't it go against some kind of universal law if your school assignment team doesn't contain any freeloaders? :)
We even have plenty of capable people, just one or two are a bit... well... not so experienced
maybe I'm the freeloader D:
hehehe, plot twist :D
If you can't identify the freeloader...
I wish all the freeloaders in our world were like you
I do feel a little bit like a freeloader, because I think I spend 85% of my time debugging random java problems instead of actually coding
23:26
isn't that what coding really is? :P
well, usually you debug your own mistakes and silly slip-ups, but this is different. A lot of the frameworks/toolkits/libraries/whatchamacallits we're forced to use just randomly refuse to work and/or refuse to give you proper error messages
I spent 2 hours looking for a bug today because the GUI toolkit we use doesn't throw an exception when it can't find an image file, and instead it just silently doesn't display the image >_>
May I ask which GUI toolkit?
javafx
So this is more like a wild goose chase than debugging, really
more like javaffs amirite? (sorry, I don't even do any java)
hehehe, that's pretty accurate, yes :D
23:33
My that JavaFX is powerful. It makes tkinter look a bit platform dependant.
Wikipedia: "desktops, JavaFX supports Windows Vista, Windows 7, Windows 8, Windows 10, macOS and Linux operating systems.[6] Beginning with JavaFX 1.2, Oracle has released beta versions for OpenSolaris.[7] On mobile, JavaFX Mobile 1.x is capable of running on multiple mobile operating systems, including Symbian OS, Windows Mobile, and proprietary real-time operating systems.

A commercial port of JavaFX to iOS and Android has been created under the name "Gluon".[8] This allows a single source code base to create applications for the desktop, iOS, and Android devices."
(see full text)
even Javafx isn't so bad that it should be compared to tkinter
Yep. There isn't a python equivalent is there?
I don't think there is, no
I wounder how PyGtk competes.
Ah gtk.org/screenshots. Yep mobile too.
I made most my GUIs with gtk. It's alright, but it has its weaknesses. Next time I make a graphical program I'm going to try some alternatives
Gtk currently doesn't work with python versions > 3.4 on windows, for example. And that's been the status quo for more than a year already.
23:44
There isn't that much choice. in Python: wxpython, pyqt, pygtk, tkinter, windows own gui.
Yeah but in C there's even less to choose from. One horrible ancient GUI, wxwidgets or Gtk. That's why I went for PyGtk.
At least my gui would both look the same in both languages. @Rawing Then there's the Msys problem under Windows. Linux commands on Windows.
Well Rhubarb all. :)
btw, it freaks me out when you say pygtk. pygtk is the old version gtk2. You really should be using gtk3 :P

« first day (2630 days earlier)      last day (2543 days later) »