« first day (1570 days earlier)      last day (3603 days later) » 

DSM
DSM
19:01
♫ roam if you want to ♫ roam around the world ♫
But the world is so big and I am so small :-(
user2555451
2015 survey is open for those interested: meta.stackoverflow.com/q/285178/2555451
oh man its so annoying when new classes start .... and someone has an assignment due tomorrow and 100% dont understand anything about it ...
> Which of the following languages or technologies do you want to work with this year?
Snap pick: KevinScript
19:05
cbg
> When evaluating a new employment opportunity what's most important to you?
This question is flawed, as it does not include "an office with a door I can close"
hey how do i add two time?
i have now = datetime.now.time()
you mean datetime.now().time()
and few seconds later finish = datetime.now.time()
you want to add two whole times?
19:09
You can't add two times, but you can add a timedelta to a time.
yeap
so you want to know, how do you subtract two times?
adding and subtracting two variables which contain datetime
DSM
DSM
Aw, man. I wrote "Julia", but "KevinScript" should totally have been there. Missed opportunity. :-(
I don't see where adding is occurring here
19:09
pretty sure you can do now - then
i have an object called user
DSM
DSM
You can subtract two datetime objects. You can't subtract two datetime.time objects, I don't think.
and i need to subtract the start time which will give me the time the user logs in
and add that to the total
now = datetime.now()
self.startTime = now.time()
now = datetime.now()
self.endTime = now.time()
19:11
buh, how are you supposed to specify a directory path with spaces as a variable? Keeps failing for me.
user image
4
That’s so amazing.
DSM
DSM
Citation needed, but I like it anyway. :-)
> If we could add one thing to Stack Overflow just for you, what would it be?
Oh man, this is our shot to complain about everything on SO that we don't like
Damn! I'm so excited, I can't remember any
@Kevin Support for comments in Salad
@DSM so there isn't a way I could find the difference between two times?
DSM
DSM
Couldn't you just stay with datetimes?
@DSM Nah, we don’t want a citation for that ;P
It’s better without :P
what's the difference? :S
DSM
DSM
>>> now = datetime.now()
>>> nower = datetime.now()
>>> now
datetime.datetime(2015, 2, 2, 14, 19, 42, 898125)
>>> nower
datetime.datetime(2015, 2, 2, 14, 19, 47, 842145)
>>> nower - now
datetime.timedelta(0, 4, 944020)
Guess I'll help davidism out by asking for a chat API and/or websocket documentation :-)
Since I'm actually interested in that myself
19:26
Everyone: be a good Stack citizen and fill in the survey.
thanks @DSM
I think this guy has a misunderstanding about how thread locks work, but I don't know the subject well enough to explain it eloquently.
you know when adding at the start, my current is set to an integer 0
but it should be in datetime format, how can i set it to 0 ? @DSM
@ZeroPiraeus Python 3.4 datetime can handle ISO 8601 with timezones.
Could be as early as 3.2, didn't test extensively.
@MartijnPieters Really? Hallelujah! I retract my earlier hateful comments then.
I'll never understand why people work so hard on tricksy algorithms to calculate pi. All you need is pi = math.log(-1)/1j
19:31
>>> (cmath.log(-1)/1j).real
3.141592653589793
...Neat.
Hahaha ... had no idea it actually worked with cmath :-)
But I need a hundred billion more decimal places. I'm looking for secret messages from the creator of the universe.
channeling Brad Pitt "How many M&Ms are in the jar? How many M&Ms are in the jar, man??"
>>> from datetime import datetime, timezone
>>> datetime.strptime(''.join(datetime.now(timezone.utc).isoformat().rsplit(':', 1)), '%Y-%m-%dT%H:%M:%S.%f%z')
datetime.datetime(2015, 2, 2, 19, 34, 18, 390622, tzinfo=datetime.timezone.utc)
Slight issue there with the : in the timezone..
19:35
The jar is 12 wide and 7 tall and 5 deep, so I went with 12*7*5. I guess I should have accounted for the curved shape and divided by like 1.3. oh well.
And then multiplied for the natural packing density of spheres, and then divided a little bit because m&ms aren't spherical.
@Kevin what is this math code you posted?
@ReutSharabani the thing that prints pi? I just rewrote Zero's message so that it doesn't give a domain error
@Kevin you know, there's a reason why you're employed as a developer, and I'm only employed as a sysadmin....
In mathematics, Euler's identity (also known as Euler's equation) is the equality where e is Euler's number, the base of natural logarithms, i is the imaginary unit, which satisfies i2 = −1, and π is pi, the ratio of the circumference of a circle to its diameter. Euler's identity is named after the Swiss mathematician Leonhard Euler. It is considered an example of mathematical beauty. == Explanation == Euler's identity is a special case of Euler's formula from complex analysis, which states that for any real number x, where the values of the trigonometric functions sine and cosine are given...
19:37
@Kevin I put a few ballpark numbers into Python and sprinkled it with a random call to produce a guess.
DSM
DSM
I can't remember the promised prize. Do they send us the M&Ms?
Strange, I recall the Euler's Identity article having a very cool animated 3d gif which gave a lovely intuitive explanation for the values in the relation.
@DSM You get a fabulous T shirt.
DSM
DSM
Does it say "cabbage" on the front and "rhubarb" on the back?
SO does not know of our ways and customs.
@Kevin why does it print pi?
19:39
does that actually offer any additional precision over math.PI ? (WRT to python calculations ...)
@JoranBeasley I expect math.pi is already as precise as a float could possibly be.
DSM
DSM
The two differ by 0.0.
If it isn't, someone should file a bug report.
so why would you ever not just use the constant?
just for fun?
@ReutSharabani Because e ** (1j * pi) == -1.
19:41
Right. (cmath.log(-1)/1j).real is just a curiosity.
ok just checking :P
DSM
DSM
Which is basically saying that if you turn something halfway around you get to the same place you would have if you flipped it.
Although there are generation techniques that output decimal digits, so you could use those to get as much precision as you want, way beyond what a float can provide.
I don't get why people configure their directory structure "mvc" style... it seems a little confusing
huh? what do you mean corvid?
19:46
like when they have controllers/, models/ and views/ rather than each component having a directory with all its components contained in there
I looked up the source to determine how Python actually calculates Pi. It calculates it... My god... By...
#ifndef Py_MATH_PIl
#define Py_MATH_PIl 3.1415926535897932384626433832795029L
#endif
#ifndef Py_MATH_PI
#define Py_MATH_PI 3.14159265358979323846
#endif
... Just writing out the digits. :-|
No taking the square root of e's favorite color or whatever.
Well that's hardly future proof - what if the curvature of reality changes or something?
@Kevin Well, we cannot have obscure Intel FP bugs skew our perception of the world, now, can we?
What if the circle whose circumference you're trying to calculate, has a radius that passes through a strong gravity well that stretches spacetime appreciably?
@poke Next year, Superbowl L! Because Superbowl S doesn't fit anymore.
19:50
:)
Or because America should go on a diet, after the embarrassment of having to explain how huge size XLIX really is.
It amuses me greatly that they're abandoning Roman numerals next year because "Super Bowl L" would look goofy on the trophy
But apparently "Super Bowl LI" will be fine
DSM
DSM
Doubtless the Patriots will win that one. rimshot
In 5 years time it'll be Superbowl LIV. And everyone will be looking for the missing E, no doubt.
My kinda-sorta-daughter-in-law Olivia will be happy, though.
19:56
@ZeroPiraeus kinda-sorta. On-again-off-again relationship?
Married, divorced, re-married, divorced again?
Daughter of my ex-ish-wife.
Kids at home, build your own joke from these parts: 1. "Super bowl LI". 2. "the NFL needs greater ethnic diversity amongst its players". 3. "Li is a common Chinese surname"
Get your parent's permission before using power tools.
@ZeroPiraeus "ex-ish-wife" Okay Dr. Cox
:-) We're separated for something over a decade, but never got around to divorcing.
It's complicated
20:00
I keep forgetting that other room members have different life experiences than me.
Must make dating interesting. "So, have you ever been married?" Uncomfortable fidget "Well ABOUT that..."
Though my girlfriend and I are in almost nearly the opposite situation. Been together for nearly a decade, had a kid, but haven't got around to marrying.
Heheheh yes, the facts on the ground, plus my inability to pass up a jokey answer, have occasionally led to misunderstandings.
Bah, legal status only matters for tax purposes. You just gotta know whether you're married/divorced in your heart.
20:03
"Oh darling, we've been together for so long I think it's only right that I introduce you to my wife. Don't worry, she'll love you!"
The fact that she's twelve thousand kilometres away reduces the threat value, I think.
But it increases the irony when she does appear, which makes the situation more likely for certain kinds of universes (ex. trashy soap operas)
@MartijnPieters that question feels to "WALL OF TEXT"
Speaking of which, if you can cope with the inevitable "romance" aspects, Jane the Virgin is a quite entertaining parody of Latin American telenovelas.
DSM
DSM
Some days I wonder if I'm going to meet some kid who comes up to me and tells me "I think you're my father". She'll be precocious and cute but resent me for never having been around, which under the circumstances I'll think is kind of unfair.
20:11
re-cbg
@DSM Me too. I try to imagine the correct response.
@DSM ... and then you'll have to solve the murder for which her mother was wrongfully convicted, during the course of which you'll discover a bond that etc. etc. etc. ?
ex. "Ok. Want to come in and play Mario Kart?"
the populate function on mongoose models is actually really awesome
@AnttiHaapala yeah, I had to caught the bus, sorry
20:14
At least by watching Arrested Development, I know many examples of what not to do.
is this an acceptable answer (I always feel weird with copy/paste answers... but link only is frowned on) stackoverflow.com/a/28285946/541038
But most of them boil down to "don't be a terrible human being", which I am already aware of
DSM
DSM
@Zero: it's going to be tough, but I owe it to her. Her mother was only trying to protect our daughter from the cartel, after all.
@JoranBeasley Seems reasonable with the attribution ... maybe a heads-up to the author of the source if possible?
@JoranBeasley Personally, I'd put the whole thing in a quote block, but that's just a style choice. Seems fine.
20:17
(just as a courtesy)
what should i use to compile a python program which uses QT and Sqlite?
@JoranBeasley I didn't manage to read all of it. I felt over-stuffed.
@MartijnPieters you mean that one question about set A and set B?
DSM
DSM
I think he meant the question you asked about.
DSM
DSM
20:23
Oooh, ambiguity!
Yeah, I have no idea if it's too broad or a two-liner. Eyes glazed over.
(he posted that he thought it was too broad, too which I replied it felt to "WALL OF TEXT")
lol yeah Ive tried a few times...
but I suspect its not too broad ... but in his quest to make it crystal clear, he has made it very unclear
DSM
DSM
"I am a data scientist before a programmer" and "I am not using pandas, and would like to avoid the added overhead it would bring."? If you're not a programmer, shouldn't you be using the highest-level tools available to you?
Oh, well. Suppose I should be grateful the competition is so willing to shoot themselves in the foot.
^ that is a very good point ...
Why would someone not use pandas?
@JoranBeasley Yeah, the wall of text.
DSM
DSM
20:28
They're running on a Python implementation that doesn't support it; they're doing a lot of processing of data which is too big to keep in memory; I can think of a few reasons, but very few of them apply to the typical user.
But if noone can make it through the wall of text, perhaps unclear is a better option?
he definitely wants some kind of relational database ... be it pandas or sqlite or postgres ... a flat csv file is an interesting choice of database
20:44
Hey guys BeautifulSoup question here: goo.gl/oVQIhU - I want to get the text string from the element, while also encoding the é character as an HTML entity. I'm having trouble doing both with BeautifulSoup...
I would like to meet more people like myself. Yesterday I thought, "I know, tomorrow I will wear a green shirt and stand in the cafeteria. Everyone like me will have the same idea, and I will be able to identify them by their green shirts."
But this didn't work. I don't know what went wrong.
@Martin I get u'\xe9\n'.
E.g. it works.
That's é plus a newline.
@Martin same problem as before, huh? You said you're using SublimeText to run Python, right? Is it possible that SublimeText auto-parses the HTML entity?
Or did you want BeautifulSoup to return é instead?
@MartijnPieters I prefer the #eacute but I am getting it with the tags as well
@AdamSmith I actually managed to fix that sample by adding u to my strings
20:50
? Sorry, I don't follow.
@MartijnPieters stackoverflow.com/questions/28286411/… He doesn't seem to be happy
é is encoded data, BeautifulSoup gives you decoded data.
@MartijnPieters Let me add my output to the gist
Actually my console breaks
@Martin Try using a Python interpreter in a terminal instead?
What console, define 'breaks'?
@vaultah No, but his question is also unclear.
Yeah sorry it throws an error saying it can't read the character.. if you refresh the gist I pasted in what I get
20:53
@Martin Right, your console is configured to only handle ASCII data.
Sorry I'm new with Python :/
Or at least, it told Python that it could only handle ASCII.
The é character is not ASCII, it is a Latin-1 codepoint.
if you use idle you will probably see the right thing ... thats the easiest solution usually
@JoranBeasley IDLE and BeatifulSoup NavigableString objects have a bad interaction, bug in IDLE.
Ok yeah sorry that's where I'm having problems.. I want to use something like .prettify('ascii') so that I can use it, but I also want to remove the tags from that output
20:55
lol oh dang ... well thats usually the easiest way to get a python console that handles special chars
you could try the console in eclipse+pydev , or pycharms console , maybe even ninja
or sublime console (thats what ninja is built on right?)
If I know I'll be doing this with only basic tags, I could use a regular expression to get rid of thm right?
Guys, how do you change the seed number for randrange?
Cause .prettify('ascii') works just fine, it just leaves me with a string so I can't use BeautifulSoup methods on it
DSM
DSM
@Phonon: you can use random.seed to set a global seed, or (cleaner) use R = random.Random() to make a Random instance and then call R.seed on it.
Or should I use HTMLParser instead?
DSM
DSM
20:58
Oops, time to go to meeting! No time for randomization fun. :-/
@DSM Alrighty, thanks a lot, noted. Is continuously changing the seed number every now and then makes randrange a valid RNG for a Monte Carlo type of simulation?
Wait for it ...
anyone familiar with cx_freeze?
[tag:cv-pls] http://stackoverflow.com/questions/20260201/whether-django-need-licence-while-deployment
[tag:cv-pls] http://stackoverflow.com/questions/10815561/how-can-i-get-apply-for-a-gpl-licence-for-my-github-project
[tag:cv-pls] http://stackoverflow.com/questions/9609282/good-django-apps-source-code-to-read
[tag:cv-pls] http://stackoverflow.com/questions/9440659/mechanism-for-identifying-ads-on-a-webpage-specifically-adblock
[tag:cv-pls] http://stackoverflow.com/questions/9025730/who-can-tell-me-a-small-opensource-project-on-python-not-django-with-good-test
(stopping there, promise)
Voted on all.
@ZeroPiraeus: you cannot use markdown in multi-line posts.
Unless indented by 4 spaces, then the whole post is code.
21:06
Chat has weird rules.
A sufficiently advanced cv-pls tag detector/notifier script ought to be able to figure out what he meant anyway ;-)
Yeah, noticed that. Still, the intention is clear ... just a shame the script doesn't handle it.
@Kevin Call in the &quot;Web Developer!&quot; (<3 davidism)
Anyway, voted on the ones that weren't already closed by the time I got to them.
Speaking about our &quot;Web Developing&quot; friend. He's close to 10k.
21:10
g-g-g-g-g-g-g-g-gong!!!!!!!!!
Yeah we're racing to 10k. I don't know if he knows it though.
There always seems to be a race to 10k going on.
Pretty sure I got passed by like four people, during my time
2
Q: python cx_Freeze egg problem

bandanaim trying to build an executable (for 32bit windows xp) from a python script (which uses lots of eggs) i considered py2exe(0.6.9), PyInstaller (1.4) and cx_Freeze (4.1.2) py2exe doesnt like eggs for breakfast PyInstaller doesnt like python 2.6 for lunch) so i went with cx_Freeze (supposed to ...

what do they mean by source file ?
/: can someone help
A source file is a file that contains code.
A source directory is a folder that contains source files.
btw, when he says "i did this script that you most run in your source", I believe he means "that you must run in your source"
21:14
but i have alot of modules?
@JonClements @Jon Clements wb?
I'm in a meeting, I stopped them to say "10k!".
7
Well worth it.
I expect the solution still works even if you have many source files, as long as you put that script in the source directory that contains them all.
21:16
@davidism nice one!
I told my dad when I got Python gold. He didn't seem impressed.
@davidism &quot;gratz&quot;
I tried to explain Stack Overflow and this room to my parents, they didn't get it.
I just refer to you guys as "my Internet friends" when I need to relay an anecdote in meatspace.
I refer to you all by name and pretend you're friends from Bath.
21:18
That is acceptable.
It's easier than explaining the internet.
The Internet is just a monoid in the category of endofunctors, what's the problem?
gratz @davidism
I've hit a bit of a hurdle porting some python2 code over to python3. It was using pypy before and an older version of cffi. Now that I've moved to python3.4 this is no longer working:
from cffi import FFI
ffi = FFI()
ffi.cdef("""
typedef unsigned int mode_t;
int shm_open(const char *name, int oflag, mode_t mode);
int shm_unlink(const char *name);
""")
C = ffi.verify("""
#include <sys/mman.h>
""")
21:22
@Kevin maybe focus on questions?
is disappointed that there's no technology called "Inca" worthy of a tag
cffi.ffiplatform.VerificationError: __pycache__/_cffi__x7e93427xdb6f9320.cpython-34m-x86_64-linux-gnu.so: undefined symbol: shm_unlink
I'm more than happy to try to grind this out but I'm honestly not too sure where to start, anyone got any tips?
Thanks everyone, I have a feeling I got a bump at the end for some mysterious reason. :3
just googled "maya gold" and was slightly surprised by the Wikipedia entry
wow... this company gave quite a big interview question.
@ZeroPiraeus But Mayan gold carries a terrible curse. (citation: Pirates of the Carribean)
(although frankly, eternal life at the expense of food turning to ash in your mouth is arguably not a "curse")
21:26
8
Q: Stack Overflow Deleted Questions Archive

Lance RobertsWhat are some of the more popular questions on Stack Overflow that have been deleted? This is an archive of popular deleted questions on Stack Overflow, mostly from the days when a broader range of questions were allowed. Also, they may be a poor question, but have really good answers. If some...

time to look through that
Davidism, have you used Django much?
Finally got it working exactly how I want
Today I answered a so-so question, which only got 6 views over 2 hours :d
@corvid what was the question? I always like hearing interview code questions
@JoranBeasley Basically, use python and angular.js to develop a database driven web application
I know literally nothing about angular.js
make a basic CRUD model to update the models, things of that nature. Feels like a pretty decent amount of stuff for only 1 day
django gives that to you free with their admin page
I woulda just made a django app
I have no idea about angular
yeah that's what the recommend, using Django and sqlite. I think Flask seems more appropriate though, considering the scale is so small
flask is pretty easy ... you would have to code it all or use flask-restless to provide api endpoints to sqlalchemy models ... with django you literally just create the models and register them and it give you crud backend through /admin
to be fair there is probably a flask-crud out there
DSM
DSM
21:44
@Phonon: that's not how I'd put it. With Monte Carlo sims you typically set a seed at the start of the simulation. Python's RNG is strong enough for production use.
I actually do quite like Flask-Restless
were they expecting you to do it right there with them? or get back to them with a solution
@corvid yeah, the first version of my project was all django, did a ton of work with it
and used it for multiple large projects before that
@JoranBeasley Get back to them with a solution, they said in around 24 hours
@davidism Is it much different than flask?
@corvid well thats certainly plenty of time to roll your own with flask I suppose
angular.js == jinja but for js ?
it looks like its just like the templating engine that all those web frameworks come with
21:48
@JoranBeasley Nah, angular is like for single page web applications. Instead of getting HTML, it gets JSON from an API and updates the DOM. So, in a way yes
yeah I have used plenty of jquery and bootstrap ... I understand ajax fairly well
DSM
DSM
@davidism: you've sent me down a dark path. "Surely you can't be serious."
@DSM makes sense, thx.
I dont understand why the angular.js requirement ... that seems like just something to make it more annoying
DSM
DSM
@Phonon: and just to be clear, each run uses a different seed, so that you can reproduce them later individually.
21:54
oh I see ... the interwebs says its good for crud
@DSM ?
DSM
DSM
@davidism: I followed your link and started reading this question on bad interview questions..
@JoranBeasley I applied as a front end developer, so not too surprising. The serverside components seem really straight forward
ah, I couldn't tell what you were replying to :)
DSM
DSM
Hey, congratulations, BTW! ♫ Hip hip hooray! ♫
21:56
@DSM In merely 400 rep I'll be able to see that link too! :P
I'm the happiest cabbage in the room right now. :3
@corvid ok that makes sense if you are familliar and comfortable with flask, flask-restless and sqlalchemy I would look at this link draptik.github.io/blog/2013/07/28/restful-crud-with-angularjs
but disregard that dirty java stuff
ewww, java
DSM
DSM
"It represents man's inhumanity to man."
wait, so, dumb question... is importing a plain module the same as having a class in a module and doing from blah import classname?
DSM
DSM
22:05
What's a plain module?
Hi, someone know how to deal with ssl and HTTPSConnection with python3
what @DSM asked? I second that question
if a just make an http.client.HTTPSConnection(host, port) the connection is secure or i need to create a secure socket before ?
I would assume from the syntax you posted that it establishes the secure connection
there maybe some check for valid certificates and what not
DSM
DSM
22:12
I was about to ask how you tripped across that but I see it got a late answer.
@Joran: but then I could have never written an answer because I've never asked a question.. I guess I could have edited and had them accepted, maybe.
yeah thats why I removed that comment
I was just annoyed by that late answer that davidism pointed to
23:06
man I want to see that TurboKid movie
reminds me of my childhood
23:21
Hrmph. I forgot so much Flask stuff already :\
its really simple ... you can do it im sure
did you get teh angular stuff working already?
yeah angular is pretty easy for the most part, when you exclude users
flask is a wallk in the park too ... so you should be finished already :P
just doesn't seem to be initializing my database, db.metadata.tables.keys() is empty
are you using sqlalchemy?
23:32
yeah, sqlalchemy and sqlite
you need to initialize it
yep, did that
Base.metadata.create_all(engine)
you did that?
then it should be created
and you can see the file?
db = SQLAlchemy()
def create_app():
  app = Flask(__name__)
  # ...
  db.init_app(app)
  return app
the file is there and everything. then I did db.create_all() from shell
oh you are using that flask-sqlalchemy thing huh ... its just different enough that I cant tell you much
are you sure its not created?
open it with sqlite3 command line interpreter and print .schema
23:35
It created the file, but just doesn't seem to have any tables. Was going to try to interact with it and see what happens
if you run schema you should see the tables ... maybe they dont show up in that metadata thing if they are empty or something ... I would check the file directly with the command line tool
afk going for caffeine
2
Q: next() doesn't play nice with any/all in py2.7

amwinterI ran down a bug today that came about because I was using next() to extract a value, and 'not found' emits a StopIteration. Normally that would halt the program, but the function using next was being called inside an all() iteration, so the all just terminated early and returned True. Is this ...

a bit mis-tagged since it's neither unique to py2.7 nor does it use any list comps :)
@AdamSmith yep i was thinking about this !
Is it sad that I'm using IPython to grep a file's contents because I can never remember the special rules I have to remember so I don't bug out findstr on Windows?

« first day (1570 days earlier)      last day (3603 days later) »