« first day (1942 days earlier)      last day (3231 days later) » 
00:00 - 19:0019:00 - 00:00

00:10
@JRichardSnape I tried it out. But the problem still remains if the second line is long enough to wrap onto a third line
thanks for trying, though
00:29
@JoranBeasley did you get anything? I got it down to five lines + imports but I'm sure I can do better
00:49
lol same ... 5 lines i think (maybe it was 6)
I don't even know if mine will run. Can you do in-place addition as part of a compound boolean? (a+=b and c)
with open("wordfile") as words, open("random_words.txt", "w") as out, open("letter_count.txt", "w") as counts:
    c = Counter()
    [c += Counter(words[i-1]) and out.write("{{:3>d}}, {{:{}>d}}, {{}}\n".format(len(str(len(words.readlines())))).format(i, randrange(1, len(words.readlines())), words.readlines()[i-1] for i in range(100)))]
    for _, letters in groupby(c.elements()):
        counts.write("".join(letters) + "\n")
whoops and I screwed up the format strings too lol. "{{>3d}}, {{:>{}d}}, ...
 
1 hour later…
02:23
cbg
@AdamSmith ewww
@
you've got a side effect in a list comp
03:20
Hi people...
Can someone help me please?
I am triying to do something with regex...
I have something like this : "Tomato juice with 454ML"
I need to get just the 454ML
And sometimes appear something like "Tomato juice with 45G and 155ML"
In that case i need to get 45G 155ML
I test some things, but nothing happen.
re.findall('^[0-9]', text)
 
4 hours later…
07:17
CBG all.
@Victornez why not re.findall(r"([0-9]+?[a-zA-Z]+?)", text) but I don't know if it is efficient.
Or if you were crazy enough you could do this

    for a in text.split():
        if a[-1].isalpha() and  a[0].isdigit():
             print a
07:33
hi guys
hi guys ,
I have a short question
I have a list of items of different length
Item could have one till ten elements
I tried to filter items like following

result = model.freqItemsets()\
.filter(lambda x: x.items[0].startswith('aa_'))\
.filter(lambda x: x.items[1].startswith('aa_'))

But this statement produce
IndexError: list index out of range

Can I add IF here or could be another solution ?
Like
.filter(s for s in items if items.startswith('aaa_')
(not working currently for me )
?
Thx
07:50
@Toren what's the type of the object you're calling .filter() on?
from pyspark.mllib.fpm import FPGrowth

FreqItemset(items=[u'A_String_0'], freq=303)
FreqItemset(items=[u'A_String_0', u'Another_String_1'], freq=302)
FreqItemset(items=[u'B_String_1', u'A_String_0', u'A_OtherString_1'], freq=301)
apparently, some of x.items is not long enough.
do you want to keep those sets where all the items start with 'aa_'?
only one item will start from 'aaa_' in FreqItemset
like u'A_String_0' in example
A_String_0 doesn't seem to start with aaa_.
08:07
yes , only example A_ instead of aaa_
from pyspark.mllib.fpm import FPGrowth

FreqItemset(items=[u'aaa_String_0'], freq=303)
FreqItemset(items=[u'aaa_String_0', u'Another_String_1'], freq=302)
FreqItemset(items=[u'B_String_1', u'aaa_String_0', u'A_OtherString_1'], freq=301)
Cbg :)
Scala is beautiful
I think I have a new favourite language
no its pyspark
python API
@Toren he wasn't saying that it is pyspark.
Ok sorry
statement result = model.freqItemsets()\
.filter(lambda x: x.items[0].startswith('aa_'))\
08:15
@khajvah Scala is beautiful, but it's beauty of a siren.
works for me
but check only first element
if I use result = model.freqItemsets()\
.filter(lambda x: x.items[0].startswith('aa_'))\
.filter(lambda x: x.items[1].startswith('aa_'))\
I got error
That's what I said before: for some x x.items has only one element.
yes exactly
I think about this problem several days
but don't have any clue yet
@Toren I think you should ask a question on the main site with an MCVE. You're actually asking more about Spark functionality than Python and so it's likely you'll get more help there.
@JRichardSnape I deliver pizza, meta questions, and sarcasm.
@Toren it's quite difficult to help unless you describe what you actually want to do.
@Toren I found your question on the main site, it makes a lot of sense to emphasise that you're talking about spark, not regular lists.
08:30
@bereal I am thinking of using it over Python on a serious project. Hope it will go well.
I'll try to explain more

in example below I want to catch each item that started with aaa_

FreqItemset(items=[u'aaa_String_0'], freq=303)
FreqItemset(items=[u'aaa_String_0', u'Another_String_1'], freq=302)
FreqItemset(items=[u'B_String_1', u'aaa_String_0', u'A_OtherString_1'], freq=301)

when I use
result = model.freqItemsets()\
.filter(lambda x: x.items[0].startswith('aaa_'))\

I'll catch line one and line two only
line three has aaa_ but I can't catch it

I'd like to catch line three as well
@Ffisegydd what MCVE stands for ?
Guys, are traffic lights static in your countries?
in my city, all of them work with predefined patterns, which seems dumb.
I am gonna write a traffic light control system
found MCVE
08:51
A book author's self description:
> Benjamin James has an IT degree and worked as a software developer at a company for years. Also he helped many people with security problems and their computers. He knows how to twist the languages C++ , JAVA , C# and visual basic with no ease. Also, he enjoys hacking he’s own computers time from time to see how it goes. He made thousands of articles for the World Wide Web teaching various subjects. Currently, he’s making a huge software. Also writing 2 novels and a short film.
09:37
@khajvah non-trivial task...
Mostly they operate on pre-defined patterns in the UK. There are a few adaptive ones, where patterns change for rush hours. There are also a few that sense the presence of waiting cars and change at the next available safe time (constrained by how long since last change etc.)
I used to work in railway signalling - there are overlaps...
@Ffisegydd I have no evidence for assertion A. B and C have been verified empirically.
@JRichardSnape yeah but I suspect, a mathematical model can be made based on some statistics
"based on some statistics" covers a wide range... Sure - it's something to try out. You need a good model of traffic flow given whatever traffic light algorithm you are testing, so that you can check for unintended consequences. It's a nice problem. The hard bit is sequencing, so if one set of lights adapts, you're not causing a backlog at the next and so on...
@JRichardSnape Might be a good senior thesis problem, don't you think?
@khajvah possibly so (I'm not sure what level "senior" is in your terminology - last year of University?)
yeah bachelors degree
09:52
Yes - could be a good one at that level. It has been studied before - so you could show the ability to draw in some literature e.g. iopscience.iop.org/article/10.1088/1742-5468/2008/04/P04019/… (that guy Dirk Helbing comes up a lot in complexity problems...)
If you put "traffic flow sequencing" into scholar.google.co.uk, you'll find some early work on traffic lights too.
As well as the railway signalling background, I know a bit about this because traffic flow is one of the topics often discussed when learning agent-based models (ABMs), which I make.
10:10
Nice thanks a lot I will look at those
10:23
cabbage
You could solve that with a Genetic Algorithm, amirite? </trolling>
@Kevin I'm skeptical. Someone who tests primality of n by trial division by all numbers less than n doesn't know much about efficient primality testing. It is possible on modern hardware to do deterministic primality testing of 300 digit numbers, according to the prime pages, but it's neither simple nor fast.
Of course, if you just want primes for cryptographic purposes, rather than number theory, it's often adequate to use a probabilistic test.
user559633
What if you want primes for steak or optimus reasons
Anyway, I added some relevant Fibonacci prime links from Wikipedia & OEIS. I don't think they'll be much use to the OP, but they may help a future reader.
@tristan I suppose prime steak is more sought after than composite steak...
@tristan :D
10:37
OTOH, I could never figure out how the police can identify a prime suspect from a composite photo.
FWIW, I posted some Python code on SE.mathematics recently that can determine primality of numbers < 3317044064679887385961981 fairly quickly: math.stackexchange.com/a/1638487/207316
10:51
I've never really understood the "wide" avid interest in discovering primes. I know why it's important, but always thought it would appeal to less coders
That being said, I'll check it out during lunch PM, thanks for sharing
@IntrepidBrit Well, a lot of the early programer were mathematicians, so calculating primes is kinda traditional, like calculating ridiculous numbers of digits of pi.
user559633
it makes the computer fans turn on and your code takes some time to return, so it's real programming
and you write it in C like a real programmer
The infamous Pentium floating point division bug was discovered by a mathematician doing research on prime gaps, Thomas Nicely.
After reading that question about Fibonacci primes that Kevin linked to I wrote a little Python program to calculate them. But it uses the gmpy module, so all the hard work is being done by the GMP library, which is written in C, with some assembly and C++.
I left it running while I was eating dinner & it got up to F(14431), which has 3016 decimal digits, which isn't too shabby. But of course gmpy could only say that it's probably prime; I used the default probability of 1 - 1/2**25.
11:16
Why is this allowed, let alone upvoted?
@khajvah They did things differently in Ancient Times.
And after all, it is just a link to another Stack Exchange site.
Anyone had problem with Scons and python 2.7 ? I have a specific problem (TypeError: 'Dir' has no len() ), I understood the problem, But can't find it in specified file (../SCons/Script/Main.py)
TypeError: object of type 'Dir' has no len():
File "C:\Python27\Lib\site-packages\scons-2.4.1\SCons\Script\Main.py", line 1374:
_exec_main(parser, values)
File "C:\Python27\Lib\site-packages\scons-2.4.1\SCons\Script\Main.py", line 1337:
_main(parser)
File "C:\Python27\Lib\site-packages\scons-2.4.1\SCons\Script\Main.py", line 952:
_load_site_scons_dir(d.get_internal_path(), options.site_dir)
File "C:\Python27\Lib\site-packages\scons-2.4.1\SCons\Script\Main.py", line 741:
exec fp in site_m
File "C:\Users\V-link RTC\Documents\libjingle code\libjingle.googlecode.com\svn\branches\nextsnap\talk\t
Which file should i look up ? Main.py or ntpath.py ?
11:44
Start from the bottom to find out what kind of values the code expects and then go up until you find the position where you need to fix it.
dupe stackoverflow.com/questions/35290708/… If someone wants to find a better dupe target, feel free :)
That moment when you accidentally click on a w3schools link…
Q: What's worse than clicking on a w3schools link? A: Looking at the source code of a w3schools page.
12:03
just found out about kcachegrind cProfile visualizer. Feeling bretty gud
 
1 hour later…
13:11
Wheee, random unexplained downvote.
13:30
Mmmmm.... Coffee....
guys, how do you notify other program instances that a data has been modified?
I am caching a lot of data and don't know how to handle this
@intrepid <countertroll> you can solve anything with a genetic algorithm, right? </countertroll>
I was thinking about implementing it by Redis messaging feature. Is it a good solution?
No idea about "good" in this context, but some of my colleagues use rabbitMQ for that kind of purpose
My concern is what happens if there are multiple servers (distributed) but then, I don't know how the database is handled anyways.
but RabbitMQ looks nice.
user559633
13:51
depends what you mean by "program instances", what sort of message you need to pass, and what your requirements are, really.
Ok, I will explain. Those are web server (Gunicorn) instances. Each of them is caching about 300MB of data (the same data), as that data is used heavily for every request. So when something changes in the database, I want all instances to get notified, so the data can be relevant.
messages can simply be something like "the guy with id=21 has been updated"
user559633
Cache invalidation for worker instances?
Yeah. That's a good way to describe it.
user559633
Where you have distributed workers and distributed caching, unless the clocks are in sync and you're scheduling a future invalidation, give up any expectation that the changes will all occur around the same time.
Morning cabbage.
user559633
14:00
cbg
@tristan I don't think I will need instant update. A minute latency for servers to have time to update should be fine.
user559633
@khajvah Cool, then it depends how you're caching locally. If you're using sessions or a user sticks to a specific server/instance, you could optimistically reflect the change for that user, then allow cache invalidation to happen in the background for other requests
^ Appropriate use of Excel.
ahhh, cute. That is the about the best use of excel I've seen for a while
user559633
14:04
My laptop's SSD is corrupted. If my user account starts sending vile messages, it's because the disk made poor choices.
@tristan Cache probably wasn't a good word. The cached stuff isn't user specific, it's global application specific, so it's kind of simpler, I guess. I just store objects in a data structure in a Python module.
user559633
@khajvah And the interpreter process maintains those variables for each of its threads?
@tristan Yes, Gunicorn instances don't share those objects.
Been spending the day playing with ELK. Love it so much.
user559633
@Ffisegydd L is the weakest part of that stack IMHO.
14:11
I would say, the problem will still be existent even if I am able to make separate threads share the objects when the servers are distributed.
user559633
@khajvah Yes, because you're storing N-process local copies that update at different times.
user559633
If you're willing to go down the route of adding the complexity of redis or rabbitmq, why not just have the processes share a redis instance?
I tried memcached for storing the data in it but the speed wasn't quite good.
Though I have to admit, the code isn't a good one too.
user559633
profile it for latency/etc. if the RTT to some other server is non-trivial, yeah, of course it will be bad vs a proc local var
The problem is, there are requests which causes different modules to access the same object over and over again, so the same object gets accessed lots of times.
14:20
@tristan It does its job for me as it's a pretty simple usecase so I don't mind. I'm really liking the simplicity of it all though.
Having global immutable objects seemed to be a solution at that time but I suspect lots of problems with those.
user559633
It's all about tradeoffs. If you're memory-rich, then sure, whatever do a process local cache. Again, profile.
Managed to get it up and running on my webapp in under an hour.
My house is up for sale! Buy it.
user559633
@Ffisegydd Yeah, totally. It starts falling down when it's decided that one of your filters is invalid, and that it should just crash the JVM repeatedly
user559633
14:21
@RobertGrant Man, you should go into real estate. What a sales pitch
Ok thanks. I will try to optimize the code before choosing a new technology.
@Robert I'll give you £5!
user559633
Or you could profile your code to see how active the cache is, why a shared cache (vs proc-local) didn't work for you, and then you'd know where to start focusing your work
That's better. I will do that, thank you.
@Ffisegydd woohoo!
user559633
14:26
@khajvah No worries :) With a 1 minute upper threshold allowed, you have a lot of options. For one of my setups, I feed a server-local cache from redis for my procs to share and it's working out pretty well for me -- if the local cache is suspect, I can drop it and the procs will go to redis on a cache-miss. if redis doesn't have the object, it hits the API to regenerate
@tristan Again, how do you drop out-dated objects from server-local cache :D
If you state your answer with enough conviction, you'll get upvotes. I've found this myself, discovering I made a mistake or was wrong and having to delete an upvoted answer..
Oh wait - I starred that and it was a load of rubbish!
user559633
@khajvah depends on what cache strategy/algorithm you're using. if you're using a dict for a cache, set the key to None. if you're using redis, send a delete, etc.
@tristan I mean, how do you get notified that the cache is out-dated?
14:31
@tristan is your server-local cache basically a thread-safe dict in your application?
user559633
@khajvah depends what caching strategy you want, what algorithm you're using, etc.
Ok, I will stop sucking your blood. Will do my own research. Thanks a lot.
user559633
@RobertGrant that could work, especially for a dog-pile setup, but no, it's a simple api wrapper listening for anything on localhost around a chunk of the data stored in a read-only redis slave
user559633
@khajvah no worries :) caching is both hard to get right and can be really application specific imho
Ah okay that makes sense
Couldn't tell how close to the application your server-local cache was situated
14:38
guys everything is too event-driven now and it's so confusing :|
I hope you are not doing JavaScript.
user559633
the aforementioned cache is for a setup without sessions, and while i considered a process-local cache (my webservers are 2 core machines and the obj from the db are small), it was pretty pointless once i went beyond 2 servers because i had a less than 50% chance of ending up on the box that had the cache
@corvid And here I am responding to a corvid event :P
user559633
i'm confused
I'm using JS mostly right now, some python on back end
14:48
cbg
morning
@Kevin: Now that you've clarified George R's question I've voted to reopen... and I've written some code using **kwargs. :)
All right, I'll vote as well. Although I have a feeling it may get hammered as a dupe of any number of other "variable variables" questions
It's not necessarily a variable variables question, though.
Tell that to every other mjolnir wielder ;-)
14:52
Eg
from itertools import combinations

def ratios(**kwargs):
    pairs = combinations(sorted(kwargs.keys()), 2)
    return dict((p + q, kwargs[p] / kwargs[q]) for p, q in pairs)

print(ratios(a=600,b=3,c=2))
I guess I will add a comment asking the OP to read that variable variables question.
This is the second question today where I've responded with "what you're doing is a bad idea, but here's how you do it"
I've got this whole "giving bad advice" thing down to a science.
"You keep missing every time you shoot at your foot? Have you considered a firearm with a longer barrel?"
George seems to have gone AWOL
Anybody know a good guide to setting up virtualenv on Windows to switch between py2.7 and py3.5?

I set up virtualenvwrapper-win; I can't get pywin to install (I'm on Windows 10).
Created a virtualenv for 2.7. Not sure how to "switch" to py3 to create the other virtualenv.

I know there's a python environment switch tool that's builtin now (via py -2 / py -3), but it's not sufficient for what I need to do.
py -3 -m venv some-environment?
14:58
@PM2Ring He's back. And the post needs another reopen vote.
What post?
Reopened.
Ok, I'll post my answer. But I was hoping George would respond to my comment first...
Pretty sure I'm going to go through three more rounds of "one more thing..." with Iterating by object in Python 3
Lesson: people that don't have the sense to abandon a bad design, also won't have the sense to ask a new question when they have a new problem.
@RobertGrant That does sound really cool. I'd be much more impressed if the example site didn't throw a security warning.
It does say in the link that it's self-signed currently
Nice question: How do I indent print statements from a function call w/o changing the function. :/
I am thinking of redirecting the output temporarily and then printing them again with indent.
Buh I need a word... what's the word for when something seems like it can be done better? Ie, "this solution is _____ because you can just do this instead"
15:10
@corvid “meh”
@Kevin I was just about to post an answer to that question but you beat me to it, with virtually identical code. At this point, my advice is: run away!
@corvid "sub-optimal" ? It's more polite than saying "crap".
@corvid You should try to make it a positive statement though if it’s criticism directed at someone else. Something like “This solution is good, but we can do it like this instead which is better because <insert reasons>”
it's something like "well it can be done, but why do it that way?" into a single word
I can think of hundreds of these words.
they all seem slightly off the mark when I think of them, what are some you think of?
15:17
rhubarb
"not optimal", "not pythonic", "this solution can be done better", "not ideal"

go go gadget thesaurus for "sucks", "terrible", "why the crap did you do it that way"
meta-advice: sometimes constructing a sentence around a single unknown word, and then looking for something to fill in the blank, will lead you down a blind alley with no good exit. If you spend more than 100 seconds looking for The Perfect Word, consider tearing down the rest of the sentence and trying a different approach.
rhubarb PM
"The More You Know"
Not all mathematical facts have a beautiful proof. Not all scenes can be captured as a beautiful photograph. Not all mostly-complete sentences have a beautiful final form.
Example: that last sentence.
15:22
@Kevin I’m sure there’s a word for what you just said. Presumably a German word.
;-)
Me, one minute ago: "Not all sentences have a beautiful... uh, composition? expression? What word should I use here? Wait a minute..."
@Kevin or else, go ask on ELU.se
Yeah, those guys are all right by me :-)
if there isn't a single word for what you want, by god they'll make one up and still sound more accurate than anything I'll hear my newphew say this week.
I feel like English is missing a lot of words sometimes, I know other languages have them
15:32
Just say some french words until they agree with you. "This solution lacks... éclat."
"Where's the elan? Where's the joie de vivre? All I see is sturm und drang and it fills me with weltschmerz."
@Kevin Google autocompletes† to “girl”. So it’s “Not all sentences have a beautiful girl” which is kind of true.
It's technically correct. The best kind of correct.
And I think "convoluted" is pretty close to what I was aiming for
@Kevin I usually just use latin, to sound smart "you know, it's just like that. sic vita est quid pro quo vis a vis ad infinitum"
@Kevin Very goomoogly of you
Can't say I get that reference.
Or, is the joke that it's a brand new word. Ok, that makes more sense.
15:48
I should stay away from the jokes and stick to complaining about programming.
Note that "is a good joke" and "is understood by Kevin to be a joke" are often orthogonal concepts.
16:20
Did we ever get that ranked star list?
Yeah.
Heh, SO has a "Posted by me" category. I think they solved my XY problem there. =)
Jan 28 at 14:35, by Kevin
Now for something completely different. I finally got my star list parser working. I'm way late to reply to whoever asked "what are the most starred messages" days ago, but here they are.
I was there for that. I was hoping there was a bigger list
I can generate a larger list after lunch and put it on pastebin or something
16:25
Can you automate it for all the rooms? Which message has the highest no of stars across rooms
@poke I ended up setting up py2.7 on my Windows path. I installed py 3.4.4
Then via mkvirtualenv --python=C:\Python34\python.exe py3.4env it setup my virtual environment correctly.
Doing the same thing with Python 3.5.1 fails and complains about a missing DLL ( "The program can't start because VCRUNTIME140.dll is missing from your computer.")

Someone already raised that bug in virtualenv: https://github.com/pypa/virtualenv/issues/796

Just thought I'd give an update. :) Thanks for the suggestion earlier
@BhargavRao I could automate it, but it runs at about 10 seconds per 20 starred items. Scanning lounge_c alone took like an hour.
That's sad :-( ... Perhaps you can let it run, return after a long holiday and then post the results.
I'm guessing that Lounge_c has the largest star list, though, so I don't expect that kind of run time would be typical for other rooms.
I bet once I grind through like Java/javascript/c#, that would be 90% of the total run time right there
Ok, here is the sorted list of absolutely every starred message as of two weeks ago: pastebin.com/B65fr8aA
Wut?? The starlord is 7 down? Unbelievable
16:35
The first time I noticed that, my weak rationalization was "well I have the most total stars among all the messages in the top 20" or something like that.
Whoops that's not true either.
poke 57
Jon Clements 54
bereal 48
Kevin 35
Robert Grant 34
Inbar Rose 34
tristan 33
davidism 31
roippi 21
Ffisegydd 21
vaultah 16
Sigh, I am not in the list ;_;
Now I remember. It was "well I have the most total stars among all messages"
Kevin 1518
Ffisegydd 778
tristan 677
Jon Clements 468
davidism 439
poke 306
DSM 253
Robert Grant 243
corvid 205
Martijn Pieters 187
You've got almost double Fizzy's stars.
Yeah but that's less impressive because I post more than him.
I'm not the most accurate shooter, I just use more bullets than everyone else.
total stars / total posts would be a more honest ranking, I think
But the high score list might be dominated by users that made exactly one message ever, and that message got some stars.
I wonder if total posts is available.
16:44
@MorganThrapp yes
You can see the count for the regulars and ROs in the bottom right corner of their respective boxes on chat.stackoverflow.com/rooms/info/6/python, but I'm not sure where else you can find that info.
Mine's 8304
It seems I've posted 8828.
I didn't think I posted that much.
I can deal with being in the top 30-ish
@MorganThrapp That's the total. 8380 in this room
16:48
Oh. I didn't think I had posted that many messages outside this room.
There's been a couple in Rust, a couple in Code Golf, and a handful in sopython.social.
We both need 300 more messages here to get to 1% of all messages
@BhargavRao Not if I reply to your ever message :)
Bhargav has 0.0054 stars per message. Morgan has 0.013 stars per message. I have 0.022 stars per message.
@khajvah Then I will need 600 more :P
Not bad. 0.00054 implies I'm a bit funny too :/
0.013 is actually a little better than I thought I'd do. What's my total star count?
16:51
There's a meaningful disconnect between the things I'm proud of and their star count, so it's easy to not worry to much about it.
Looks like your star count is 118.
That's not bad. I'm not too far off the top list.
I wonder if there's a correlation between "thinking stars don't matter much" and "having a lot of stars". It's like how only upper-middle class types will tell you that money doesn't bring you happiness.
"Money doesn't buy you happiness"

-- Posted from my 6SPlus.
5
-- Posted by my professional personal assistant Suzie, who I call "Siri" just because it annoys her.
17:03
Rhubarb
@Kevin -- Posted from My Professional Network on LinkedIn I’d Like to Add You to.
DSM
DSM
17:20
(whew) Real work is hard! Midday cabbage for all.
@davidism hey, it was 2012. The rules where different then.
@davidism: and reading between the lines it asks how do I do l10n in Flask or Pyramid?
Yeah, I know. But no excuses! ;-)
DSM
DSM
Three answers, not one of which opens a file correctly in either version of Python. :-/
@Kevin: I was looking at that too. I wonder if the problem is in the argument he's eval-ling.
(Hmm. eval-ling or eval-ing?)
17:37
I sort of suspect he's doing dict_build("False") for some unjustifiable reason
user559633
We also clear out stars based on some threshold, so I believe the above calculation also means "stars of count > 3"
"That's just how bools work in Python, right? I thought it was kind of strange, but..." he thinks
DSM
DSM
If that's what he's doing, then either he's wrong about where the slowdown is or he's only showing us the fast part of the code..
I was even extra charitable and actually called dict_build when I ran his code.
DSM
DSM
If it turns out he's doing dict_build("time.sleep(240) or True") I'm taking the day off.
17:39
dict_build(input("do you want to include Y as a char?")). The long runtime is because the user is very indecisive.
Update. Looks like he needs to spend some more time investigating.
DSM
DSM
17:53
I lost three hours yesterday tracking down a bug due to the fact I'd shadowed a variable in my c++ code, and had turned off -Wshadow because it was throwing too much noise compiling a colleague's code I never made time to clean up. :-|
I suspect the bug I'm working on now is because I have one too many sections commented as "terrible hack but I don't have time to do it the right way".
So I know that feeling.
hey guys, how should one inject script like disablecss to PhantomJS browser?
@JustasSame This is the Python room, you meant to ask that in the JavaScript room.
DSM
DSM
@JustasSame: my mention of my problems with my c++ code may have given the wrong impression -- it was a random complaint by way of conversation, not a sign that real questions on non-Python coding questions are on topic here. :-) There's an entire chat room for JS types, though!
@davidis I've meant how to do this in python
I use PhantomJS in python for webscraping
DSM
DSM
17:59
@Kevin: ./processes/meta_worldbuilding.cc: ncout << "hack hack hack " << std::endl;
Speaking of hackery and world building, I've been reading Unsong, a work-in-progress about an alternate history where most of the old testament is literally and provably true, ex. the stars are just holes in a fixed firmament.
The archangel Uriel is essentially an overworked sysadmin who doesn't entirely have all his shit together. It's pretty funny.
One of my favorite editor features is highlighting comments saying "TODO", "FIXME", or "XXX" in big garish yellow-on-black blocks so I can intuit how terrible code I've been writing is.
> Uriel stood very quietly for a moment. The streams of letters ceased flowing.
> Then, all of a sudden, he said a very un-angelic word.
> “I THINK I FORGOT TO GIVE MANKIND THE BOOK OF JEZUBOAD.”
> “Was it important?”
> The archangel started fidgeting awkwardly. “UM.” Some more fidgets. “NO?”
DSM
DSM
Have I recommended Celestial Matters before? Hard SF, but the science is Aristotelian physics, the astronomy is Ptolemaic, etc. Can the Delian League defeat the Middle Kingdom? Read to find out!
I'm really confused about what Hard SF means now.
18:09
Maybe "adhering strictly to internal consistency". SF can be hard SF even if the laws they follow aren't real laws, but they can't discard them halfway through.
DSM
DSM
Yeah, I'd say that broadly speaking, the "hardness" of SF relates to the degree to which the implications of the sciences are worked out.
typically "hard" SF is fiction which tries really hard to adhere to current known-correct or known-theortically-likely-correct science.
as of the time it was written.
of course, these days you can just say "quantum fields" and "string theory" and "multiverse" and pretty much get away with anything.
DSM
DSM
Sure, which is why Niven (or Pournelle, can't remember) made a case that Dante's Inferno was the first great hard science fiction novel, if memory serves. But it seems a little strange to tie a novel's accomplishment to the date it was written, if you know what I mean.
We've had this kind of argument on SFF.SE before; personally I'm a firm believer in judging a work by the intent of the author.
DSM
DSM
Which you can never verify, and often don't have access to. Makes judgment tough, I'd say. :-)
18:16
when Clarke wrote a story about moondust, he believe he was using legitimate science, or at least, his story matches what was accepted science at the time.
I liked how HPMOR essentially dragged Harry Potter kicking and screaming into the "hard" category. They spend half a chapter discussing how they could arbitrate between wizard and muggle currencies to make infinite money until the exchange rate equalizes.
so I think it's fair to say he intended that to be "hard science"
well, Harry Potter isn't science fiction, it's fantasy, so the designation is kinda moot :)
Unsong is kind of like that, too. Their magic spells have a DRM system and the main character writes academic papers looking for weaknesses in the algorithm.
there are a lot of fantasy authors who adhere to very rigid magical continuity.
Sanderson's magic systems include periodic tables and stuff
but I wouldn't call them "hard SF"
All fantasy novels are really just science fiction novels taking place after grey goo disassembles the Universe and rebuilds it with slightly different rules ;-) ... Which is actually very nearly the premise of Ra, come to think of it.
DSM
DSM
18:19
Yeah, even in fantasy there's a spectrum between books which hew pretty closely to the laws (say the magic system in Mistborn) and ones in which it's very handwavy. This is close enough to the split in SF that it makes sense to me to see them both as instances of the same hard/soft split instead of "well, sure, it's just like the division in SF, but it's different, because magic isn't real" or something.
NAHHHHHH. SF means more "Science setting".
Like I said in yesterday's discussion about the Jungle Book. suspension of disbelief is highly compartmentalized, so you can accept "magic exists" but not "all spells require dog-latin incantations for some reason"
The big canonical SF stories are so often speculative and about exploring the setting or making a statement about society through allegory.
Big fantasy stories are so much more just like adventure stories with a fantastic setting.
The genres have very different narrative centers of gravity.
18:25
class Calculator(Frame): #snippet 1

    def __init__(self, arg):
        super(Calculator, self).__init__()
class Calculator(Frame): #snip 2
    def __init__(self):
        Frame.__init__(self)
are snip 1 & 2 the same?
no, one clearly says "#snippet 1" and the other "#snip 2"
Related:
1131
Q: Understanding Python super() with __init__() methods

MizipzorI'm trying to understand super(). From the looks of it, both child classes can be created just fine. I'm curious as to what difference there actually is between the following child classes: class Base(object): def __init__(self): print "Base created" class ChildA(Base): def __in...

I think those two particular snippets have identical behavior, but that might not be true in general.
Ex. in case of classes inheriting from more than one parent.
I don't actually know... is super(Calculator) same as super() there?
So it does the same inheritance ball-and-cup you can do with super()?
I don't know. super confuses me so I try not to think about it.
18:34
I'm still skeptical of it as a good language feature.
bob
bob
Hi anyone good with scapy? I have a networking question
I would like to know if there was a way to drop a packet
Prob using scapy
It kind of reminds me of C++. They added a lot of features involving move operations which meaningfully benefits 5% of programmers, and deeply confuses the rest.
bob
bob
Thing is, I believe you can't delete/drop a packet with the sniff() function!
18:49
just thought I'd share here...for Mac users using Better Touch Tools looking for an alternative since it is a paid app now, check out spectacle. Works great. It is also open source
00:00 - 19:0019:00 - 00:00

« first day (1942 days earlier)      last day (3231 days later) »