« first day (3662 days earlier)      last day (1511 days later) » 

03:59
@PaulMcG It is not about containers ... when getting the packets to rx ring,I just need to move packets to userspace directly without going to protocol stack ....If rx/tx rings can be fully mapping and maneging in userspace,it can be done ..... Really,I need to do bypass system protocol stack... but,bpf do move packets to both protocol stack and bpf vm and run bytecodes in vm and capturing specific packets.....Is there any solution or idea?
I love it when you talk dirty.
But really, at this level of work, I think you will need some C libs, and if you still want Python in the mix, use ctypes.
scapy might have some code to help with this. I know little about it, other than it it is a Python lib for doing packet level stuff.
(I hope this "dirty talk" comment wasn't offensive. I often say it at work when someone sends me a post full of terms that I only understand about 30% at most. Not intended to be a personal comment.)
But looking at the ISO stack, I think Python is typically at level 6 or 7, whereas packets are somewhere around 3 or 4. So to get Python code to delve down to that level, you'll either need a library that includes C code (which I think scapy does), or write your own.
Even if you can scoop up the packets, will Python be sufficiently performant for you, if you are planning to intercept and process them?
04:38
@PaulMcG scapy only can capture and build packets ...I think It uses PF_PACKET sockets...it can't do that kind of tasks....
Googling turns up this: allanrbo.blogspot.com/2011/12/… Any help?
05:32
Hello every one ! Very Gm ! i am working on date time format i have column with '2020-10-12 09:15:00+05:30' how i can change date time format . please guide thank you
 
2 hours later…
07:56
Looking at seaborn.axisgrid.FacetGrid's module
    # Attributes that are part of the public API but accessed through
    # a  property so that Sphinx adds them to the auto class doc
    self._fig = fig
    self._axes = axes
    self._axes_dict = axes_dict
    self._legend = None
There is a leading underscore in the variable self._axes = axes
But in practice the underscore is omitted and sns.catplot.axes is used, but sns.catplot._axes also works. How come it accepts both?
is there a property perhaps?
Oh, yeah, the comment says so.
08:34
@property
def axes(self):
    """An array of the :class:`matplotlib.axes.Axes` objects in the grid."""
    return self._axes
Ohh found it
No, I think it's more about string interning which the answer fails to mention
It's one of those areas where I'm not overly confident, though. So I'll reserve adding a dupe to that effect
ohh ok, are caching and interning different? Answer states "Python caches small integer objects" and later says its true for strings as well.
I think interning strings is more along the lines of "maybe python will, maybe python won't" vs. the integer cache which is built in to CPython
I will have to read more on this, but someone else managed to associate a better dupe with that
anybody have any idea why this would only be returning one value and not all the lessons ? Lessons.query.join(Step).join(LengthOfClass).join(Academy).group_by(Lessons.academy_id).order_by(Lessons.step_id.asc()).all()
09:34
Come now, there's a lot of SQLA with no ability to see what it's querying. Maybe you need to use .outerjoin but that's probably my only guess and it's a stab in the dark
hmmm odd will give it a try just surprized as expected it to return all the lessons
because can access the data from all the joins but it only returns one value when there are 10 classes i was expecting to return with the data from each
That's why I'm suggesting outerjoin instead. Switch the .join out and see what you get
hmm same result not displaying all but only the first
You did that for all instances of .join?
Lessons.query.outerjoin(Step).outerjoin(LengthOfClass).outerjoin(Academy).group_by(Lessons.academy_id).order_by(Lessons.step_id.asc()).all()
09:42
And if you get rid of the group_by?
that does is... now why would that stop it from working
Because GROUP BY is for aggregations e.g. SUM of some values or MEAN. It seems you have only one academy_id
ahh so once adding more academy classes it shold work
No, then you'd just get 2 results :P
lol damn
how would be best to sort them so the classes for each academy are in the same group
order_by?
09:47
Yes. If you're asking how to get a nested structure of elements grouped by academy_id I don't know how to do that. It both seems like it should be possible and that I should know how to do it
i think order_by should work inorder to get them structured right
If it doesn't then you'll need to layer on groupby over the results
But that groupby does assume that they'd be sorted into distinct blocks, so you'll definitely need your order_by to be working on academy_id
ok sweet well will get to experimenting p.s the issue I had the other day with ajax and formating the string i found much easier to just send the variables to js as ajax and format it in client side
and as with what you said about submitting the form with ajax i didn't need it for that form but have a feeling I will need to do it for the progress updates and register so will keep you informed on how that goes
Cool cool. That's where things get fun :P
Lol yeah
right now just sorting out finishing all the different things i recently added then will get onto that which should be interesting ^^ then after I need to do research into unittesting to learn how to set up tests
10:10
Now that I think about it, I wonder if there is a structure to what value was being returned to you by group_by. Was it always the same lesson? I'm hedging my bet on it defaulting to FIRST and you had an ordering to your query so it would be consistent between runs
Yeah it was first as it kept returning the first value from lessons
<high-fives self>
@Kwsswart Look at pytest. More beginner-friendly than unittest ;-)
Will do ^^ which is more commonly used in testing?
Also any good reads to learn about unit testing that you guys would suggest?
10:59
@Kwsswart random thought (I don't know if this is considered a hack). What happens if you add the id of the lesson into your group_by?
groups = (Lessons.query.outerjoin(Step)
                       .outerjoin(LengthOfClass)
                       .outerjoin(Academy)
                       .group_by(Lessons.academy_id, Lessons.id)
                       .order_by(Lessons.step_id.asc())
                       .all())
I don't have a convenient example to test myself and it's Sunday so I'm being lazy and not building it all up. I'm gonna package and sell this outsourcing of testing as some pair-programming lesson :P
In my head that approach goes one of two ways - it either does the equivalent of itertools.groupby over the result where you don't use group_by (and you get what you want) or it completely garbles the result and every row ends up as its own nested object
hmm interresting the result is actually exactly what i was expecting from the original query all of them nicely grouped together based on academy and then ordered by step in academy
pow :)
Although I don't know that that is the way it should be done, it doesn't seem totally unreasonable to do
it seems to work as to what is 'supposed' to be done is a very loose subject within programming isn't it? with so many different ways for one thing
11:16
Well, SQL definitely doesn't work like that at all because performance is always a concern. Being a declarative language, you might stop internal optimisations from being performed if you structure the task up incorrectly
See postgresql COUNT(DISTINCT …) very slow for an unintuitive but basic example
Good to know it honestly amazes me the more I learn about programming the more i realize 1) I know nothing and 2) there is so much thought process that has to go into developing an app
I'll let you know if that feeling ever goes away for me :)
3
lol it is a nice feeling
Hello :)
11:22
do you know if there is option to run the command coverage xml of entire directory (contains few files) instead of one file?
from the documentation it is not clear...
11:35
anyone? :)
I'm afraid I don't know the domain to be able to help you, @arielma. It's Sunday so traffic will be slow in the room, but people do review the transcript when they come online. Hopefully someone can help but it'll be a case of waiting
@Kwsswart Not just programming. Almost any subject or field can be vast. Before you start learning, you feel like you know almost everything about the topic. Once you get into it, you notice a few things you don't know and feel that once you know them, you will finish the topic and know everything. But usually you get more questions than answers.
This can be explained by visualizing a circle of knowledge. As you expand your circle, you get more area of knowledge. But the edge of that circle is your ignorance (that you are aware of), and it grows as well. As you get deeper into a topic, you realize how little you know, and it can only get worse from there, until a point comes where you become a master of the subject, but then you realize it connects to other subjects, and your journey restarts.
12:15
@Kwsswart Unittest has the advantage of being available in any Python, while pytest is a (development) dependency. IMO pytest is easier to understand because each test (or family of tests) is a function that makes assertions, so no need for unittest's huge collection of assertion methods.
12:35
@arielma Have you tried just feeding all the files to coverage xml? E.g. coverage xml my_directory/*?
13:14
@Kwsswart case in point. I think we (I'm interested in this too) should be looking at PARTITION BY and not GROUP BY to get rid of the aggregation, rather than throwing the row id into group_by
hmmm does that work similarly or is it specifically meant for what is intended
That's why I said "should be looking into" :P I don't know
@holdenweb definitely will look into these when i get to that point will maybe start with pytest and once comfortable try unitest
@BožoStojković I like this description
lol well will look into it now see what i can find
user13925035
hi
Hello :)
13:46
stackoverflow.com/q/64524327/4799172 typo. The didn't call the method
@roganjosh kite.com/python/docs/sqlalchemy.over have you heard of this over() method?
Yes. I'm starting to think that partition might not be what we want. I got distracted by "does not change number of rows"
What you guys trying to do?
@JonClements I don't know whether this is a hack, basically
They expected group_by to give the same structure as itertools.groupby but it doesn't - it'll just return the first result of each group vs. giving a nested list with the groups segregated
The fact that I'm throwing the row id into the GROUP BY just to stop it performing an aggregation on each group just... feels like I'm using the wrong approach
oh okay... might be worth looking at partition and also WITHIN GROUP stuff with a suitable *AGG function applied to a column (can't remember them of the top of my head)...
(depending on the DB of course...)
anyway... gonna go sort dinner out... bbiab
14:01
Enjoy :)
14:17
@JonClements the point is that they want to not have an agg function. It's literally just the equivalent of passing a nested list (like a CSV) through itertools.groupby and getting an extra level of nesting for each group based on the value of one column
@PaulMcG Really,bpf(cbpf) can't do it...may be ebpf and XDP can do it... I got some sources ..I am still reading them.. qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf
14:54
There's something about people having a serious discussion around piggy_sum and piggy_subtract that's really tickling me
15:04
@roganjosh I wish people with these kind of problems were able to field a serious discussion.
Back when I was young, when computers were made of wood and programs made of tears, people knew that any problem not worth discussing with a hungry polar bear just wasn't reprex enough.
@MisterMiyagi That's part of what makes it funny to me. I don't know whether you'd be aware but "piggy bank" makes sense as a place to store money.... but "piggy" alone is what you'd call a baby's toes in "this little piggy went to market, this little piggy stayed at home....".
Kitty might be a better word, but now I wonder why both of those terms revolve around animals. What barbaric past means that both words for a money store revolve around childish terms for animals?
15:24
Must have been back when Computers were made of stone, before us wussy wood-chippers came along.
 
2 hours later…
17:20
Microsoft took down youtube-dl GitHub repo on DMCA takedown notice by RIAA (if anyone uses it and is interested).
 
1 hour later…
18:37
@MisterMiyagi I would say the earliest computers were made of fingers and toes
18:52
Hi
how are you? )
Fine, thanks. And you?
I have a question on python coverage module
when I'm running coverage xml on some file, does it also runs coverage run as part of it?
As I explained to you earlier from this it will take time
19:07
ok :)
Not only that, but you got a direct response:
7 hours ago, by MisterMiyagi
@arielma Have you tried just feeding all the files to coverage xml? E.g. coverage xml my_directory/*?
I tried it, but it gives me 0 coverage
Did you tell MisterMiyagi that?
not yet
But you asked for help a second time.... ignoring the suggestion that was given to you. That's not particularly nice
Please follow-up with MisterMiyagi before restating the problem
19:16
Ok sure
19:28
Any idea how to properly set the last axes of an array to a particular set of values?
Something like np.take_along_axis(array, indices[..., None], -1)[..., 0] but setting rather than retrieving those values?
@user76284 your textual question only has one array, not two: array and indices
What is the shape of your array, what is the shape of indices, what is the shape of the "set of values" to set to?
there's definitely a single indexing step that will do what you want, assuming you can explain what you want
A naive loop that does the same thing and is copy-pasteable into my REPL will work even better
In other words, an MCVE is needed
19:55
Sorry, I guess it'd be better to explain what I'm trying to do: Suppose I have an array (with arbitrary batch dimensions) of 2D integer vectors.
For each of these vector's, I'd like to map them to their corresponding Von Neumann neighborhood cell.
For example
Let's be a bit more specific, please. Say (n, p, q) shape.
[0, 0] -> [0, 0], [0, 1] -> [0, 1], [0, 2] -> [0, 1], [1, 1] -> [0, 1] (or [1, 0]), [45, 30] -> [1, 0], etc.
What is "the" von Neumann neighbourhood cell? The linked site gives 4 neighbours per cell.
e.g. [[[0, 0], [0, 1]], [[45, 30], [-2, 3]]] -> [[[0, 0], [0, 1]], [[1, 0], [0, 1]]]
Yeah one moment
you don't necessarily have to explain it to me if you can explain the numpy problem without it
19:58
I meant to the nearest* Von Neumann cell.
I have a current solution but it involves multiplication.
One moment.
Nearest? In what sense? Don't all points have 4 equidistant vN neighbour cells?
Nearest to the origin, based on your example
take your time, I'll be on and off myself
def get_vn_cell(vecs):
    dims = np.abs(vecs).argmax(-1) # select the dimension with the highest absolute difference (see Manhattan distance)
    return np.eye(vecs.shape[-1], dtype=int)[dims] * np.sign(np.take_along_axis(vecs, dims[..., None], -1)[..., 0])[..., None]
I want to map each integer vector to the (or a, if not unique) nearest (under the Manhattan metric) vector in the Von Neumann neighborhood {[0,0],[0,1],[0,-1],[1,0],[-1,0]}.
Incidentally, doing the same for the Moore neighborhood is extremely easy: np.sign(vec).
It just clips to -1, 0, or 1 along each dimension.
So vecs is a 2d array of shape (n, 2)?
It might have more preceding axes. But the last axis has dimension 2, yeah.
OK. Just to have an MCVE.
@user76284 I'd approach it like this:
def get_vn_cell_v2(vecs):
    vecs = np.asarray(vecs)
    res = np.zeros_like(vecs)

    x_larger = vecs[..., 0] > vecs[..., 1]
    res[x_larger, 0] = np.sign(vecs[x_larger, 0])
    res[~x_larger, 1] = np.sign(vecs[~x_larger, 1])

    return res

inp = np.array([[[0, 0], [0, 1]], [[45, 30], [-2, 3]]])
np.array_equal(get_vn_cell(inp), get_vn_cell_v2(inp))  # True
(removed your function definition to make the message fit into chat)
there might be some edge cases to think of, although at a glance it seems to work for diagonals too
1. np.asarray allows your list inputs as well (not necessary if you know your input is an array)
2. we allocate a zero array for output
3. we find the indices where x is larger in the input, and set the corresponding x component of the output to the sign of the input's x component
4. do the same for y
5. I think if both are zero then you get (untouched) zeros as expected
20:42
Not untouched, but zero anyway. We'd need y_larger = ... < ... for that.
21:31
import pandas as pd
data = pd.read_csv('Numerical.csv')
data.head()

temp_df = pd.DataFrame()
if((data['Q5'] == '1 - 3 years') | (data['Q5'] == 'Less than 1 year')):
    temp_df['col A'] = data['Q9_1']
Let me guess: truth value of a Series is ambiguous?
In above, I'm just creating a new column on a new data frame based on values from previous data frame. But it throws value error
Yes
Have you googled that error message yet?
Yes it says bitwise operator issue and I changed to | from or
Still the same
But also try to understand the fundamental problem why that error happens. What the error message means.
21:34
Okay
When you do if series_object you're trying to get "a truth value" for "the series_object". That's what you can't do.
So I have to consider individual object by object in a series
When you originally had ... or ... you also tried to get a truth value. Both implicitly try to call bool(series_object)
@YatShan If you mean that you want to do elementwise operations on your Series: yes
Yes, element wise operation
I am checking each row of data frame and assigning to new data frame
@YatShan what you need is the logical index ind = data['Q5'] == '1 - 3 years') | (data['Q5'] == 'Less than 1 year'), and then indexing with that boolean index array into data['Q9_1']
21:36
Okay
What do you want the remaining rows of temp_df['col A'] to have? Nothing or NA?
I can leave out those rows
OK, then just indexing into data['Q9_1'] should give you the shorter column that goes into temp_df directly
Okay
At the end of the day you probably need something like data.loc[ind, 'Q9_1']... but you should definitely take the time to understand why your original code breaks.
21:40
Okay Thanks !
no problem

« first day (3662 days earlier)      last day (1511 days later) »