« first day (2300 days earlier)      last day (2873 days later) » 

18:01
And questions about not so favorable chess openings are never out of bounds.
DSM
DSM
I used to play a fair bit but was never any good. I know enough to appreciate a game at a slightly-better-than-casual level, but peaked early and moved on to games I was better at..
whats the simplest way to receive an image using python sockets ?
i found this code that can send strings
i instead want to stream video to server
@DSM exactly, the fact that I have to draw attention to the fact that they didn't post the actual code they used (as the JNI library they appear to be using is not standard) or the key that is embedded in that, makes the question effectively incomplete and lacking an MCVE.
@harvey_slash I am using shutil.copyfileobj to store an image gained through requests
18:06
hey thanks for the reply
Some of the objects in io can help with "making the socket behave as file` I think
i want to read frames using opencv
and then stream to server
@harvey_slash stream video to server on local network over lan? or wlan? or actually through internet?
actually through internet
thats really difficult
you have to compress you data for that
18:07
so I have implemented a neural net to classify a video stream
h.264 for example
and i am thinking of taking 5 fps and sending to my server
io.bytesio seems to do it.
@DSM haha now I know who you are! Surprised you remember saying that exact same thing to me.
18:08
i dont know how to do that socket loop thing
like , say the image is larger than my buffer
You guys inadvertently crossed paths before playing chess?
DSM
DSM
There are only so many Python programmers in Canada, it seems.
@harvey_slash send image in chunks and assemble it again on the other end
ugh
i have to do that low level stuff ?
not necessarily
18:11
i just want to hook up something fast and simple
dont care about security
its not the security, but the amount of data you should be worried about
:(
people are writing this
while True:
data = client.recv(1024)
if not data:
break
img.write(data)
you could get away with encoding your images as jpeg and send that through the socket and decode it on the other end
that is at least better then raw video data
dont need very high fps
so ill take few frames per second
and send
you wont get 1 fps with raw video
18:12
Depends on the image resolution, really.
what resolution
@DSM I'm rather jealous of your ability to use Python in your job primarily - in another position now that is mostly C++.
224x224
@Kevin yeah ;=)
@harvey_slash ok thats small. didnt expect that
its to classify products using neural nets
they generally require smallish pics
18:13
224 squared is far enough on the smallish side that I'd try just sending regular uncompressed data and seeing if it's fast enough.
i just want to test if server client works for now
tbh even if i get 1 fps ill be satisfied as long as something is working for me
Unfortunately you're probably not going to find a ready-made library that does precisely what you need. There certainly isn't anything like that in the standard libs.
Such is the way of things. So much of programming is "batteries not included"
I found this
http://www.binarytides.com/python-socket-server-code-example/
i thought it would be a simple few lines of change to send images
I assume that doesn't do precisely what you need, or else you wouldn't be asking about it in here ;-)
it sends small strings , and i need objects instead
18:16
Whatever image-handling library you're using probably has a method to turn images into strings and back
I know PIL can do that, for one.
ah
okay cool
DSM
DSM
@Mitch: I've spent a fair bit of time over the last few months writing C++, so there's no escape. On the bright side I wrote wrappers..
so i can just convert the image into a string and then unconverted it
right?
Yeah although who knows what the FPS will turn out to be.
if you use opencv and numpy
numpy's ndarray's have a tostring method
and np.fromstring
18:17
ah cool
okay im going to try that first
if i get extremely slow performance ill come back
thanks a lot guys
you would need to have at least 5Mb/s upstream for 30fps. If the frames are color.
i have 350 mbps :)
atleast
in university , get good speed
Do non-techies understand the distinction between a "warning" and an "error"? I was watching my client use my program today and treated "warning: sprocket number field should be greater than zero" as if it was a mandatory command rather than a suggestion. I'm thinking about whether I should re-word things somehow.
As far as they can see it at the currently focussed terminal, it acts like a nuclear issue to them. If it is lost in the console, they do not care
Actually I think the message was "sprocket number field must be greater than zero" which doesn't do a good job conveying "you can still submit this field with a negative number, but you're probably wrong to do so"
18:25
Well I mean does the program still return meaningful results (or work) with a zero or negative-valued sprocket number field?
I count myself lucky that the client reads and understands the message, and merely misinterprets its urgency.
you can call it a "hint"
@MarcusS Yes, but it corresponds to nonsensical real-life data. Like if your plane altimiter read -1000 feet.
@Kevin suggestions shouldn't be warnings for laymen, in my layman opinion
cbg
In principle an altimiter can read that, if you've got a lot of free time and a shovel, but it's not likely to happen.
18:26
how about "Note:"?
hmm, maybe that's too strong too?
how about "Chef's Suggestion: Try a positive-valued sprocket number field next time!"
"Note: sprocket number field is typically more than zero"
"PEBKAC, please reset user and try again."
"Warning: Incoming game"
just find users who know what they are doing
18:28
@KevinMGranger That's what I'd most like to reword it to, but I hesitate to lengthen an already wordy message.
This summer... heartbeat... users are getting... heartbeat... reset. THE RESETTER
The actual message, with details anonymized, is 'if FOO is "ABC" and the BAR is not "DEF", and the BAR does not start with "GH", the BAZ must be "IJK", "LMN", "OPQ", "RST", or "UVW"'
I could change it to 'if FOO is "ABC" and the BAR is not "DEF", and the BAR does not start with "GH", the BAZ is typically "IJK", "LMN", "OPQ", "RST", or "UVW"' but I feel it still isn't the beacon of clarity I'd like it to be
Something is missing from that example. I think we have an XYZ problem here.
The guy who specified the business logic behind this message retired, and then died.
@Kevin you BAR FOO forgot DEF GH how to TZZZ talk
18:31
Well, it's pretty awkward when someone dies yet continues to be employed somewhere. Then they'll just never respond to emails.
DSM
DSM
@Kevin: I'd be okay with a longer message if it were easier to follow, with a header like "Something seems unusual. [describe situation]. [Potential actions and their consequences.]"
There are a dozen other warnings like this and they tend to occur in clusters, so I have an "issues" text box that displays them all.
Clarity beats being overly succinct. If I have to read more instead of being desensitized to a "warning", so be it
@Kevin sounds like something right out of our tax administration software
If I had unlimited man-hours and volition, I would separate the text box into error/warning/info tabs, each one having a descriptive label like "you cannot continue until you resolve these issues / these issues indicate there may be a problem with your data, but you may continue anyway / uhh something about info goes here"
18:34
although those are errors
@Kevin its pretty userfriendly to colorcode the boxes with wrong values
e.g. yellow for warning and red for error
@MarioDekena I did that and the client complained so I took it out
client just wants it to work, eh?
Or if it affects multiple fields, make hovering over the error / clicking highlight the fields
Nov 20 '16 at 0:32, by Andras Deak
Sep 28 at 22:35, by Andras Deak
users are the worst
18:36
@DSM That's interesting. I don't mind C++, I certainly feel more comfortable with it (or a subset of it) and C than Python these days, I'd just like to improve with Python. Seems like there's so many interesting projects and modules. But here it's most all R for any high-level stuff.
29 secs ago, by Andras Deak
Nov 20 '16 at 0:32, by Andras Deak
Sep 28 at 22:35, by Andras Deak
users are the worst
easier to just assume the user is intentionally malicious and will try their hardest to break everything
but then it starts to feel like coding for trolls
@Mitch you feel more comfortable with C++ than with python?
@AndrasDeak Comfortable may not be the correct word, ever, with C++. I've accumulated a lot more experience working with it than Python at this point.
learning c++ was easier for me then python too
18:39
@Mitch ah, huge difference:D
python has so many things you have to learn, because it has so many modules and featues.
c++, you get your base tools. start builing your codebase yourself, nothing more to learn then fundamentals
Wellll I definitely wouldn't say learning C++ was easier for me :P
python is more productive thats for sure
Are SQLalchemy enums backwards? I always thought of enums as human: computer
but that's exactly backwards from how sqlalchemy's enums work. Also, recbg
DSM
DSM
I've been writing in C++ for years but still don't describe myself as "knowing" C++. But I'm on record as saying that C++ >= 11 is actually usable.
18:42
You definitely don't need to learn "all" of the python modules in the stdlib much like you'd need to know most of the C++ stdlib. There's definitely many parts of the python stdlib that people in here don't know.
I don't even know what different versions of C++ are, heh
@DSM agree
C++ >= 11 is, dare I say it, more than useable, it's... nice?
I'm not sure how much of the stdlib I know. Maybe 50%?
Probably not even that
I know logging pretty well
as in I've read and roughly ported it
C++17 is even going to have optional and variant :D
DSM
DSM
18:44
@KMG: variant from boost? I've used that sometimes.
I don't even know what either of those mean, heh.
I haven't used boost variant but if it winds up in the C++ std then it probably came from boost at least in inspiration
@WayneWerner optional is type-safe nullability. No more NullReferenceErrors or whatever it is. variant is a type-safe union.
sounds like a burrito monad
disclaimer: I don't know Haskell
...sure! tries to learn haskell again to know what that means
@DSM Yeah, I agree. Definitely should amend "learned" C++ to "learning" C++, indefinitely.
18:47
@KevinMGranger I'm about 90% a monad is just a way to say something can be nullable... but functionally
@WayneWerner yes, an Optional can be considered a monad, but so can a lot of things
I'm 60% sure a monad just describes some sort of "container" that can have a functor applied to it
In haskell, Optional is spelled Maybe
what's a functor?
it's something that does things to stuff in a box or not...I swear I read the crayon version:P
a class that defines the operator()
wait, I thought Haskell didn't have classes. Or do you mean something else?
18:50
we're dangerously close to "what's a pupper" territory here
see? We're confused already
DSM
DSM
That means you're close to understanding. #zen
Monads are just big ol' puppers
It takes in a single thing, and outputs a single thing. A monad says "Well, since I'm described as containing x, if you apply a function to me that takes an x and produces a y, I can say that I then contain a y".
I'm also simplifying and could be very wrong so I'll stop here
A functor takes a single thing and outputs a single thing? So it's really just a special case of function? e.g. a square is a special case of rectangle?
18:51
and there's the thing which seems important that it doesn't choke if it doesn't get anything?
I think @PeterVaro offered to help me with my haskell mental blocks at some point
let chaos spread
I'm also 90% sure that most of the problem with Haskell comes from people trying to explain Haskell things in Haskell
Nope I'm wrong about monads, I was mixing them up with something. But I was right about a functor
If you want to try, there's learnyouahaskell.com
so which one is the functor?
Yeah, I've started on that many moons ago.
didn't get terribly far because I got distracted by people trying to explain monads in all kinds of different ways, lol.
18:54
What should I name this function?
>>> f = lambda word, count: "{} {}{}".format(count, word, "s" if count != 1 else "")
>>> f("dog", 0)
'0 dogs'
>>> f("cat", 1)
'1 cat'
>>> f("cake", 40)
'40 cakes'
"pluralize"
I feel like monads are one of those chicken-and-egg problems in terms of understanding what they are and what they can do
whoah, haskell's list comp syntax is awesome
But "1 cat" isn't pluralized.
18:56
>>> f("fly", 1_000_000)
'1000000 flys'
And the plural of "dog" isn't "0 dogs", it's "dogs"
Also, it's a lambda, so don't name it anything:P
Think of a functor as something that can be "mapped" over. If you have a function that takes an X and produces a Y, You can apply that to a list of X's and get a list of Y's. Thus, the list is a functor. In haskell-land, the "apply this functor" operation is called fmap. And for the list type, they just say fmap = map!
It's actually a javascript function, I'm just converting it to something more Pythony so I'm less off-topic
18:57
I need to implement that at some point -- in my app I kept running into awkward cases where adding "s" was not the right approach, but I didn't feel like handling all the cases
DSM
DSM
"decline"?
there you go, back to Javascript
so I just added a static (s) for now
1 dog(s), 2 cat(s), etc
@DSM aww that's cute:D
I realized that there might not be another way to do declension on a noun in English
it's a bit funny, I didn't realize that
maybe pluralize_by_count or something
18:59
do_the_needful
enumerate :P
either that or pluralize; special cases aren't special enough to affect terminology
although JS so the Zen might not apply
hi all
I am new to python and I need help with a script
is it your new question?
19:06
could I ask here?
I guess I'll just do pluralize.
I would run this script: github.com/mzucker/page_dewarp, but I have no idea how to do
python page_dewarp.py IMAGE1 [IMAGE2 ...]
I installed winpython 2.7 with all the components indicated in the requirements page (numpy, scipy, opencv, pillow)
what did you try allready to run the script?
19:10
ok, buth where? where I have to run this command? where I have to put the images?
You need to start a Terminal window.
One typically runs a script by opening the command prompt and entering python myscript.py, or just myscript.py if your system has a default association for .py files
I open the WinPython Command Prompt and entered in the folder where the scripts is, and then I did the command, but it gives an error
The images can be wherever you want. You will need to provide the correct path to each image in the command-line.
What was the error?
19:12
there's the answer ;)
no, it says import error: no module named cv2
although I installed correctly opencv
ah i see
3 mins ago, by Alessio
I installed winpython 2.7 with all the components indicated in the requirements page (numpy, scipy, opencv, pillow)
did you also instaleld cv2 for python 2
yes
I controlled
19:13
because you have to install it twice if you have multiple python versions
How did you install cv2?
I followed the instructions here: pythonarena.wordpress.com/2016/03/07/…
please note that I did all the things listed here docs.opencv.org/3.1.0/d5/de5/tutorial_py_setup_in_windows.html
and it gives no errors from idle
the problem is from the cmd
maybe I had to define either the input file and the output file with complete path?
@Alessio you have not got that far yet.
@code-apprentice: ok I'm trying
@Alessio here you said "import error: no module named cv2" but in your question you commented: "ImportError: numpy.core.multiarray"
19:19
no, my question refers to an old problem
because I tryied with python 3. initally
I think this module I wrote would look better if I used the name "issue" instead of "error", but I don't feel like replacing it in the 100 places that I used it...
close your eyes and do search replace
and pray ;)
I already know that find-and-replace will be overzealous because there are string literals containing "error" that I would like to stay as "error"
19:23
@Kevin sed -i 's/error/issue/g infile.js'
find-and-replace with regex, exclude string literals
kevin'd.....
I think string literals are one of those things you can't parse with regex.
adding import sys

sys.path.append('/usr/local/lib/python2.7/site-packages') to the code didn't work
arent you on windows?
because that is a linux path...
19:25
@Alessio try rebooting. Sometimes that's necessary before something that was installed becomes visible everywhere.
ok so I had to modify
yes I just did copy paste
sorry
by the way I had to add this code to the beginning of the script, isn't it?
@Kevin PyCharm advertises a rename symbol function. I never tried it myself on something large, though. I would probably just sed recursively and then check the diff before committing to make sure nothing unintended was replaced.
If you're on windows, adding sys.path.append('/usr/local/lib/python2.7/site-packages') to your code will have no effect, because there isn't a "/usr" directory in Windows. Uh, unless you make one yourself, I guess, but there's no point in doing that.
guys I am quite new to python any ideas where to find best tutorials
We've got a list on sopython.com somewhere, let's see...
yes I'm trying adding the current directory
Augh beaten
@MooingRawr thanks I found one here learn2torials.com/section/beginners/python
DSM
DSM
19:29
Kevin'd Kevin, while at a meeting. #winningyeahistillsayit
@SandipPatel google python tutorials
i need some advance level tutorials
@MarioDekena no, don't
@DSM With nicer link formatting, even.
@AndrasDeak i learned it that way ;)
19:29
i know to google but may be you guys have some cool sugessions
@MarioDekena I hope not the hard way
"Advanced" is such a... broad term.
i recently learn basic stuff with python
I am working on connection between elastic search and python
@ke
@Kevin agree
Once you know the basic elements of a language, there's no one golden road to follow to get better. You have to pursue your own interests. Read the documentation on the libraries you're interested in. Read the source code of open-source projects you admire. Read language-agnostic design theory books like Design Patterns: Elements of Reusable Object-Oriented Software
And, of course, program, program, program.
To add on, create a goal for yourself and set out to try and achieve it. Once you got it try to think of ways to make it better. For example Kevin is good at gif making with PIL. DSM is good with numpy...
19:34
@Kevin and @MooingRawr agree however you always learn from others
There's a module for almost anything u want, just have to find it
read their modules and source docs, their githubs
DSM
DSM
I think it's a better skill to have to be able to make pretty pictures than pretty vectorizations.
read what they are doing and understand why
picture can be used to impress the non tech people. Vectorization impresses the tech dudes.
reading docs can deliver far more information then talking
my thoughts were to learn it from others who already been through tougher time so they might suggest you some cool sites or tips and tricks
reading docs is boring however has so many advantages agree
19:35
There's rarely anyone who will sit down and coach you for free, though....
@DSM Grass is greener, there.
you are more than welcome to try something, hit a road block and come back and ask use with a complete example of what you did and what went wrong
@SandipPatel there is no other way. you will sit here next year if you want someone to tell you function prototypes
What's a function prototype ;3 ?
In computer programming, a function prototype or function interface is a declaration of a function that specifies the function's name and type signature (arity, data types of parameters, and return type), but omits the function body. While a function definition specifies how the function does what it does (the "implementation"), a function prototype merely specifies its interface, i.e. what data types go in and come out of it. The term function prototype is particularly used in the context of the programming languages C and C++ where placing forward declarations of functions in header files allows...
19:37
agree guys
I've learned a lot from just sitting in this room for a zillion days. But it's neither fast nor directed.
I know I'm just teasing you >.> in hopes that you would go on a long tangent of trying to explain
to run the script I need to be in the cmd window or in the python terminal (with >>>)?
in cmd
without python >>>
Kevin at what point do you start learning after sitting in here? I've been in here for a few months and I know less than when I started here
19:38
just cmd.
and type python scriptname.py args
ok
I need to be in the python folder?
in the folder with the script you want to run
or pass in the direct path to the script name, i think that works too
@MooingRawr Perhaps you're learning but don't know it. Maybe the list of things you know that you don't know has grown faster than the list of things you know, which makes you feel like you know less of everything percentage-wise, even though your total knowledge has increased.
19:40
How I feel is, you guys go on to talk about something, I learn that I dont know that topic I go look it up, and down the rabbit hole of not understanding what im reading, which chains it into more look ups
DSM
DSM
So Kevin called it!
and how can I do to install a .whl module?
Socrates, noted knower of things, said "I know that I know nothing", which I feel is a demonstration of this phenomenon.
For example, yesterday I wanted to learn Numpy, I went to go read the docs, then I went to go read about certain vector rolls and what not which led to another thing
@Alessio pip install wheel.whl
19:41
I miss my phl classes
make sure your in the same folder as the wheel or pass a full path
but it saya "pip isn't recognized as an internal program"
@Alessio do you have pip installed?
also make sure the binary path is in the PATH environment variable
how can I install pip?
I have python 2.7
19:44
google is your friend...
I am trying to do all without winpython
I don't know anything about matplotlib or numpy or opencv or databases or cloud computing or computer architecture or functional programming or test-driven development or red-black trees or the Black-Scholes equation or physics or chemistry or color theory or UI design or... So I get a kick out of when people imply I'm knowledgeable.
Where's Marcus, I was hoping to be about to enter my math confused phase, and go on a journey reading about random math stuff that wont stick with me after 3 months.
@Kevin you know pretty well what you dont know ;)
@MooingRawr Black--Scholes is right there
19:45
Kevin you are more knowledgeable than me; by a long shot. There's always someone more knowledgeable than you; except if you're the Ninja. He's at the top of the food chain
@Kevin I like how you threw color theory in there :)
Even the things I "know", like gif-making, I feel like I'm playing in the shallow end of the pool compared to the things I've seen
@MooingRawr no its chuck norris
Wasn't even aware color theory was a thing.
eh... I haven't met Chuck Norris, I've seen the Ninja talk and answer stuff....
19:46
Knowing that there's always someone better than you is a lesson with sharp edges. Handle with caution.
@Kevin has Seen Things.
I installed pip, but it gives the same error!!
I did pip install namefile.whl
restart command propmt
kill explorer.exe and restart that
@MooingRawr You're working on a Black-Scholes problem?
restart computer
add pip path to PATH environment variable
19:48
@MarcusS What? Ugh No? Maybe? I don't even know what a black-scholes is ;( To google.
how can I do?
call pip directly by full binary path
oh, I misunderstood
First read a bit about martingales and stochastic processes in general
ok I will return later thank you all
19:49
I was just merely saying that everytime you go on a math "rampage" I get to go on a journey of looking up what are you talking about.
Black-Scholes has to do with options pricing based on some PDE heat-equation flibbertyjibberty
I was taught Black--Scholes but there were no heat-equation PDEs involved
then again that might be my loss
PDE, I miss being confused about how to solve a PDE, than realizing the solution. That moment of "ah huh" is the best feeling in the world...
you can transform the Black-Scholes PDE to the heat equation
@AndrasDeak Did you read Joshi's book? Your advice sounds like something he says near the beginning :P
19:51
I interned at an options trading company and I knew that Black Scholes was Important but I did not know why it was Important
@Mitch I don't know who Joshi is, so it's unlikely:P
@MarcusS sounds useful
someone worked with bloomfilters before? Awesome datastructure, i wish i knew it earlier. en.wikipedia.org/wiki/Bloom_filter
So you use Black-Scholes to try and predict the heat at a given point ? or am I way off the mark ?
Hmm, is it hostile user design to have a pop-up saying "You are about to navigate away from the page. [Discard changes and continue] [stay on page]" if the user partially filled out the form and didn't save?
I don't remember anything about my probability stuff. none of that 0.05 or 0.95 stuff sticks with me
19:54
Assuming that it's even possible to interrupt a page navigation with a popup, which I'm not 100% sure of
@AndrasDeak ah, "Concepts & Practice of MF". Haven't gotten through the later chapters but that was my formal intro to risk neutrality & martingales outside of raw probability theory
@Kevin I'd be glad for a popup like that, firefox sometimes does that when I misclick and it makes me glad
worst case is mild irk from false positives, best case is huge joy from true positives
@Mitch MF?
In a perfect world I'd be able to save the data so the user can exit and return and still have whatever they put in last time. But that would take more man-hours than I've got.
@Kevin meh
mathematical finance, sorry
19:56
@MooingRawr Has to do with the concept of pricing options -- which are contracts that let you buy or sell a particular financial instrument/asset for an agreed-upon price on or before some given date
^ that's the title under which it's saved on my computer ;)
@Mitch Ah, I see
I took a course about martingales out of interest in stochastics, but finance doesn't interest me (pun unintended). It's not just a lack of interest actually; it exerts anti-interest on me.
@MooingRawr Also worth looking into brownian motion
that's much more rough
you need Ito calculus if you want to do it right
I'm using Linux. I have a program that should wait for a signal triggered by the linux windowmanager. How could I do that?
19:59
oh wait
people probably do Black--Scholes in continuous time as well
my former knowledge only extends to discrete time
in practice people have all sorts of variants on their pricing models

« first day (2300 days earlier)      last day (2873 days later) »