workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
As I said, I'm a beginner :slightly_smiling_face:
2017-12-12T05:41:32.000037
Hipolito
pythondev_help_Hipolito_2017-12-12T05:41:32.000037
1,513,057,292.000037
103,403
pythondev
help
I would start with something like ``` for x in range(n/2): for y in range(n/2, n): if .... ```
2017-12-12T05:52:45.000245
Ciera
pythondev_help_Ciera_2017-12-12T05:52:45.000245
1,513,057,965.000245
103,404
pythondev
help
but `n/2` not always is int
2017-12-12T05:57:40.000294
Hipolito
pythondev_help_Hipolito_2017-12-12T05:57:40.000294
1,513,058,260.000294
103,405
pythondev
help
oh yeah my bad. you should cast it to an int. `int(n/2)`
2017-12-12T05:58:26.000100
Ciera
pythondev_help_Ciera_2017-12-12T05:58:26.000100
1,513,058,306.0001
103,406
pythondev
help
but still it does not give the intended effect because now `a` is max 12 and as you can see an example, `a` is equal to 15 and in the next tuple 21
2017-12-12T06:01:44.000018
Hipolito
pythondev_help_Hipolito_2017-12-12T06:01:44.000018
1,513,058,504.000018
103,407
pythondev
help
a is x
2017-12-12T06:02:01.000046
Hipolito
pythondev_help_Hipolito_2017-12-12T06:02:01.000046
1,513,058,521.000046
103,408
pythondev
help
and should check all possible pairs of numbers
2017-12-12T06:03:28.000340
Hipolito
pythondev_help_Hipolito_2017-12-12T06:03:28.000340
1,513,058,608.00034
103,409
pythondev
help
ah yeah my bad. I wasn't sure a `/2` would work.
2017-12-12T06:03:30.000400
Ciera
pythondev_help_Ciera_2017-12-12T06:03:30.000400
1,513,058,610.0004
103,410
pythondev
help
anyways you can do two loops in `range(n + 1)`. (forgot the +1 also :p)
2017-12-12T06:03:57.000078
Ciera
pythondev_help_Ciera_2017-12-12T06:03:57.000078
1,513,058,637.000078
103,411
pythondev
help
that's quite fast
2017-12-12T06:04:01.000168
Ciera
pythondev_help_Ciera_2017-12-12T06:04:01.000168
1,513,058,641.000168
103,412
pythondev
help
it's the `map/filter` that are longer I suppose
2017-12-12T06:05:07.000246
Ciera
pythondev_help_Ciera_2017-12-12T06:05:07.000246
1,513,058,707.000246
103,413
pythondev
help
I'm going to go eat something. I can make a better snippet afterwards if needed :slightly_smiling_face:
2017-12-12T06:05:37.000412
Ciera
pythondev_help_Ciera_2017-12-12T06:05:37.000412
1,513,058,737.000412
103,414
pythondev
help
unfortunately, I have tried this too and it is even slower
2017-12-12T06:09:03.000420
Hipolito
pythondev_help_Hipolito_2017-12-12T06:09:03.000420
1,513,058,943.00042
103,415
pythondev
help
```def removNb(n): numbers = list(range(1, n + 1)) total = sum(numbers) result = [] for first in numbers: for second in numbers: if first == second: continue if first * second == total - (first + second): result.append((first, second)) ...
2017-12-12T06:09:35.000403
Hipolito
pythondev_help_Hipolito_2017-12-12T06:09:35.000403
1,513,058,975.000403
103,416
pythondev
help
this work nice if we have numbers below 100
2017-12-12T06:10:15.000286
Hipolito
pythondev_help_Hipolito_2017-12-12T06:10:15.000286
1,513,059,015.000286
103,417
pythondev
help
and after I try this way:
2017-12-12T06:10:49.000250
Hipolito
pythondev_help_Hipolito_2017-12-12T06:10:49.000250
1,513,059,049.00025
103,418
pythondev
help
```def removNb(n): numbers = list(range(1, n + 1)) pairs = list(itertools.combinations(numbers, 2)) total = sum(numbers) result = [] for first, second in pairs: if first * second == total - (first + second): result.append((first, second)) result.append((second, first)...
2017-12-12T06:10:53.000460
Hipolito
pythondev_help_Hipolito_2017-12-12T06:10:53.000460
1,513,059,053.00046
103,419
pythondev
help
still to slow
2017-12-12T06:11:09.000006
Hipolito
pythondev_help_Hipolito_2017-12-12T06:11:09.000006
1,513,059,069.000006
103,420
pythondev
help
Bon Appetit, and I would be very grateful for your help.
2017-12-12T06:13:02.000541
Hipolito
pythondev_help_Hipolito_2017-12-12T06:13:02.000541
1,513,059,182.000541
103,421
pythondev
help
I'm back to work now if you find something please send to me directly, thx :slightly_smiling_face:
2017-12-12T06:16:52.000410
Hipolito
pythondev_help_Hipolito_2017-12-12T06:16:52.000410
1,513,059,412.00041
103,422
pythondev
help
I'm not sure what are the limits of `n` are but I think once you reach higher number you need to be clever about it and skip ranges of number.
2017-12-12T06:22:20.000297
Ciera
pythondev_help_Ciera_2017-12-12T06:22:20.000297
1,513,059,740.000297
103,423
pythondev
help
Problem has piqued my curiosity! Yeah, that's what I'm thinking, <@Ciera>. Have to think about the mathematics of the problem and find a shortcut so you don't need to compute so much
2017-12-12T06:23:12.000165
Fabiola
pythondev_help_Fabiola_2017-12-12T06:23:12.000165
1,513,059,792.000165
103,424
pythondev
help
For instance, you don't need to check pairs where both numbers are greater than `sqrt(sum(range(n)))`
2017-12-12T06:26:25.000492
Fabiola
pythondev_help_Fabiola_2017-12-12T06:26:25.000492
1,513,059,985.000492
103,425
pythondev
help
which for large `n` should cut out a lot of pairs
2017-12-12T06:27:13.000023
Fabiola
pythondev_help_Fabiola_2017-12-12T06:27:13.000023
1,513,060,033.000023
103,426
pythondev
help
I win a big chunk of time by removing the `list` from `list(itertools.combinations(numbers, 2))` as it's not usefull
2017-12-12T06:29:46.000248
Ciera
pythondev_help_Ciera_2017-12-12T06:29:46.000248
1,513,060,186.000248
103,427
pythondev
help
What's the complexity of the naive approach? `sum(range(n))` is `n(n-1)/2`, and then by comparing all pairs, you check `n(n-1)/2 * n(n-1)/2` pairs
2017-12-12T06:30:31.000270
Fabiola
pythondev_help_Fabiola_2017-12-12T06:30:31.000270
1,513,060,231.00027
103,428
pythondev
help
So the complexity is essentially `O(n**4)`?
2017-12-12T06:30:48.000180
Fabiola
pythondev_help_Fabiola_2017-12-12T06:30:48.000180
1,513,060,248.00018
103,429
pythondev
help
`n**2*(n-1)**2/4` pairs to check
2017-12-12T06:31:37.000144
Fabiola
pythondev_help_Fabiola_2017-12-12T06:31:37.000144
1,513,060,297.000144
103,430
pythondev
help
let's say that `n` will not exceed 1k
2017-12-12T06:34:50.000098
Hipolito
pythondev_help_Hipolito_2017-12-12T06:34:50.000098
1,513,060,490.000098
103,431
pythondev
help
By checking for `(first &lt; sqrt(sum(range(n)))) and (second &lt; sqrt(sum(range(n))))`, you can reduce that to...
2017-12-12T06:38:55.000096
Fabiola
pythondev_help_Fabiola_2017-12-12T06:38:55.000096
1,513,060,735.000096
103,432
pythondev
help
but anyway, from what I was leaving it, I do not know if it comes `n` to until 1k. I suspect that the max is much lower.
2017-12-12T06:39:01.000244
Hipolito
pythondev_help_Hipolito_2017-12-12T06:39:01.000244
1,513,060,741.000244
103,433
pythondev
help
If I'm not wrong, even if n=1000 that still requires checking 249500250000 pairs of numbers
2017-12-12T06:41:55.000044
Fabiola
pythondev_help_Fabiola_2017-12-12T06:41:55.000044
1,513,060,915.000044
103,434
pythondev
help
Well, that's a lot. But as I said, I do not think it ever came to n = 1000. I think it's going to be hard to make it halfway. (n=500)
2017-12-12T06:43:57.000157
Hipolito
pythondev_help_Hipolito_2017-12-12T06:43:57.000157
1,513,061,037.000157
103,435
pythondev
help
for research purposes, let's set it for not more than 300.
2017-12-12T06:44:32.000223
Hipolito
pythondev_help_Hipolito_2017-12-12T06:44:32.000223
1,513,061,072.000223
103,436
pythondev
help
not only do you worry about the speed of action. If, for example, I have to check with 50 x `n` where `n` &lt; 100
2017-12-12T06:46:20.000164
Hipolito
pythondev_help_Hipolito_2017-12-12T06:46:20.000164
1,513,061,180.000164
103,437
pythondev
help
for this, this function should be as fast as possible
2017-12-12T06:46:56.000280
Hipolito
pythondev_help_Hipolito_2017-12-12T06:46:56.000280
1,513,061,216.00028
103,438
pythondev
help
It also depends what is as fast as possible. Maybe there are solutions in C library
2017-12-12T06:48:54.000027
Ciera
pythondev_help_Ciera_2017-12-12T06:48:54.000027
1,513,061,334.000027
103,439
pythondev
help
I do not say that it must be done in this way, it is completely different solution that will give the desired result
2017-12-12T06:52:57.000309
Hipolito
pythondev_help_Hipolito_2017-12-12T06:52:57.000309
1,513,061,577.000309
103,440
pythondev
help
oki, then how this need looks?
2017-12-12T07:01:18.000185
Hipolito
pythondev_help_Hipolito_2017-12-12T07:01:18.000185
1,513,062,078.000185
103,441
pythondev
help
I'm just learning this fascinating language and I can not get everything in flight yet.
2017-12-12T07:06:12.000144
Hipolito
pythondev_help_Hipolito_2017-12-12T07:06:12.000144
1,513,062,372.000144
103,442
pythondev
help
Any hint how it should look like? :slightly_smiling_face:
2017-12-12T07:06:37.000216
Hipolito
pythondev_help_Hipolito_2017-12-12T07:06:37.000216
1,513,062,397.000216
103,443
pythondev
help
Your code earlier looked really nice. On the whole, list comprehensions are much faster than `for` loops, so I think your first answer looked pretty good. Like <@Ciera> suggested, you can remove the `list`structure
2017-12-12T07:08:39.000343
Fabiola
pythondev_help_Fabiola_2017-12-12T07:08:39.000343
1,513,062,519.000343
103,444
pythondev
help
oki, <@Ciera>, <@Fabiola> thanks for your help :slightly_smiling_face:
2017-12-12T07:10:25.000411
Hipolito
pythondev_help_Hipolito_2017-12-12T07:10:25.000411
1,513,062,625.000411
103,445
pythondev
help
:+1:
2017-12-12T07:14:26.000297
Hipolito
pythondev_help_Hipolito_2017-12-12T07:14:26.000297
1,513,062,866.000297
103,446
pythondev
help
You can use the `itertools.product` to find combinations of the `range(n*(n-1)/2)` and `range(np.sqrt(n*(n-1)/2)`
2017-12-12T07:16:10.000201
Fabiola
pythondev_help_Fabiola_2017-12-12T07:16:10.000201
1,513,062,970.000201
103,447
pythondev
help
And because the product is symmetric, at the end you can reverse all the pairs you have found and add them to the solution set
2017-12-12T07:16:56.000210
Fabiola
pythondev_help_Fabiola_2017-12-12T07:16:56.000210
1,513,063,016.00021
103,448
pythondev
help
ie. if `(a, b)` is a solution, then so is `(b, a)`.
2017-12-12T07:17:22.000208
Fabiola
pythondev_help_Fabiola_2017-12-12T07:17:22.000208
1,513,063,042.000208
103,449
pythondev
help
nice
2017-12-12T07:18:06.000517
Hipolito
pythondev_help_Hipolito_2017-12-12T07:18:06.000517
1,513,063,086.000517
103,450
pythondev
help
Check it out as soon as I find a moment because now I am at work :slightly_smiling_face: and will certainly write back what I sent. Once again, thanks a lot for your help
2017-12-12T07:19:48.000461
Hipolito
pythondev_help_Hipolito_2017-12-12T07:19:48.000461
1,513,063,188.000461
103,451
pythondev
help
Yeah, me too, it's an interesting problem! I'll try an run some of my own benchmarks to see if my calculations reflect reality ^^
2017-12-12T07:20:34.000324
Fabiola
pythondev_help_Fabiola_2017-12-12T07:20:34.000324
1,513,063,234.000324
103,452
pythondev
help
And <@Hipolito> you can give tacos to people if you found them helpful :taco:
2017-12-12T07:21:42.000328
Fabiola
pythondev_help_Fabiola_2017-12-12T07:21:42.000328
1,513,063,302.000328
103,453
pythondev
help
haw do this? :slightly_smiling_face:
2017-12-12T07:22:06.000467
Hipolito
pythondev_help_Hipolito_2017-12-12T07:22:06.000467
1,513,063,326.000467
103,454
pythondev
help
type `@user :taco:` :slightly_smiling_face:
2017-12-12T07:22:49.000120
Fabiola
pythondev_help_Fabiola_2017-12-12T07:22:49.000120
1,513,063,369.00012
103,455
pythondev
help
thx
2017-12-12T07:22:56.000093
Hipolito
pythondev_help_Hipolito_2017-12-12T07:22:56.000093
1,513,063,376.000093
103,456
pythondev
help
:+1: Speak later :slightly_smiling_face:
2017-12-12T07:23:07.000079
Fabiola
pythondev_help_Fabiola_2017-12-12T07:23:07.000079
1,513,063,387.000079
103,457
pythondev
help
<@Fabiola> :taco:
2017-12-12T07:23:10.000068
Hipolito
pythondev_help_Hipolito_2017-12-12T07:23:10.000068
1,513,063,390.000068
103,458
pythondev
help
<@Ciera> :taco:
2017-12-12T07:23:20.000102
Hipolito
pythondev_help_Hipolito_2017-12-12T07:23:20.000102
1,513,063,400.000102
103,459
pythondev
help
Hi all, Has anybody successfully bundled OpenCV and PyQt using PyInstaller on OSX? I’m having a nightmare getting it to work. 

Everything works perfectly before bundling with PyInstaller, however when I run the app created by PyInstaller I get the following error:
2017-12-12T08:49:51.000213
Nickolas
pythondev_help_Nickolas_2017-12-12T08:49:51.000213
1,513,068,591.000213
103,460
pythondev
help
If I comment out the ‘import cv2’ the app works (but without the opencv functionality obviously)
2017-12-12T08:50:22.000065
Nickolas
pythondev_help_Nickolas_2017-12-12T08:50:22.000065
1,513,068,622.000065
103,461
pythondev
help
IIRC, opencv dependencies are a pita to make portable
2017-12-12T08:50:41.000668
Meg
pythondev_help_Meg_2017-12-12T08:50:41.000668
1,513,068,641.000668
103,462
pythondev
help
Is there a better alternative?
2017-12-12T08:51:06.000153
Nickolas
pythondev_help_Nickolas_2017-12-12T08:51:06.000153
1,513,068,666.000153
103,463
pythondev
help
I just installed the deps using a linux vm
2017-12-12T08:51:25.000535
Meg
pythondev_help_Meg_2017-12-12T08:51:25.000535
1,513,068,685.000535
103,464
pythondev
help
and added the python binaries via a virtualenv
2017-12-12T08:51:41.000099
Meg
pythondev_help_Meg_2017-12-12T08:51:41.000099
1,513,068,701.000099
103,465
pythondev
help
I am attempting to create a short video file from individual image frames
2017-12-12T08:51:48.000212
Nickolas
pythondev_help_Nickolas_2017-12-12T08:51:48.000212
1,513,068,708.000212
103,466
pythondev
help
Installing deps on a linux vm won’t help me build an OSX app though will it?
2017-12-12T08:54:05.000175
Nickolas
pythondev_help_Nickolas_2017-12-12T08:54:05.000175
1,513,068,845.000175
103,467
pythondev
help
nope
2017-12-12T08:54:33.000392
Meg
pythondev_help_Meg_2017-12-12T08:54:33.000392
1,513,068,873.000392
103,468
pythondev
help
so, with this, seems like its worth escalating to the pyinstaller repostitory issue page or going to the opencv mailing list
2017-12-12T08:55:28.000126
Meg
pythondev_help_Meg_2017-12-12T08:55:28.000126
1,513,068,928.000126
103,469
pythondev
help
Ok will do. Thanks for the indo!
2017-12-12T08:56:01.000036
Nickolas
pythondev_help_Nickolas_2017-12-12T08:56:01.000036
1,513,068,961.000036
103,470
pythondev
help
*Info
2017-12-12T08:56:07.000056
Nickolas
pythondev_help_Nickolas_2017-12-12T08:56:07.000056
1,513,068,967.000056
103,471
pythondev
help
good luck :slightly_smiling_face:
2017-12-12T08:56:36.000552
Meg
pythondev_help_Meg_2017-12-12T08:56:36.000552
1,513,068,996.000552
103,472
pythondev
help
that said, there are a number of projects where packaging is a pain, I feel
2017-12-12T08:56:58.000283
Meg
pythondev_help_Meg_2017-12-12T08:56:58.000283
1,513,069,018.000283
103,473
pythondev
help
opencv is one
2017-12-12T08:57:01.000212
Meg
pythondev_help_Meg_2017-12-12T08:57:01.000212
1,513,069,021.000212
103,474
pythondev
help
gis is another (geodjango, etc)
2017-12-12T08:57:10.000331
Meg
pythondev_help_Meg_2017-12-12T08:57:10.000331
1,513,069,030.000331
103,475
pythondev
help
and depending on the machine/OS, numpy/scipy, pandas…
2017-12-12T08:57:30.000165
Meg
pythondev_help_Meg_2017-12-12T08:57:30.000165
1,513,069,050.000165
103,476
pythondev
help
Probably best asking in the <#C0LMFRMB5|django> channel
2017-12-12T09:17:22.000131
Corrinne
pythondev_help_Corrinne_2017-12-12T09:17:22.000131
1,513,070,242.000131
103,477
pythondev
help
oh yeah, my bad haha
2017-12-12T09:17:41.000197
Robbin
pythondev_help_Robbin_2017-12-12T09:17:41.000197
1,513,070,261.000197
103,478
pythondev
help
:grinning:
2017-12-12T09:17:51.000656
Corrinne
pythondev_help_Corrinne_2017-12-12T09:17:51.000656
1,513,070,271.000656
103,479
pythondev
help
Update to my logging question, I got logging to work. ```logger = logging.getLogger(__name__) new_event_logger = logging.getLogger(f'{__name__}.new_member') all_event_logger = logging.getLoggeR(f'{__name__}.all_events')``` config file: <https://github.com/OperationCode/operation_code_pybot/blob/master/utils/log_config...
2017-12-12T10:36:39.000165
Glinda
pythondev_help_Glinda_2017-12-12T10:36:39.000165
1,513,074,999.000165
103,480
pythondev
help
But right now both sub loggers are duplicating the file.
2017-12-12T10:37:15.000539
Glinda
pythondev_help_Glinda_2017-12-12T10:37:15.000539
1,513,075,035.000539
103,481
pythondev
help
FYI you can also use yaml for the config file (can be more readdable :slightly_smiling_face: )
2017-12-12T10:37:33.000615
Ciera
pythondev_help_Ciera_2017-12-12T10:37:33.000615
1,513,075,053.000615
103,482
pythondev
help
I saw that
2017-12-12T10:37:42.000663
Glinda
pythondev_help_Glinda_2017-12-12T10:37:42.000663
1,513,075,062.000663
103,483
pythondev
help
I'm kind of regretting the json
2017-12-12T10:37:48.000343
Glinda
pythondev_help_Glinda_2017-12-12T10:37:48.000343
1,513,075,068.000343
103,484
pythondev
help
there is a key to deactivate that
2017-12-12T10:37:56.000237
Ciera
pythondev_help_Ciera_2017-12-12T10:37:56.000237
1,513,075,076.000237
103,485
pythondev
help
So both `new_event_logger` and `all_event_logger` have the same data.
2017-12-12T10:38:24.000048
Glinda
pythondev_help_Glinda_2017-12-12T10:38:24.000048
1,513,075,104.000048
103,486
pythondev
help
see <https://github.com/pyslackers/sirbot-pythondev/blob/master/config/prod.config.yml#L96>
2017-12-12T10:38:24.000232
Ciera
pythondev_help_Ciera_2017-12-12T10:38:24.000232
1,513,075,104.000232
103,487
pythondev
help
ah no you already have it
2017-12-12T10:38:38.000072
Ciera
pythondev_help_Ciera_2017-12-12T10:38:38.000072
1,513,075,118.000072
103,488
pythondev
help
` "disable_existing_loggers": false,`
2017-12-12T10:38:46.000302
Glinda
pythondev_help_Glinda_2017-12-12T10:38:46.000302
1,513,075,126.000302
103,489
pythondev
help
Maybe something to do with root?
2017-12-12T10:38:55.000547
Glinda
pythondev_help_Glinda_2017-12-12T10:38:55.000547
1,513,075,135.000547
103,490
pythondev
help
the root logger use both handlers
2017-12-12T10:39:51.000325
Ciera
pythondev_help_Ciera_2017-12-12T10:39:51.000325
1,513,075,191.000325
103,491
pythondev
help
how do you log a message ? `<http://all_event_logger.info|all_event_logger.info>('my log')` ?
2017-12-12T10:40:27.000518
Ciera
pythondev_help_Ciera_2017-12-12T10:40:27.000518
1,513,075,227.000518
103,492
pythondev
help
Yes
2017-12-12T10:40:32.000156
Glinda
pythondev_help_Glinda_2017-12-12T10:40:32.000156
1,513,075,232.000156
103,493
pythondev
help
I'm not a pro on logging but your config seems fine to me :confused:
2017-12-12T10:41:25.000215
Ciera
pythondev_help_Ciera_2017-12-12T10:41:25.000215
1,513,075,285.000215
103,494
pythondev
help
maybe something to do with my setup function?
2017-12-12T10:42:04.000258
Glinda
pythondev_help_Glinda_2017-12-12T10:42:04.000258
1,513,075,324.000258
103,495
pythondev
help
<https://github.com/OperationCode/operation_code_pybot/blob/master/utils/log_manager.py>
2017-12-12T10:42:05.000007
Glinda
pythondev_help_Glinda_2017-12-12T10:42:05.000007
1,513,075,325.000007
103,496
pythondev
help
Not sure if I need to have ```logger = logging.getLogger(__name__) new_event_logger = logging.getLogger(f'{__name__}.new_member')``` within that file
2017-12-12T10:42:36.000724
Glinda
pythondev_help_Glinda_2017-12-12T10:42:36.000724
1,513,075,356.000724
103,497
pythondev
help
you shouldn't use `__name__` there.
2017-12-12T10:43:24.000621
Ciera
pythondev_help_Ciera_2017-12-12T10:43:24.000621
1,513,075,404.000621
103,498
pythondev
help
name is the python path of the file `mymodule.submodule.filename`
2017-12-12T10:43:50.000639
Ciera
pythondev_help_Ciera_2017-12-12T10:43:50.000639
1,513,075,430.000639
103,499
pythondev
help
so you don't get the correct logger
2017-12-12T10:44:05.000535
Ciera
pythondev_help_Ciera_2017-12-12T10:44:05.000535
1,513,075,445.000535
103,500
pythondev
help
Cause I'm using `logging.handlers.RotatingFileHandler`
2017-12-12T10:44:27.000578
Glinda
pythondev_help_Glinda_2017-12-12T10:44:27.000578
1,513,075,467.000578
103,501
pythondev
help
you should do `logging.getLogger('my_module.new_member')`
2017-12-12T10:44:36.000620
Ciera
pythondev_help_Ciera_2017-12-12T10:44:36.000620
1,513,075,476.00062
103,502