« first day (1587 days earlier)      last day (3377 days later) » 

2:00 PM
how can it be improved? well... in many ways obviously
 
CBG
 
is it right - no it is not
cbg
 
Anyone know of a good extension or tool or something to make a JSON POST request that doesn't add cookies?
I was using Advanced Rest Client for Chrome but it keeps adding all these cookies
 
requests :D
 
postman
 
2:02 PM
:-) thanks
 
also curl :)
 
I always struggle to explain a downvote on a post like this. I'm inclined to think that the downvote is not to signal that the post isn't helpful, not when 84 others did think it helpful enough to upvote.
 
Is uncompressed the same as not hex-encoded?
 
@Vader no.
 
No
 
2:04 PM
Okay
 
Compression is a process to express the same data using fewer bytes.
 
But isn't that what hex does to ascii?
 
no
 
say you have the string 'aaaaaaaaa' and you replace that with 9a, expressing 9 bytes in just 2.
 
encoding is representing something differently; compression is representing something differently and shorter-ly :)
 
2:05 PM
yeah
 
hehe, shorterly
 
Decompressing is then the reversal of that process.
 
I see
 
@MartijnPieters did youwrite a maybe monad in python ever?
 
Text and images have a lot of repetition in them that can be taken advantage of.
 
2:05 PM
@MarkR. Of course, curl. Duh.. I totally forgot about curl. Thanks a lot
 
@Johnston, yeah, just curl -X POST -H "Content-type: application/json" ... etc
 
4
Q: Maybe monad in Python with method chaining

lazy pythonI'm trying to implement the Maybe monad in python. However what I also want is some kind of a chaining ability. So I have a class: class Maybe: def __init__(self, val): self.val = val def do(self, func): # Bind function if self.val is None: return None ...

 
@MarkR. Awesome!
 
hrmz, people broke the ReST formatting.
@AnttiHaapala not sure I want to get into that one, don't have the bandwidth atm.
 
So compression is something like .rar and what is an example of encoding?
 
2:09 PM
actually compression is also "encoding"
 
so what is hex then?
 
"hex" like converting each byte to 2 hex digits is encoding, but it is not compression
 
But doesn't the file size get smaller?
At least that is what I am seeing
 
The hex form of "Hello" is 48656C6C6F, so no, it doesn't get smaller
 
"In communications and information processing, code is system of rules to convert information—such as a letter, word, sound, image, or gesture—into another, sometimes shortened or secret, form or representation for communication through a channel or storage in a medium."
to make something to conform into a code is called encoding
 
2:12 PM
@Kevin Bizarre! I was just about to post that exact example. :)
 
Great minds think alike :-)
 
Either that, or fools seldom differ. :)
 
Alright, thanks
 
to make something that is conforming to code to something that is not conforming to that code, is called decoding
also often in programmer parlance some codes are called "encodings" exactly bc programmers are so stupid they think "codez" are the "sources"
 
@Vader Do you have a specific, concrete example in mind? The term "hex" can cover a lot of territory.
 
2:15 PM
I am looking at this mp3 file, trying to get useful information out of it. But it is all gibberish.
a630 705d 1cb4 0a0c 99e9 b266 80b6 d940 c040 0589 2009 225a
is
.0p].......f...@.@.. ."Z
 
which doesn't mean much to me
 
I guess I should qualify my last statement by saying that there isn't one objectively correct way to "get the hex of" a string. To be more precise, the concatenation of the hexadecimal representations of the ordinal values of each character in "Hello", assuming regular ANSI encoding, is 48656C6C6F.
 
Maybe is a cool concept in Haskell. But I don't think it belongs in Python.
Q: How do I implement the Maybe monad in Python?"
A: "Please don't"
:)
3
 
instead python should implement optional operators
like swift
hmmhm maybe could write a source code filter for such .d
 
2:19 PM
 
anyone remember when mp3s were just starting to be popular and the entire Fraunhoffer debacle with encoding software?
 
@Kevin thanks, I found a similar page. I guess it would be easier to use an uncompressed file
 
that was fun
 
@AnttiHaapala Don't we kind of have that already in and & or ?
 
not really
 
2:21 PM
I recall an esoteric programming language where each statement had a 10% chance of not executing. Doesn't seem all that useful to me, really.
 
think about foo and hasattr(foo, 'bar') and foo.bar.list is not None and foo.bar.list.append
 
I'd like my operators to stay mandatory, thanks
 
vs foo?.bar?.list.append(42)
you'd be remembering intercal versions
 
@Vader Ok. Now we're getting somewhere. :) The a630 is the hex codes of 2 bytes. In Python you could write it like '\xa6\x30`. We use hex codes to represent binary files because only a subset of all 256 possible byte values are printable (and printable in a consistent way on all systems). Does that make sense?
 
2:26 PM
@PM2Ring, well-put
 
@PM2Ring no, but that's not your fault : |
 
@Vader, what are you trying to accomplish? Just a general understanding of encoding or is there a practical application?
 
@Vader you know that 1 byte = 1 octet = 8 bits = unsigned value 0-255
 
Well my goal is to take in an mp3 file (or whatever ever other file might work better) and convert it to a list of beeps
 
try a MIDI file :)
 
2:29 PM
list of beeps??
 
now that will be quite hard, need to do spetral analysis aand figuring whatever is signifcant etc
 
Cbg
 
for someone who barely understands "encoding" I'd say "forget it"
 
I remember trying to do something similar with .wav files. Turns out, you need to do fourier transforms and stuff on the data to get the frequency values that Beep would expect.
 
2:30 PM
Well for .Beep() all I need to do is specify the frequency and duration
 
yes, it is the easy part
 
so breaking a .mp3 into chunks of 0.1s frequencies should work
 
now you only have the problem of calculating the frequencies in the signal
@Vader that is the hard part...
 
Aren't those frequencies stored in the mp3?
 
not really
 
2:31 PM
yes
 
If they're anything like .wav files, then you need to apply college-level math to get them out
 
well that's what the entire audio is about...
 
they're in there, just not, uh, "on the surface" so to speak
 
@Vader so what's your education background
 
Calculus
 
2:32 PM
@Kevin what if one went to Hogwarts?
 
On top of all that, I don't think Beep is paralellizable, so you wouldn't be able to play chords, just pure tones.
 
^^ That's what I want
 
@Kevin Not to be confused with the Furrier transform :)
 
what one could o EASILY is to calculate PWM
 
@JonClements MP3s don't work in the presence of wizards. Because magic.
 
2:33 PM
basic calculus wil get 1 % of this done
you need complex analysis
 
Fourier transformations are awesome. I love them so much.
 
plz give teh mp3 decoding transform, regards
 
Sorry I don't do audio FTs, only between real and reciprocal space.
 
cabbage
 
cbg old bean.
But yeah, this is one of those xkcd-bird-picture things.
 
2:37 PM
still flag banned :( according to that link that zero posted, I shouldn't have been in the first place, and definitely shouldn't be now
 
@Vader anw you do a FFT/DFT or Wavelet transform to get the frequencies of the
@davidism which got you declined?
 
I hate to tell people "this will be nightmarishly hard" because I don't want to discourage them, but...
 
I have spent four years using Fourier transforms on a daily basis, I wouldn't want to try this without a lot of alcohol and some mammoth textbooks.
 
@AnttiHaapala I had two NAA rejected out of 9 I posted in the last 7 days
 
This is an exception?
 
2:38 PM
@Vader I am an engineer, with 15 years of python experience, I have a faint idea on how it could be done
 
Yeah. MP3 decoding is not suitable as a quick Friday afternoon project to learn how hexadecimal works
5
 
This didn't start out as learning hex
 
so given 1 month of time, I could tell something about how it works
@davidism so which NAAs :d
you just need to flag more :D
 
I agree with the flags that got rejected, it's just weird because it's only supposed to kick in at >= 10 flags
 
@davidism are you just trying to get banned from various things on the site recently? :p
 
2:42 PM
it just seems to come naturally lately :-/
 
/me adds note to Davidism's trello entry - has also been flag banned... :p
 
Augh, alternate Kevin wrote the answer that I was thinking of writing but didn't yet get around to
 
I should probably flag more, but only flag stuff as I see it, rather than go out of my way to find it... don't think 924 is very good for someone that's been around for nearly 3 years :(
 
I basically never flag. I already have voting/editing/closing/deleting privileges, why would I need moderator attention for anything?
 
since most stuff can be handled with a down/close/delete votes anyway...
think I flag for spam/offensive, potential migration, trolling, plagiarism and potential merges... the rest just tend to resolve themselves...
 
2:52 PM
@davidism nope it does not kick at>=10
but what were the naas that failed you?
so that we can reflag them
 
> Flaggers with a recent (past 7 days) flagging history consisting of at least 10 flags where >= 25% of flags were declined can't flag
 
Umm.... in 2.7 is it better to have from StringIO import StringIO or from io import StringIO... I can't think of a huge advantage to the former... (just going through someone's code)
 
@AnttiHaapala I agree with them being rejected, I don't want to flag them again
 
(or any disadvantage to the later)
 
:D
I never agree with my flags being rejected
 
2:55 PM
But NAA's you can just downvote and delete vote anyway...
 
yeah
so give the link :D
 
@Antti now now - stop picking on David :p
 
One was edited/became a valid answer, the other was just a bad answer, so I guess I'll post that one: stackoverflow.com/questions/23657483/slug-field-on-flask/…
that answer is completely useless / doesn't answer what's being asked
it's basically a comment on another answer
 
ah the first one is a partial rotten sucky answer but it is still an answer
vlq maybe but ....
i have had worse declined as vlq
 
"in the slug function above" ->they're obviously replying to another post
 
2:58 PM
stackoverflow.com/questions/28608076/… -- should I flag this or just comment?
 
Yeah, I was going to cv-pls that.
 
cvd
@MarkR. flag close
 
flagged~
 
Umm... didn't realise we'd scrambled 3 jets off the coast of Cornwall to keep an eye on 2 russian bombers or something...
 
good practice for the pilots
 
3:02 PM
@Mark there's that... but I'd personally prefer that any military hardware and its users are able to stay idle :p
 
I'm from Israel, no such thing as idle military hardware here
well, not from here, but I live here, heh
 
I went with "too broad" but "opinion based" might work too
 
@JonClements I'd say import from io to avoid possible unicode confusion issues. From the StringIO module docs: The StringIO object can accept either Unicode or 8-bit strings, but mixing the two may take some care. If both are used, 8-bit strings that cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause a UnicodeError to be raised when getvalue() is called.
 
@Kevin that's only 6 minutes ago! gasp
 
3:03 PM
@Kevin, he wanted "a cleaner way to do it"
 
@davidism dammit! I was just about to say that :p
 
seems like opinion to me
in the context of that question, anyway
 
asking for a cleaner way is a red flag indicating it ought to be in Code Review, but it's not actually functional code yet
 
@davidism Oops :-(
 
3:05 PM
I haven't tried, since I don't ask how to succeed, I can use logstash, ask for the app devs to put the info in the headers, or in the request args... Trying isn't helping, everything would work, I want to know what is the proper way to do it — Remi Delassus 2 mins ago
 
that reeks of PHP coders attempting python
 
gross
 
yeah, not sure how we're supposed to diagnose that without more information
 
did you see the code? it made me sad.
 
3:07 PM
yeah, they're using string concat to build a query
 
first time I've seen a 192.192.x range of IPs
 
so, no one else want to cv that one?
 
You might want to read about "SQL Injection", i.e. what would happen if someone enters a ' in the form field. — Antti Haapala 1 min ago
 
heh
 
what is cv? (there are actually a lot of acronyms that are being used that make no sense to me)
 
3:11 PM
= close vote please
 
close vote
 
Resource request.
@puredevotion we have browser tools that help us track them: github.com/cv-pls
 
@MartijnPieters 10 minutes rule ;)
 
@AnttiHaapala Nice link. Mrs Roberts is truly awesome.
 
@davidism That one is a resource request, one of the exceptions.
 
3:12 PM
it is also very unclear and vague
 
> Exceptions to the grace period are permitted, including: typos, duplicates (or asking for dupe targets, spam, offensive posts, resource requests. These are permitted to be used for cv-pls at any point, due to their nature.
 
python tag asking about C++ standard 3d library :D
 
So, I should flag it?
 
yeah
close for other reason: offtopic, looking for offsite resource
 
@puredevotion If you agree that the post is off-topic, you flag it as such.
 
3:13 PM
but it is closed
 
But please use your own judgement. Just because people draw attention to certain posts does not mean you have to agree.
 
well it's on topic, but impossible to answer
 
@puredevotion you can flag it to be closed if you want, but the tag is mostly useful for those of us who can cast votes
 
@davidism maybe you should link the ^^^^there tosome flask-sqlalchemy starter tutorial
using pyodbc to connect to mssql per each request :D
 
the comment on profiling his code is also superfluous, there's no way this guy knows what profiling entails
 
3:17 PM
@puredevotion the question I linked to? There is a list of things that are explicitly off-topic. Asking for a 3rd party resource (library, tutorial, etc.) is such a topic that is not on-topic here.
or are you talking about a different post altogether?
 
oh no, i was talking about the one from Davidism.
Your's just needs to get the python tag removed
 
@MartijnPieters about the most yucky flask code of all
-1
Q: Why is my web server freezing sometimes with this Flask app?

RuslanMy web server freezes sometimes. Why? 192.192.30.32 - - [18/Feb/2015 19:22:05] "POST /tfind HTTP/1.1" 200 - @app.route('/tfind', methods = ['GET', 'POST']) def tfind(): cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=192.192.192.192;DATABASE=Telephone;UID=admin;PWD=password') ...

 
yeah, i was talking about this:

Define "freezes"; also, try profiling your code. – Mark R.
 
One of the few times I've wished I could use iTunes: itunes.apple.com/jp/album/ghost-in-shell-arise-original/…
 
@Kevin I can't see how the OP could really improve that question. So I left I (hopefully) encouraging comment. And cv'ed.
 
3:19 PM
Anyone want to buy me a birthday present and upload the files for me? :)
 
@puredevotion right, that one is still off topic; under the 'why isn't this code working' point requiring the minimal sample to reproduce the issue.
That code is far from minimal.
 
Depending on one's interpretation of "give me and guide me", that 3d standard library question could be merely too broad.
 
and under the "this could be in so many things, I don't even know where to start" (although not explicitly listed on your linked page :) )
 
@Kevin or unclear what you're asking since there is no 3d standard library...
 
@Kevin I must say that finding a 3d lib for C++ can be daunting task. I was once looking for a good lib to use for a virtual-desktop environment using oculus. Took me hours to figure out which would be good suited.
 
3:22 PM
@davidism: can I direct your attention to Slack for a moment? :-)
 
what there might be is "opengl"
 
opengl is also 3rd party, right?
 
Some C++ compilers bundle it, IIRC, but it isn't an official standard library
 
ofc
not only that but it is a library that is a library that can be supplied by the driver vendor
beyond that, tell someone they should use OpenGL to do 3D
 
I think the C++ philosophy is "our standard libs should work even on computers that don't have monitors" so it wouldn't make sense to have a standard graphics library
 
3:25 PM
is like "you should use Python for Web programming"
after that the question is "but which framework" -> offtopic
 
Radical cross-compatibility limits what they can include
 
if it were for JAVA it would be different.
 
@davidism is that trhe OST from Ghost in the shell - Arise?
 
yeah
 
ah, I see martijn already got you
 
3:29 PM
plz gief codes
0
Q: Python Server Client Connection

Sandeep Hari Hara BhatI would like to know how to make it possible for a python server to wait for messages from 2 clients without any pre-assumption as to who would be messaging first. Can I do something like-- message=client.recv(BUFSIZ) or targetsoc.recv(BUFSIZ) Can I try something like this where both targetsoc an...

 
pffft
stackoverflow.com/questions/28610123/… -- shouldn't he just move EggError into init.py to make it package-level?
 
@AnttiHaapala at 40k you'd think they knew what they were doing..
 
3:34 PM
@Martijn hey... I've got 55k from not knowing what I'm doing... nothing wrong with that :p
 
@MartijnPieters I'm willing to bet it's a spacing issue. a space too much or too little
 
(some of us happen to be very good at not knowing...)
 
An acquaintance has contacted me, requesting tutoring for their stat calc class. What the heck is stat calc?
There's a pretty good chance that I'm not qualified to tutor the subject, since I don't even recognize the name, but you never know.
The obvious guess is it's short for "statistics and calculus", but it seems weird that they would be taught in tandem
 
Well, 96% percent of Calculus students are made up on the spot?
 
it could be calculus or calculus as in math
 
3:39 PM
@Kevin - Statistical calculations, instead, maybe? Heck if I know...
 
and ofc in statistics you need calculus
lots of it
if you have say continuous distribution
 
@Antti it's all 42...
 
WHATDOYOUGETIFYOUMULTIPLYSIXBYNINE
 
What base? ;-)
 
base 13 :d
 
3:42 PM
And what base is "13" in? :-D
 
hurr durr
just kindly do the needful
 
ah :D
@Kevin base D in any base where D is a valid digit
 
@_@
 
define "valid digit"
gief bnf pls
 
3:45 PM
ex. "2" is not a valid digit in binary
 
man, all new #python questions are boring
 
@Kevin well... it could be valid... as long as there's only two of 'em, does it matter what values they are? :p
I'm sure the boring 0 and 1 could be replaced with some interesting unicode characters instead
 
This is all too complicated, I'm switching to unary.
 
@MarkR. lol. that's great!
 
3:51 PM
I remember when it was published :(
 
4:02 PM
I feel it's rather unclear at the moment
Was thinking of doing "needs minimal code sample" but he's asking "how do I implement this new thing" rather than "why isn't my current implementation working"
 
cbg
 
cbg
@AvinashRaj stackoverflow.com/a/28610585/4099593 .... Any other methods?
 
no other method than slicing,matching,replacing.
 
I'm still thinking
But no thoughts
 
4:13 PM
:)
i'm going to remove my comment..
and remove "Credit" part from your answer.
 
>>> List1 = ["moinmoin"]
>>> [i.replace(i[4:],'') for i in List1]
['']
Uh oh, something went horribly wrong
 
how??
 
If you mean "how can that be considered wrong?", the OP wants strings of length 4, not zero. If you mean "how could that be the output of my code?", it's because "moinmoin".replace("moin", "") is the empty string.
 
@Kevin replace 1
 
[''.join(i[j] for j in range(4)) for i in List1]
 
4:20 PM
@AnttiHaapala Please direct all suggestions to Bhargav, it's his answer after all
 
@Kevin ah, forget that..
 
though it wouldnt help either :P
stupid to replace the rest with splice
 
user559633
@AnttiHaapala i got a disputed for flagging stackoverflow.com/questions/625083/…
 
user559633
even though it's a link only
 
user559633
the review cycle is crap
 
4:21 PM
bc it is such a valuable contribution at +15
 
user559633
this was disputed too, which is hilarious stackoverflow.com/questions/27942292/gitorious-installation/…
 
user559633
i have a lot of valuable contributions on questions that are otherwise unanswered with a score of 10 or less.
 
user559633
even without it having points, it's still obviously a crap answer
 
Speaking as a linux/servers/whatever layperson, for all I know, "Try sudo ./install.sh" is the full and correct answer.
I expect the average moderator is likewise not well versed in these particular technologies
 
is there any language i missed out in this
i got a little bit struck with the re module.
while the same regex works on many languages but it fails when using it in re. Anyway i find a hack through lambda .
 
4:30 PM
Kind of agree with the commenter there - adding more languages isn't going to be useful to the OP
 
yep, just for fun..
at first op fails to mention the language.
see the revisions.
 
@tristan reflagged.
 
user559633
@Kevin well, for starters, there's no reason to believe there was a permissions issue, there's a later step that's being run through ansible, and the error is related to ansible talking to upstart not knowing about the init file
 
user559633
and the "answer" is a "i think it's this wild guess, also, here's a question"
 
Seeking a canonical dupe for Finding contiguous integers in python list. I've seen this question three times this month.
 
4:45 PM
yeah that does come up frequently
 
Yeah, that's truly Pythonic. Simple, readable, concise. — 61612 1 min ago
Not sure if joking or not
 
user559633
Definitely is
 
That's got to be sarcasm.
 
user559633
reminds me of when i found STRING_FROM_PARENT_OBJECT_variablename
 
I mean, I guess if you know itertools by heart, and slicing and argument unpacking and list comps and map and join and enumerate...
Then it's "simple"
 
4:51 PM
@Kevin there's stackoverflow.com/questions/15276156/… - where I've used the same recipe as in the newer one
 
But if, god forbid, you can't remember off the top of your head whether the index comes first or second when you enumerate. Then you're doomed.
 
but that returns a list of all within the range.... no a range itself
 
I feel a little weird actually hammering here, because this OP wants the output as a string, while most dupe targets would give the output as a list
I'm going to put it in the common questions list, though (assuming it isn't already there). Thanks @Jon
 
"Edited the code because of hatred comments" lol.
 
> Just because you can list comp something doesn't mean you should.
@Ffisegydd it totally does :P
 
4:55 PM
In a game of list-comp-golf, yes. Other than that? No.
 
Incidentally, does the common questions list do any kind of duplicate detection? I occasionally worry that I'm adding a link that already exists in there.
 
I believe it used to in the form of a 500 Internal Server Error but someone removed that feature.
 

« first day (1587 days earlier)      last day (3377 days later) »