« first day (1788 days earlier)      last day (3176 days later) » 

8:00 PM
@JacqueGoupil Probably more than a responsible adult ought to.
 
I must have been halucinating, because that has no votes now, but I swear it had 2 a second ago.
 
DSM
! I saw it at -1.
 
I have a quick question that I can't find an answer to anywhere. Exporting plots from matplotlib to Excel with xlsxwriter. Syntax for images: worksheet.insert_image('B2', 'python.png'), but how can I substitute 'python.png' with a plot? Needless to say: worksheet.insert_image('B2',plt) does not work. Any tips?
 
Yeah, that was me, but I'm witholding judgement for a while. It's potentially a decent question, they just need to get an MCVE in there.
 
@davidism ahhh... the insanity is further progressed than you suspected :p
 
8:02 PM
Should I ask that as a question on SO? I guess it's super basic, so I'm afraid I'll be downvoted to oblivion if I do.
 
Being able to type Please [edit] to include an [mcve]. is so nice.
 
@StewieGriffin I'd imagine you actually need to save the plot as an image first (possibly to a TempFile, if that's all you need it for)
 
DSM
I think you'll have to render the image into a BytesIO object. xlsxwriter doesn't have native support for matplotlib, I don't think.
 
maybe xlsxwriter is clever enough to allow in-memory files (I don't know, I haven't touched a spreadsheet in years.
 
@DSM I don't think BytesIO works, since it's asking for a filename, not a fileobj
 
8:04 PM
Has anyone had go at any other libs apart from goose,readbility or boilerpipe. I am getting arund 85%. But the no. of webpages is too large for me manually scrape off each.
 
DSM
@tzaman: the syntax is just a bit different, worksheet.insert_image('B5', 'python.png', {'image_data': image_data}).
 
@AbhishekBhatia stop asking
 
You've already asked once, please don't spam chat with your question.
 
He's asked more than once.
 
@davidism Looks like I forgot to set it up again on my new machine. I need to get the automated builder working again. Will ping you if it is up again
 
DSM
8:05 PM
Here is the a relevant doc link.
 
oh, okay.
 
@davidism I know, I meant within the previous N amount of time.
 
Ah, neat. Didn't see that option
 
...for some value(s) of N. Evening all.
 
Evening @ Richard Snape
 
8:08 PM
Yam, I typed "an [mcve]", which sounds right until it's expanded to "an minimal". And I noticed just after the edit window.
 
DSM
Ha! I will learn from your example and not be mocked by my peers.
 
Pffft, look at DSM, not being mocked. What an idiot.
 
@DSM, that one looks nice. :) I have to find out how to go from plot to BytesIO
 
DSM
Something like image_data = io.BytesIO() and then plt.savefig(image_data, format="png"). Basically you just tell matplotlib to save your picture into this pseudo-file instead of a real one.
 
I have a perpetual inner conflict about "an" vs. "a" for acronyms beginning F, L, M, N, S or X. Although X rarely comes up in that context, unless you've got a Xylophone Appreciation Society, or something.
 
8:13 PM
"an" or "a" "HTML file"?
 
am
 
DSM
I say "an HTML". I think I'd write it too, but I'm less sure of that.
 
also an hotel, an hypermarket
 
Depends on whether you pronounce HTML as "hitmil" or "timmel" (with a silent H)
 
8:14 PM
"an" or "a" "historic event"?
 
I don't know why - but that's what I was taught
an historic event
 
You say it "aych" though (or I do ;_;)
 
One does, of course
The alternative should never be mentioned in polite circles
 
DSM
After trying it out, it seems I say "an historic" but "a hotel". "an hotel" makes me seem like I'm being pretentiously faux-French.
 
Nope, I got it backwards. I use "a historic event", but everyone else uses "an".
 
8:15 PM
Not too many aspirate H words in my part of the world. Uh, "an herb" I guess
 
Welp. Looks like we need to stop being friends. Please turn in your Fizzy Friendship Badge and leave via the Shame Door.
 
I think I am pretentiously faux, French. Bohemian Bourgeoisie
 
DSM
"an herbal remedy": yeah, I guess I say "erb".
 
"this is an historic event" is too much of a mouthful, something about the "n his" sounds wrong
 
DSM
But I so undervoice the h you can barely hear it when I say that.
 
8:16 PM
In the future all words that currently begin with a vowel, will instead begin with an N, to reduce confusion. An apple => a napple
4
 
@Kevin Oddly enough, the word "orange" came about by the inverse of that process.
 
To be honest, I always said "a hotel", "a historic event" until I was about 17 and someone introduced the pretentious "an". And, dammit, it stuck. Unlike the rules about starting a sentence with "and" or "but"
 
The original was "a naranj"
 
Nelephant...Norange...Nuranus...
Uhhh, what about once though?
 
Nutopia
 
DSM
8:18 PM
"Naranj is the Sanskrit worked [sic] for “orange tree” which has many roots in a large variety of languages meaning Sham or fruit from the Levant Region." Well, I'll be.
 
Neat.
 
Good work @tzaman. 50 snapey trivia points.
 
@Ffisegydd If any words have conflicts, use context clues.
 
Yeeeeeah...
 
Alternatively, only words that can actually follow "an" will get the letter shifting treatment.
 
DSM
Wow. Would not have gotten that.
 
I did wonder whether that worked in the states
 
@Ffisegydd lol, I was thinking of the cryptographic use of the word
In cryptography, a nonce is an arbitrary number that may only be used once. It is similar in spirit to a nonce word, hence the name. It is often a random or pseudo-random number issued in an authentication protocol to ensure that old communications cannot be reused in replay attacks. They can also be useful as initialization vectors and in cryptographic hash function. == Definition == A nonce is an arbitrary number used only once in a cryptographic communication, in the spirit of a nonce word. They are often random or pseudo-random numbers. Many nonces also include a timestamp to ensure e...
 
It was a far stretch for our non-UK brethren.
 
Possibly only if you've seen brass eye
 
8:21 PM
whoa, when did we get wiki-summaries in sochat?
 
I was aware of the word but not its slang usage.
 
maybe I've never linked an article here before
 
We've had Wikipedia oneboxing for many months at least
 
DSM
"for the nonce" is the only phrase I know that from, and I'd only use that if I was going out of my way to put on airs.
 
Is oneboxing only if the link is on its own in a message
 
8:22 PM
Reminds me of the "Peter File" character from The IT Crowd
 
@JRS yes.
And http://, not https://, NIIRC.
 
Woop, made a fancy installer for node-based desktop applications
 
some https urls work, such as the one that was just linked
 
A noctagon sounds like some fancy night-time-only shape.
 
8:23 PM
Ah ok, I generally use http to be safe (yes I understand the irony of that sentence)
 
DSM
I'm going to steal that word and use it for something.
 
Rebracketing (also known as juncture loss, junctural metanalysis, false splitting, false separation, faulty separation, misdivision, or refactorization) is a process in historical linguistics where a word originally derived from one source is broken down or bracketed into a different set of factors. It is a form of folk etymology, where the new factors may appear meaningful (e.g., hamburger taken to mean a burger with ham), or may seem to be the result of valid morphological processes. Rebracketing often focuses on highly probable word boundaries: "a noodle" might become "an oodle", since "an oodle...
 
@DSM, I'm sorry for bothering you, and thank you! I'm quite new at Python. I'm not sure what to put where the phyton.png is here: worksheet.insert_image('B2', 'python.png') image_data.png is the name of the file, but it's only temporary,, so?
 
Noctagon: The Movie

Darkness has eight sides..
 
@Cyphase Doesn't work with multi-line messages.
 
DSM
8:25 PM
@StewieGriffin: are you saving to a real temporary file or making a BytesIO object?
 
Yea, damnit :P. Ruined the effect.
 
@DSM: Tried to make a BytesIO object
`image_data = io.BytesIO()
plt.savefig(image_data, format="png")`
 
Can't use ` for multiline code, have to indent with 4 spaces.
 
DSM
Okay. Then you need to use the example pattern linked here, and you can make up whatever filename you want.
 
@Ffisegydd one of these days we're going to post the exact same message at the exact same time and the chat server will explode.
 
8:29 PM
Over time, gravity will cause the fragments of the chat server to collapse inwards until a large explosion occurs. From this explosion a new chat server will dawn which has a chat API.
IT'S THE CIRRRRRRCLE OF LIFE!
 
Hakuna Matata
 
Do you prefer...
if condition:
    return
elif condition:
    ...
or
if condition:
    return
if condition:
    ...
 
First if it's a logical continuation.
It helps, in my mind, to tie them into one single "thing" even though both code examples do the same thing.
 
context specific, but generally option b for me
 
JRS is wrong, ignore him.
 
8:32 PM
true, true
 
Haha, I think that's a question with no good answer anyway :)
 
If the if blocks have nothing to do with each other, then use two if. Otherwise if/elif
Just be consistent.
 
Well, in my case it's "if the shape is very far, skip collision check"
 
thus spake zarathrustra
 
8:34 PM
Weird movie.
 
DO you guys ever listen to music while coding?
 
That's an understatement.
I listen to podcasts.
 
I said while coding, not while pretending to code. x)
 
TBH, I was referencing the book - wasn't aware of the movie.
 
DSM
I used to listen to podcasts but I paid too much attention to them. Those sleepers aren't going to pick themselves off the waiver wire!
 
8:36 PM
I like to listen to all sorts when coding, or indeed doing anything at a computer
 
Music. All about the music.
 
@JRichardSnape I was making an allusion to the theme song for 2001: A Space Odyssey.
 
Ah. I show my ignorance on two fronts.
Still, that's less fewer than normal
 
I'll admit it may have been a little very obscure.
 
Still - now playing at my laptop. It is a great piece of music
 
8:39 PM
Ja.
 
@JRichardSnape It really is. Phish does a great cover of it.
 
Damn I've almost dropped out of the top 1% of users this year. I should answer some more Qs.
 
DSM
Listen to the Prince instead. Pauca sed matura!
 
Phantom of the Opera.
 
8:43 PM
You probably don't want to know what I listen to...
 
I ran across this recently, pretty good code-music imo:
actually, their Journeys album is even better
 
@tzaman 80s synth is a huge category on bandcamp, there's always something good to find
 
I'll have to check that out
 
Love bandcamp
 
8:47 PM
I listen to web radios, like this... radiobrony.fr/p/?autoplay
 
It's less distracting since I don't ever have to go pick a track.
 
I'm hesitant to click a link with "brony" in it.
 
user559633
Yeah, not going to explicitly propose "no brony shit" as a room rule, so hopefully we can all just agree that it's not part of our culture
 
8:51 PM
Yeah, that's why I said you didn't want to know... It's mostly techno, dubstep and rock inspired from the MLP franchise, but most of the time nobody would know it's by bronies if you didn't tell them.
 
DSM
I support this anti-brony policy. If we don't have anyone to look down on, we'll have to evaluate our own life choices, and that isn't going to end well.
 
Pfff, you got tired of racism already? :P
 
TBH, I'm more of the "try anything once" persuasion. So, y'know, clicking the link.
 
user559633
racism can be pretty funny fwiw
 
user559633
8:54 PM
@DSM Yeah, I continue this snark by suggesting that we not judge anyone -- who says that child soldiers don't like guns and drugs
 
DSM
Certainly I did when I grew up marauding across the frozen tundra.
 
user559633
The DSM passages are named after you?
 
DSM
[Urf. I feel like I should be able to do something with that but I've got nothing.]
 
Oh, look at the time! Got to go. Rhubarb and have a nice day!
 
rbrb @JacqueGoupil
 
9:00 PM
Hello, I'm trying to insert into a MySQL database the contents of multiple csv's using python the csv's don't all have the same columns however they all have one common column. How could i go about inserting the data into the database in the respective correct columns from each csv updating the row when a common row is encountered? Any help is appreciated. Thank you
 
So you're saying the database has columns for everything, but each CSV row doesn't represent every column? What's the problem? Just make your inserts for the columns that the row does have, and make sure there's defaults for the other columns.
 
This question https://stackoverflow.com/questions/32466921/seq-w-of-bash-equivalent-in-python?noredirect=1#comment52795834_32466921 is marked duplicate. However, reason has been provided to explain why its not a duplicate. Can the duplicate lock be removed?
 
I disagree, I think the answers in the duplicate do answer your question. Just for one leading zero rather than two, which is easy to extrapolate.
 
It provides ways to have 2 digits. But I wont know how many digits I need and it will be based on the upper limit of range.
 
Then take the max of the lengths of the input.
 
9:05 PM
thank you I will look into that and let you know how i get on
 
Yes but that makes the question NOT duplicate
 
If your question is literally "how do I figure out the max length of these things", then I think it should remain closed, and is a poorer question that the one you did ask.
 
how would I construct the mysql statement would it be like insert="insert into table_name("+columnNames+") values("columnValues")"
 
Thank you but i disagree.
 
Please edit your question to ask the question you actually meant to ask then.
 
DSM
9:09 PM
Since you need a start, a stop, and a minimum number of digits, I don't see how zfill doesn't serve your purposes, and that's explained in the linked Q.
 
I dont know how many digits I will need a-priori. I have rewritten the question and hope its more clear now
 
max(map(lambda x:x//10+1,my_list_of_numbers))
 
DSM
You don't know how many digits you need to add. You do know how many total digits you want.
>>> a,b,n = 1,11,3
>>> [str(x).zfill(n) for x in range(a,b)]
['001', '002', '003', '004', '005', '006', '007', '008', '009', '010']
 
err max(my_list_of_numbers)//10+1
or + 2 if you always want a leading 0
 
9:19 PM
I think that could work.
I'm copying that answer to the question for my own use in future.
 
@MorganThrapp I dont think wx.PostEvent is what you want
 
DSM
@WanderingMind: questions aren't for answers.
 
Passed 2000 Low Quality Post reviews. Turns out the button just switches back to "recommend deletion" after you run out of delete votes.
 
DSM
Time to flee. rhubarb for all.
 
9:27 PM
Same, rbrb
 
 
1 hour later…
10:57 PM
cbg guys :)
 
cbg and rbrb - time for bed for me
 
hey! Is it possible to fix the problem in edit 1 in this question:stackoverflow.com/questions/32031353/… (Old Question)
Without human intervention if possible.
Just to advertise it has a 100 rep. bounty as well.
 
>>> print x
12 | Fan 1 | Fan | 5936.00 | RPM | 'OK'
13 | Fan 2 | Fan | 5936.00 | RPM | 'OK'
14 | Fan 3 | Fan | 6042.00 | RPM | 'OK'
15 | Fan 4 | Fan | 5936.00 | RPM | 'OK'
16 | Fan 5 | Fan | 5883.00 | RPM | 'OK'
17 | Fan 6 | Fan | 5936.00 | RPM | 'OK'

I want to write a simple regex to read the 4th column
>>> re.findall('(\d+\.\d+)\s+|\s+RPM', x)
['5936.00', '', '5936.00', '', '6042.00', '', '5936.00', '', '5883.00', '', '5936.00', '']
Can something better be done?
 
11:13 PM
set delimiter as '|' save as .csv file and read it?
read the 4 column.
I am very naive to python, some other guys could help better probably.
 
>>> re.findall('\|\s+(\d+\.\d+)\s+\|\s+RPM', x, re.I|re.M)
['5936.00', '5936.00', '6042.00', '5936.00', '5883.00', '5936.00']
 
11:33 PM
If all instances of '|' are a delimiter, then you don't need a regex.
Just use the CSV module with a ' | ' delimiter @linuxfan.

https://docs.python.org/2/library/csv.html#csv.reader
 
11:48 PM
Thanks @AbhishekBhatia @AlexanderHuszagh
>>> reader = csv.reader(StringIO.StringIO(y), delimiter='|')
>>> for x in reader:
... if x:
... print x[3]
...
5936.00
5936.00
6042.00
5936.00
5883.00
5936.00
 

« first day (1788 days earlier)      last day (3176 days later) »