« first day (2931 days earlier)      last day (2239 days later) » 
00:00 - 19:0019:00 - 22:00

wim
wim
00:00
@AndrasDeak tempted to DV your mock answer which overcomplicates things and doesn't actually explain how unittest.mock works
It's actually more like this:
class M:
    def __call__(self):
        return M()
    def __getattr__(self, name):
        return M()
I intended to make that clear in my answer. I hadn't intended to answer but everyone seemed to ignore the actual question. You're welcome to downcote and/or give a better answer as you see fit
@wim and calling a mock is a no-op or another M()?
wim
wim
another mock
calling is a factory too.
I see. Hardly surprising
wim
wim
I won't DV your answer, because you got the most important part right (custom __getattr__), but I added another answer.
OK. I'll check it out tomorrow, bedtime now
wim
wim
00:05
couldn't really fix yours without complete rewrite :-\
It's fine. OP will probably unaccept then I can delete mine
Remind me if I forget, busy week
Or at least I'll try to convince OP to switch the accept. Might keep my own as it's not wrong, just superfluous
rbrb all, good talks.
00:59
output = []
for t in df.text:
    output.append(spacey_cleaner(t))

df['clean_text'] = output
Ok i think i got it this time
@ex080 yes
thanks
 
6 hours later…
07:12
three-vote resolution
07:46
cbg
08:42
cbg
08:53
cbg
09:04
Is anyone here familiar with the Chromecast API to invoke CEC to turn my TV on via a http POST webhook or any other means?
09:28
cbg
fun tidbit to share today! will be gone til Tuesday, Road trip with buddy across the united states today :)
Have fun!
09:44
Oh boy, I'm not used to seeing these smaller SE sites on the HNQ list...
HNQ: "Should I use salted or unsalted..."
Me: There's like a 99% chance you should use a salt!
HNQ: "...butter if the recipe doesn't specify?"
Me: Never mind.
@PM2Ring ty ty
@vash_the_stampede Sounds awesome... I've always quite fancied doing route 66 in an old Cadillac or similar...
10:07
I try to run a python script with canopy cmd but I only manage to open the script. It does not run or seems to run. This is a stupid question, but should the script not simply run in the canopy cmd with 'start testsys.py' instead of just opening the script itself with canopy (as it seems to be doing)
@jpp looks like they've made a decent edit :)
@JonClements Did you see Billy Connolly's 4 part series, Route 66?
jpp
jpp
@JonClements, Yep much better. Just soul-destroying when you get 5 answers to a contradictory question.
10:22
@PM2Ring I have not... but if it's Billy at his best - I imagine I'd quite enjoy it
@JonClements It's great. I saw it on telly a few years ago.
/me makes a note
Of course, there's only so much you can cover in 4 episodes. But it's nice to see "snapshots" of the old Route 66 through Billy's eyes.
I know I've seen Stephen Fry do a black cab around the US... that was quite interesting as well...
@jpp I was toying with df.iloc[:df.B.reset_index().where(df.B > 0.5).first_valid_index() + 1] . I like that next one though ;)
jpp
jpp
@JonClements, Hmm, yeh your idea sounds interesting but I don't particularly like reset_index. next is underused for performance issues IMO.
10:36
yeah... for the OPs example - it's not needed.... but was considering where it's not a RangeIndex or similar
jpp
jpp
It would be so cool if NumPy had an in-built function which gives the nth index satisfying a condition
especially if that function called something C level numba-like
Otherwise you end up doing an operation on the entire array when you only need the first or second number.
It's something you'd have thought would have come up now and then... yeah :)
11:21
I should know this, but what's the time complexity of pairing up every element in a list with every other element?
for i, x in enumerate(l):
    for y in l[i+1:]:
        print(x, y)
^ like that
Is that quadratic...?
Looks n² to me (which is to say, yes, quadratic)
cbg
@Aran-Fey Yes. The number of pairs of n items is n(n-1)/2.
Oh, that makes sense. It's like a square cut in half. Thanks!
And if an item can be paired with itself it's n(n+1)/2
Proving that formula for triangular numbers is a classic introductory example of mathematical induction.
11:39
I've always had trouble with proof by induction...
Allegedly, Gauss figured out that formula in primary school. en.m.wikipedia.org/wiki/Carl_Friedrich_Gauss#Anecdotes It's easy enough for a kid to understand it if it's explained clearly, but it's pretty impressive for a young kid to discover it by himself.
@PM2Ring ??? Why isn't pairing with self just n²/2?
@PM2Ring Once you spot the trick about pairing the numbers 1 with n, 2 with (n-1) etc. so they form a rectangle, it's trivial. Spotting the pairing is the only cleverness.
I showed this to a colleague by drawing squares as if stacking blocks in a triangle, then adding a mirror copy on top to form a rectangle and asked him to give me the area. After he came up with n(n+1), I told him we only wanted the lower right triangular half, so divide that by 2 and "wah-lah!" as my wife's 3rd grader's say.
>>> len(set(map(lambda p: tuple(sorted(p)), product(range(10), repeat=2))))
55
@PM2Ring nm
12:01
The number of ordered pairs is n², but we can't just halve that to get unordered pairs, since in the ordered pairs each number is only paired with itself once.
Hey everyone, if someone feels like toying with their debugger, I'd be really interested in a solution to this (question of mine): stackoverflow.com/q/52949526/7322095
@PM2Ring so n²/2 +n/2?
which is n(n+1)/2 nvm
(Thinking visually again) it's like the upper right half of a triangular matrix. If you include the diagonal then the set of index pairs is the same as the sum of 1..n
@DonQuiKong Yep, or n²/2 - n/2 if we don't pair a number with itself.
Also, if you square a triangular number, it gives you the cumulative sum of cubes. Eg, 1+8+27+64=(1+2+3+4)². Curiously, the formula for the cumulative sum of squares is a little more complicated.
@DonQuiKong Sorry, I don't use Spyder, and I rarely use a debugger, so I can't suggest anything.
12:17
@PM2Ring per one of the comments it seems to happen with other debuggers too. Anyways, its no problem if one knows about it, but it cost me quite a headache figuring out why the debugger was entering an else when it shouldn't. after checking every line of code leading there I finally noticed that behaviour
Now I'm curious as to why it does that
@PM2Ring ohh, 2*sum(1 to n-1) = n² -n
so n²+n*(n²-n) = n³
which if I think about it follows directly from the triangle formula
now I'm wondering how to prove fermats last theorem with that .. great .. :P
@DonQuiKong PyCharm does this too. I suspect it is an artifact of how for-else is implemented in bytecode, that there is a "jump to the line after the end of the else". But since this is inside a for loop, the next line is actually back up to the for statement. So instead we step to a "phantom" line after the else, but the debugger shows it on the last line inside the else. Add another line inside the outer for after the else, and set a break point there.
I also set a value inside the else clause in case the print was running but just not showing due to buffering (pycharm is bad about keeping output straight), and the value does not get set, so that reaffirms that the else is truly not being run
12:45
I wonder if this editor was using like... what Python 2.4? stackoverflow.com/revisions/3290355/3
@PaulMcG yes, I figured the else wasn't running after some time. But the break point is in the else statement, it shouldn't break there.
it would have to set the end of the else before the pass for some reason to jump there
also morning cabbage
Today I'm heading up to Boston, MA for a job interview tomorrow, woohoo!
Best of luck!
Hope you won't need it :p
Thanks! Presumably since they want me to come in for an on-site, that's a good sign :D
@DonQuiKong Well it shouldn't, but i think the place where it wants to break is a place where there is no statement, so it falls back to breaking on the last statement inside the else.
12:48
@PaulMcG that doesn't make sense to me .. why would it want to break outside the for anyways?
it shouldn't even want to break there because even the breaking is conditional on the else
@WayneWerner I wish you sucess or luck, whatever you need ;)
Ok, I've already speculated way more than I actually know, so I'll have to "break" off on this one
@PaulMcG haha, well I'll just leave the question open, maybe one day
13:12
Anyone here use Apollo with a python backend?
13:24
Now starting to add type annotations to a large body of legacy code. Anyone with experience doing this? How to get devs to put the right annotations on return types? It's easy when the return is something like return True, but not so much when the return is something like "return SomeOtherClass.some_other_method()"
\o cbg
13:44
In a perfect world you'd be able to rig up a static type analyzer that uses the return type annotation of some_other_method in order to figure out the return type of the function that has return some_other_method()
This is impossible in the general case because you never know when a function will do return eval(input()) but since this is pretty rare in production-quality code maybe you can get something that's right most of the time
cbg
Whenever theoretical computer science makes some statement about the impossibility of determining X in an arbitrary program, I think, "ok, but what percentage of actual practical programs can you determine X for?".
For instance, the Halting Problem is classically proven by feeding the source code of the halting-state-detector to itself. But real programs do not usually read their own source code. Maybe solving the Halting Problem is easy if you restrict yourself only to programs that aren't recursive in tricky ways.
I'm actually rather surprised that there isn't a formal category of "programs whose (halts / doesn't halt) state can be proven", which has members such as print("hello, world") and while True: print(1), etc
14:18
hey guys...i tried accessing the souce of this "https://www.metacritic.com/browse/games/score/metascore/all/all/filtered?sort=d‌​esc" using the request module which gave me 403.. understood they dont want us to access. But when i used urllib.request i was able to access the content no 403.. whats happening ?
14:29
90% of the time when a page is inaccessible to one request module but accessible to another, it's because the one that got rejected had a user agent string that made it obvious it was a robot
And the module that succeeded had a user agent string that looks like it belongs to a human
I googled for "metacritic api" and there was a question on SO that mentioned the old API going defunct, and one of the answers (maybe self-answer) said that they had to set a user agent.
which is to say, Kevin's probably right again
I feel like I haven't been here in forever
thanks for the replies guys.. one follow up question, is there a way where this scenario can be handled, not letting any bot in (since we now know that the user agent is the turnaround) ?
@piRSquared I'm pondering about df['whatever'] = pd.Series(the_choices).sample(len(df), replace=True, random_state=42).values on that one... but probably a bit too much overhead to avoid setting a global numpy seed state...
If you're asking "How can I circumvent the server's bot-detection code?", you can specify a human-looking user-agent when making your request. If you're asking "How do I write bot-detection code for my server that can detect bots even if they have a human-looking user-agent?", you can't. If a bot wants to pretend to be human, there's no sure-fire way to defeat it.
14:42
I believe it should be there from a philosophical stand point. From a gamesmanship standpoint... who knows.
In other words, I always prefer to provide more information for completeness and your suggestion does exactly that.
If you're thinking "I meant the first one, but can you provide specific instructions about how to set the user agent string for the request module?", I can't, because I don't remember off the top of my head how to do that. I suspect it's not too difficult. Probably a simple parameter in the constructor or the call that sends the request.
@Kevin no i meant the second one :).. was just reading this answer stackoverflow.com/questions/1717049/….. but thanks
can captchas do the job.. ?
Certainly a good captcha can filter out most bots, but there's no captcha that can detect all bots.
And also it's going to annoy your human users.
14:58
@Kevin ya. :) anyways thanks again for the info.
i'll read more about this
@corvid Yep, it's been a while. I guess you're more into Javascript now?
yeah mostly javascript unfortunately
I do React mostly
@Kevin I have always wondered how hard it shouldn't be to simulate a mouse clicking in that box...
I was just about to link that :-)
15:11
ObXkcd (NSFW) m.xkcd.com/810
nsfw but i want to click it on my work machine :\ cuz it's an xkcd
It's nsfw due to the F word in the final panel, so if you put your hand over that part of the screen, you can probably get away with it
oh thanks :D
you fudged it
15:21
It's funny. When I see/hear a blacked-out/bleeped-out word, I feel it has more emotional impact than if the word had simply been uncensored.
Maybe it's some kind of Pavlonian response... Of all the censored content I've encountered, I absorbed the majority of it as a child. As an adult, I have unfettered access to swears, and me and my peer group employ them like a swiss army knife in a variety of situations, with no offense meant or taken by any party.
So perhaps black bars and bleeps trigger a kind of a mini-regression back to when I lacked the emotional maturity necessary to handle that sort of thing
(inb4 "bold of you to assert that you possess emotional maturity in the present")
That reminds me of Mr Tulip, from the Discworld novel The Truth, who swears with "—ing".
I was just thinking about him :-)
Many wavelengths are aligning today
15:37
are there really workplaces that have a problem with people viewing an image containing the f-word but not with people doing non-work-related browsing in general?
I remember reading an SF story (by Asimov, I think) in which the main character's favorite curse word was "moddang", as in "that moddang captcha keeps blocking my moddang bot!"
Statistically, I bet there's at least one. "How much effort should we be putting in, in order to cater to this minority?" is a separate, more difficult question.
I used "NSFW" as a convenient way to say "this link may offend those of a sensitive disposition".
I use movie ratings, although it's an imprecise system because "contains exactly one F bomb" can garner a different rating depending on the mood of the ratings board that day.
i usually assume bare tits and similar things when something is labelled NSFW. too much reddit i guess ;)
15:45
I wouldn't even bother to link to something that has nudity, unless it's like, a classical painting.
One of our ROs likes us to maintain SO's general language standards in this room, so I felt obliged to add some form of warning with that xkcd link.
morning cabbage
I know, not the first time i clashed with that RO ;) And I agree with Kevin, that stuff doesn't belong here in most cases
@PM2Ring I think that's when I learned what a glottal stop was
I dislike works of fiction that make up their own swear words. It's part of the reason that I couldn't get through Farsape and Battlestar Galactica.
15:54
Storm Father! Blood and bloody ashes! I couldn't disagree more.
Oaths composed of actual real words, I find less objectionable.
"Great Caesar's Ghost!" is still dumb though
Not to mention it is misspelled (but I mention it nonetheless...)
:-P
Good old apophasis
wim
wim
NSFW for a curse word in text is absolutely ridiculous
what if someone's workplace setup has OCR+text-to-speech?
wim
wim
15:59
I doubt even DSM has such a sensitive disposition. His guideline was supposed to be about what you type into the chat here.
either way it's better to be safe than sorry
I don't think we're going to enforce any kind of rule like "provide content warnings for external sites that have strong language". Individual users are welcome to exercise more caution than officially mandated, of course.
I prefer to err on the side of caution. OTOH, I occasionally link to the xkcd forum, where even the mods swear, but I don't bother giving a NSFW warning for that.
wim
wim
first, they came for the f-word, and I did not speak out... :)
16:14
Anyone here ever do Google's foo bar challenge? I ask because I am about to submit my solution to the second challenge. I've passed all test cases but I'm sure they have a few obscure scenarios for the final solution validation phase after I submit. If anyone has any time to kill take a look at my solution and tell me what you think: dpaste.com/3GTJGTS
I prefer a = list(s) over a = [i for i in s]
I thought there is a performance penalty with list(s)
It does not matter here but I did consider that
I don't know, but if there is an O(N) penalty, it isn't going to be the bottleneck in your program since you have an O(N^2) loop afterwards
I've never received an invitation to that challenge :(
Same ;_;
16:20
I would think a list comp is slower
This is usually around the time when PM tells us the answer
@vaultah do extensive searches for lambda and list comp stuff. I am always signed into google chrome when I browse
List copying semantics aside, I have a feeling that you can do this in better than O(N^2) time, although I haven't pinned down the details
In [7]: a = tuple(np.arange(100000))

In [8]: %timeit list(a)
421 µs ± 3.32 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

In [9]: %timeit [i for i in a]
2.22 ms ± 51.3 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
In [10]: %timeit tuple(a)
90.4 ns ± 0.979 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
huh
maybe because it's a tuple to begin with
I wonder where I got that idea from
16:23
In [11]: b = np.arange(100000).tolist()

In [12]: %timeit list(b)
    ...: %timeit [i for i in b]
    ...: %timeit tuple(b)
    ...:
515 µs ± 4.45 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
2.16 ms ± 19.7 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
546 µs ± 6.22 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
@W.Dodge I used to search for duplicates for Stack Overflow questions a lot. I googled pretty much every common Python question on Stack Overflow
wrong geoIP :P
Could be
wim
wim
[*s] if you're golfing
@vaultah I've read that searching for code performance enhancing keywords gets the invite. It's a shame that I have received one and you have not, as I imagine you are light years ahead of me. AI at its finest.
16:27
@W.Dodge I had an invite but only solved the first problem. What did you google that brought up the invite?
@Kevin Sorry, I was busy checking the xkcd forum. :) But yeah, calling list() is bound to be faster than a list comp, since the former runs at C speed.
@AndrasDeak Probably. I expect it just returns the original tuple, since tuples are immutable. But I can't check since I'm on my phone.
@Code-Apprentice I read that if you google list comp and lambda stuff that will trigger the invite
> | If the argument is a tuple, the return value is the same object.
explicitly in the tuple docstring ^
Thanks.
16:44
@PM2Ring I hope you don't feel obligated to jump in to performance discussions just because of my expectation that you would. I was just making an observation based on past events :-)
@W.Dodge when I got an invite it was right after I googled exactly "python list comprehension"
I'm now 80% sure that you can do this problem in O(N) time
... Assuming I have understood the problem requirements correctly
@W.Dodge Come to think of it, why convert to list at all? str supports slicing and iteration and such, so there's not much harm in operating directly on s the whole time
@Kevin :) I often jump into those discussions because my own curiosity has led me to write lots of timeit tests, so when I'm on my desktop machine I have the evidence handy.
@Kevin yeah you are right
def answer(s):
    c = 0
    if len(s) == 1:
        return c
    else:
        for itr, b in enumerate(s):
            if b == ">":
                c += len([i for i in s[itr+1:] if i == "<"])
        return c*2
>>> test_cases = (">----<", "<<>><")
>>> for x in test_cases:
...     print(answer(x), fast_answer(x))
...
2 2
4 4
Now increasing confidence in the possibility of an O(N) solution to 95%
16:58
Is google foo bar only for fun or part of a gamified interview?
@AndrasDeak It is functionally an application process but for me it will be just for fun
If you beat all the challenges you often get an interview
That's why I'm witholding the actual implementation of fast_answer. Merely confirming that it's possible is all the hinting I'm willing to do :-)
@Kevin I had already decided not to submit your solution if given, it's just not right
Please wait until tomorrow to show me, the deadline for this phase ends tonight
I'd say you're morally in the clear if you can produce a clean-room recreation. If you come up with an O(N) approach that just happens to exactly match mine, but I never told you anything other than "this is possible", then it hardly counts as "my" solution
17:22
Mildly interesting: all* cubic bezier curves that start and end at the black points, and pass through the green point
(*well, not all, since there are an infinite number of them. More like, a representative sample that gives you an idea of the topology of the whole solution space)
that sample gives strong evidence that likely all of them do in fact pass through the green point. Of course, to establish it for certain will require a proof of some sort.
Is it weird that they cut off like a line sliced them on the left and right?
I would like to do this for quadratic bezier curves, too, but since there's an additional free variable, I would need three dimensions to represent the results in a comprehensible manner
@piRSquared no
if you pull the control points far away (is that the right term?) the curves start linearly
that internal angle seems to be approaching a right angle, too
17:25
and since the curves pass through the black and the green points you asymptotically get a line passing through those
@Code-Apprentice that's due to how the black and green points are oriented
@piRSquared or...were you joking about the edge of the image?
Joking about edge of image. But I learn a lot by not correcting people's misinterpreting my bad jokes.
I thought about zooming the image out to accommodate the larger curves, but then I'd lose the detail on the smaller ones
@piRSquared sorry, I've been talking to serious people all day
And anyway as the curves approach pure red or pure blue, their bounding box's width and height approach infinity. So zooming out to encompass all the curves would require infinite de-magnification.
Just adjust the anchor points to be proportional... (another bad joke)
17:33
I bet there's a way to map an infinite plane to a finite rectangle in a sensible way, but I don't know the exact math.
p.x, p.y -> 1/p.x, 1/p.y almost works, except for a discontinuity at (0,0)
@Kevin the corners might make it tricky
I would also accept mapping to a circle of radius 1 if that's easier
17:36
This looks relevant:
53
Q: Is there a bijective map from $(0,1)$ to $\mathbb{R}$?

iebI couldn't find a bijective map from $(0,1)$ to $\mathbb{R}$. Is there any example?

I misunderstood Kevin's original comment. The curves go through the given points by definition...
logarithm?
something something
Too bad the top-voted answer doesn't actually give teh codes the formula
but you'd probably want something that preserves...uh...something
so that everything gets ~inflated but not shuffled
I'm not sure what that property might be
The gold-star solution would preserve the property "coordinates with large absolute values are closer to the edge of the image than coordinates with small absolute values"
I suspect any solution that involves projecting through a circle's center onto its circumference would be "inside out" by that metric
Not that I've bothered to do a lick of math to confirm that
17:43
Hi everyone, sorry if this is the wrong chatroom for pandas questions but would anyone know how to return the row number of a csv given the number bytes from the start of the csv using pandas?
X ⊆ Y => f(X) ⊆ f(Y). Monotonic!
I don't suppose counting the number of newlines between byte 0 and byte X would tell you the row number?
Or does csv allow newlines to be embedded in cell values? I'm not sure.
@Embedded_Mugs all you have is the number of bytes? Not the actual byte data?
Csv modules typically try hard to abstract away the details of the underlying data's structure, so I wouldn't expect them to give you information about the value at byte x in the file. The module doesn't even want you to know that there is a file.
@Code-Apprentice Yes all i have is the number of bytes. I'm getting an error on Google Biquery not being able to parse a csv and it only gives a number called byteoffset of that represents where the error occurs
17:48
Well, if you do get a hold of the row number, what do you intend to do with it? Since you don't have access to the file itself, what are you going to cross-reference the row number with?
@Kevin the tangent is monotonic
@AndrasDeak Oh, nice. I may try to implement it, then.
@Kevin If I get a hold of it, I'm going to delete the row or try to reformat it so that I can load the data into bigquery without any errors
It's strange to me that you can delete rows from the file, but you can't read data from the file.
@Kevin I can read it with a text editor or pandas but I cant load it into the bigquery database
17:52
Ok, so load the file with the text editor, and use the "go to..." option to go to the Xth byte.
I know for a fact that Notepad++ has "go to byte offset" capability, so no line number needed if that's the editor you happen to be using
@Kevin Ok, im going to install notepad++ and use that feature
One possible outcome of this is: you successfully identify the Xth byte, and there's nothing obviously wrong with it that would cause bigquery to reject it.
The file can't be too corrupt, since pandas can read it.
@Kevin There's the Poincaré disc, if you don't mind working in hyperbolic space.
@Kevin I think the file is not corrupt but there is an inconsistency in the delimiters in the suspect row which is causing an inconsistency in the number of columns specified in the schema
@PM2Ring Hmm, are midpoints well-defined in hyperbolic space? Or rather, weighted midpoints? My uneducated guess is "yes". Might be interesting to play with that, too...
18:18
Let's see. In hyperbolic geometry, two points uniquely define a line. And you can construct a coordinate system so that distance is well-defined between any two points. I think this is all you need to draw bezier curves in hyperbolic space.
@Kevin Sure, otherwise you wouldn't be able to do tesselations. Just like spherical geometry, when you do hyperbolicy geometry any construction that only uses the first 4 axioms of Euclid works the same as it does in Euclidean space. It's only stuff that uses the parallel postulate that goes wonky.
Rad.
And on the Poincaré disc model, a straight line is either a straight line through the centre, or the arc of a circle that intersects the disc boundary at right angles.
FWIW, I wrote a C program back in the Amiga days to do simple hyperbolic tessellations, but I've never tried doing curves.
wim
wim
def f():
    try:
        try:
            errorerrorerror
        except:
            print(1)
            return 1
        else:
            print(2)
            return 2
        finally:
            print(3)
            return 3
    except:
        print(4)
    else:
        print(5)
    finally:
        print(6)

print(f())
cute puzzle
(guess before running)
1 3 6
18:26
I got it right B-)
That was just a wild guess. And I'm falling asleep. :)
You mean what's the output? 1 3 6 3
if PMG is right, I didn't know finally gets hit before a return
It's not too often you see a function that executes multiple return statements in a single run
18:32
where does the final 3 come form
The final 3 is printed by the print(f()) call, because 3 is the value returned from f
Kind of nefarious though to return a value on top of a previously returned value
does the returned 1 get lost?
or...? xD
finally puts on the stack i assume
18:34
I think they should be added together, to return 4
or 13
ah so basically it's a positive
@Embedded_Mugs Do you have the CSV file available? The only thing I can think of is to write a program to open the file and read that many bytes.
I don't think there's a way to determine the line number from the number of bytes because each line can be variable length.
docs.python.org/3/reference/… has all the information needed to deduce the code's behavior
@Code-Apprentice Not short of doing data[:byte_offset].count('\n') or some such
18:42
Is anyone here familiar with the Chromecast API to invoke CEC to turn my TV on via a http POST webhook or any other means?
@WizzKidd no but sounds interesting
I'm able to control my Google Home device by POSTing directly to it's IP using Node-RED and a supporting cast plugin. All commands I know of use the TTS engine to make the GH device speak.
I'm now looking to do the same to my Chromecast device, but instead of sending a TTS string, I'd like to send a command (in a similar fashion, using Node-RED) to do things such as play/pause/stop media, and more specifically invoke the 'turn on TV' command which is supported in the API.
Using flask-sqlalchemy and joining 2 tables i get this:

[(<User 1>, '1', '1', 123, None, None, None)] } }

And have to access like query[0] to user data, query[1], query [2] and query[3] to teacher, how can i get the result like this:

[(<User 1>), ('1', '1', 123), (None, None, None)] } }
@PaulMcG that's similar to what I had in mind with the preceding message
18:51
Victor, could you maybe give use some code to work with?
Hi all, this may be a silly question, but if I have an output in bytes for some python code, is there simple way to determine what that byte code is meant for?
Like maybe to help translate it to something thats more understandable?
Programs can print anything they want, and the output doesn't have to mean anything at all. It could be random noise for all we know.
Uh, maybe base64 might be of help, depending on what that byte code is.
        :44385222
            Operator = aliased(User)
            Approver = aliased(User)
            wqp_desionizers = WQPDesionizer.query.outerjoin(
                Operator, WQPDesionizer.operator_id == Operator.id) \
                .outerjoin(Approver, WQPDesionizer.approver_id == Approver.id) \
                .add_columns(
                    Operator.first_name,
                    Operator.first_surname,
                    Operator.card_id,
                    Approver.first_name,
                    Approver.first_surname,
Just to be clear, when you say "byte code", you don't mean "the intermediary storage format that plaintext Python programs are converted into before being executed", right?
18:59
Sorry, by byte code I meant something like b'xff\xff\xff\xff\xff\xff\xff\xff\xff'
00:00 - 19:0019:00 - 22:00

« first day (2931 days earlier)      last day (2239 days later) »