« first day (3139 days earlier)      last day (1806 days later) » 

12:03 PM
well, it's hard to explain. it's several parts... for one thing we are using a SQLite database, and I don't want multiple connections to it. So I want to go through our existing databaselayer.
Potentially I could have my users in the standard database. And then have another database with the auth stuff (except User)
 
Welp, not sure how I can help you there.
I would be tempted to have a dedicated sqlitedb for the oauth stuff anyway
(depending on the system and other requirements)
 
That doesn't gel well with the User being in the other database I don't think
 
this is a good question, stackoverflow.com/questions/56237733/… I only could find a PEP for it, but anyone knows what might be the actual reason behind it?
 
12:18 PM
@Aran-Fey I like the idea. Hiding every other code block is the first thing I tried that worked, and I will be glad to be rid of it.
I wanted to just use <span class="spoiler"> for everything, but I couldn't get it to work on multiline elements because the markdown engine sticks <p> elements everywhere
<p><span class="spoiler"></p> <p>line 1</p> <p>line 2</p> <p></span></p> is not valid html, it turns out
 
It definitely has a thing for <p> tags. I tried to do something like <p class="spoiler" />text and it converted that to <p class="spoiler">text</p>...
I'm not happy with the fact that each riddle requires 10 lines of boilerplate HTML, but it does make the interface more... nice
 
@DeveshKumarSingh Do you need the list call in your example? Does this work? *elements, = range(6)
 
yes it does
 
Thanks.
 
what does that tell you though @PM2Ring
 
12:26 PM
@user2357112 Is good with questions like that.
 
PEP 3132 says that *elements, = range(6) will create a list on the left-hand side. PEP 448 says that elements = *range(6), has generalized unpacking in a tuple display, (*range(6),) with implicit parentheses, creating a tuple on the right-hand side. (cc @PaulPanzer) — Andras Deak 36 secs ago
 
is the confusion about the RHS or the LHS?
 
both, probably
 
both not showing same behaviour.
 
that ^
 
12:30 PM
@DeveshKumarSingh Actually, I'm a little surprised that it creates a list, rather than a tuple. My guess is that the PEP 3132 stuff is much newer, and they simply decided that a list, being mutable, is more useful on the LHS.
 
it states in the disadvantages of PEP-448, but yes I think it is there to keep it consistent with *args ?
 
hi, i've a silly question,

i would like to extend the sklearn's randomForrestClassifier,
Therefore i thought, i create a new class, whereby randomForrestClassifier, is its parents.

But what i wouldn't want to do is, defining all the dependencies (parameters) from randomForrestClassifier in my custom class...

is there a way to do this?
 
@roganjosh - depends on what's happening behind the scenes and if the user object is being used elsewhere.
 
Of course, if you're building the LHS with a Python loop, you need to do it with a list, since you can't append to a tuple, but that shouldn't be an issue for this stuff operating down at the C level... I think. ;)
 
@Dieter I'm not familiar with the classifier class that you're referring to, but couldn't you just pass on all the args and kwargs to the parent class constructor?
Except for any that you want to override/tinker with, that is.
 
12:35 PM
The first behaviour is to keep in-line with the existing arbitrary argument lists used in functions

The second behaviour is to be able to use the variables on RHS further down in the evaluation, so making it a list, a mutable value rather than a tuple makes more sense
 
@OldTinfoil The implication I got was that it's going to require pairing of data from two databases, using two different query methods (If they have a database layer, presumably to avoid concurrency in sqlite)
 
@Ol
@OldTinfoil - this is the constructor ```__init__(self,
n_estimators='warn',
criterion="gini",
max_depth=None,
min_samples_split=2,
min_samples_leaf=1,
min_weight_fraction_leaf=0.,
max_features="auto",
max_leaf_nodes=None,
min_impurity_decrease=0.,
min_impurity_split=None,
bootstrap=True,
oob_score=False,
n_jobs=None,
random_state=None,
verbose=0,
warm_start=False,
class_weight=None)````
of the RandomForestClassifier
 
(It'll help with formatting code in chat :) )
 
@DeveshKumarSingh The second behaviour is to be able to use the variables on RHS further down in the evaluation Should be LHS
 
potato, rightato
 
12:38 PM
thanks corrected, but seems like to be backward compatible, this decision was made
also PEP-3132 states: Make the starred target a tuple instead of a list. This would be consistent with a function's *args, but make further processing of the result harder.
 
@roganjosh The same source can fiddle different databases simultaneously, so it could still work fine... but chances are we'll never know
 
How that phrase coalesced in your head, Andras, is today's biggest mystery :P
 
all hail the PEP's :D
 
@Dieter - have you tried something like:
class DietersMegaRandomForestClassifier(RandomForestClassifier):
	def __init__(self, *args, **kwargs):
		super().__init__(*args, **kwargs)
 
@OldTinfoil - i feel stupid now ... i tried it in the past, but i had 2 asrtixes
with the args --> **args :)
 
12:44 PM
It happens man
 
but it is exactly what i want
 
Good luck, and don't get lost amongst the trees :)
 
@DeveshKumarSingh Indeed. I got that a bit mixed up, earlier. Sorry about that.
 
that's why i try to build a tree intrepreter :)
dunno why it isn't a standard option :)
the idea is, that we can keep the random forrest keep the standard functions of the random classifier, but extend it, by some methodes, like: get_tree_interpretations( data )
 
@Dieter You mean extending the class as a standard option?
 
12:51 PM
yes
 
Well, Python doesn't just do single class inheritance - it can inherit from multiple parent classes. Doing it by default would lead to a lot of confusing and ambiguous behaviour.
 
what do you mean?
 
So, you could inherit from two (or more!)
 
yes
 
lasses:

class Child(Mum, Dad)
So if you took the default args and kwargs from both, how would you resolve any duplicates?
And what about the arg order handling?
 
12:59 PM
at the moment, i'll only inherit from, RandomForestClassifier
not from, the interpreter and classifier
--> because, i'm going to adapt it a bit,
 
Well yes - but that's why Python doesn't silently pass all the args and kwargs by default
 
@roganjosh I have thought about this some... let's say I have users in one database, and then sessions in another.. so the problem is that there might disappear a key in the "standard" database, and then the session might still be active, and continue to be so until the session timesout. But basically there should be no data of interest to save in the session db. Right?
 
I feel a bit uncomfortable to say anything definitive here tbh but at least you're aware of the sync issue
 
1:35 PM
I think Notepad++ updated and changed the find/replace window, switching out the "replace in current document only" button with "replace in all opened documents". This is a problem because I don't actually read button labels.
Alternately, the buttons haven't changed and I merely had a psychotic break that makes me think they did
 
i suspect the latter :P
 
And what have we learned here? Never try update
 
Oh good, the "undo replace" button only undoes the replacements I made in the current document. I'll just go through all twenty of my open documents and undo each one myself, shall I...
 
How can that ever be a useful "feature"?
 
1:39 PM
which one, replace in all open docs?
i can see it being handy, say you wanted to fix someone's name across multiple documents where it was entered incorrectly or something
 
\o cbg
 
Yeah. I tend to have 10 docs open at any one time, usually cherry-picking html or js, often across multiple projects
 
though, ofcourse, me being extremely uneasy about blanket converting something, i usually manually check every single replacement and replace one by one, even in text where i know i could just hit replace all. So forget replacing across documents at once :P
cbg
 
Since the projects generally are in the same context, a replacement could smash multiple projects in one go.
 
Good news, 19 of my documents were useless anyway so I just closed them without saving
 
1:46 PM
ha, that is so relatable when it comes to notepad. i close 3 tabs after eventually noticing there's a lot of stuff open..and then i see 2 more open tabs left..so i close them too...and then suddenly 1 additional tab pops up, hidden on the left...and then i realise there's some more tabs open. i press the key left, and then deal with the next 6 or so tabs...and then 1 more tab pops up..and at this point im pulling out my hair, and maybe i'll need that no you will never need it but...send help.
fwiw, its very liberating once you finish closing everything though. :)
 
I don't mind mass-closing my tabs. What I do mind is when I use "move to other view" to get a side-by-side view of two documents, and by the end of the day I've got N documents in the left panel (where N is a very large number), and N documents in the right panel, and I have to manually move at least N documents if I want to get back to one-panel mode.
My kingdom for a "move all" button
 
Time for Kevinpad++?
 
I wrote a pitiful little text editor once. Just getting to the feature level of regular Notepad is mind-bending, let alone competing with actually good IDEs
And I wasn't even trying to use memory-efficient data structures or anything. If I had attempted to implement ropes, my brain would have dribbled out of my ears
 
why does @wim put return after yield? stackoverflow.com/a/49641953/2336654
 
Yeah, why doesn't he just do return yield x instead... :-P
 
1:55 PM
in python if X is false is Y executed? -> "X and Y"
 
(yeah, yeah, this changes what the function returns if you call send() on it. Call that implementation-specific behavior ;-) )
 
No, it short circuits
 
cbg, and no it isn't
 
When I need to do mass search & replace in multiple files, I like to do it with a script that writes the results to new files, in a separate directory. That way I can test it without yamming up the originals.
 
1:55 PM
>>> False and print("If this doesn't appear, Python does short circuiting")
False
>>>
 
@piRSquared Because in those branches you don't want it to recurse any deeper.
 
@PM2Ring you mean as if it were a one character string?
ok
 
Correction: "why doesn't he just do return (yield x) instead... :-P"
return yield expr without the parens is a syntax error
 
@piRSquared Or any string. A naive flattening algorithm blows up on strings, since each char in a string is itself a string. And generally, you don't really want to flatten an n-char string to single chars anyway.
 
@Kevin Idk what return (yield x) would mean. So to quote Crash Test Dummies "Is that a parable? Or a very subtle joke?"
 
2:04 PM
return (yield x) is equivalent to z = yield x; return z
IIRC, yield expressions evaluate to None if the generator's execution was resumed by calling next or by iterating over it. And if you resume the generator's execution with the_generator.send(Q) instead, then the yield expression evaluates to Q.
 
Thx guys (-: that helped
 
What I'm wondering is, is there any behavioral difference between wim's approach there, and this?:
def flatten(x):
    if isinstance(x, str):
        yield x
        return
    try:
        for elem in it:
            yield from flatten(elem)
    except TypeError:
        yield x
 
I don't see one. However, instead of a return after yield could you just wrap the try in an else clause?
 
Oops, I meant for elem in x there
@piRSquared Yeah.
One advantage of wim's approach is that it encloses the smallest possible amount of code in the try. This may make it easier to reason about exactly what kind of errors will be caught.
In comparison, my try block contains a recursive call, so if a TypeError gets raised anywhere inside flatten, then it might get caught by a try higher up.
 
@piRSquared Why bother with an else after an if that ends in return? It just wastes a level of indentation.
 
2:14 PM
@PM2Ring instead of the return
 
@piRSquared Ah, ok.
 
That seems a stylistic choice
 
i can argue for 1 advantage when you replace return, one of "single point of exit". But again, its a choice between having additional nesting vs having two points of exit in the function.
 
I usually favor "less indentation" over "fewer lines of code" but I find it spooky to put return and yield next to one another, so I may stick with the if-else structure
I greatly disliked the "single point of exit" design philosophy in my C++ days. I am happy to return whenever I please and I am doubly happy that context managers make this even easier to do
If I never write goto cleanup; again, it will be too soon
 
When writing recursive generator functions, I prefer to have an explicit return, rather than using else. And I put a blank line to make it extra obvious that the upper section of code handles the base case, and the lower section handles the recursion.
 
2:26 PM
Here's a case where wim's implementation has different behavior than mine: Given def f(): yield from [1,2,3]; raise TypeError, then wim_flatten(f()) yields 1 and 2 and 3 and lets the TypeError go uncaught. kevin_flatten yields 1 and 2 and 3 and <generator object f at 0x00FB33B0>, and the error is silenced.
wim's behavior seems more sensible between the two
 
2:42 PM
wim's behaviour being sensible? Stop the press!
 
hey all, what do you think of storing dictionaries as values in a column of a Pandas DataFrame? Might this lead to unexpected problems?
 
I don't like it
 
yes, and it will be slow
 
ok thanks
 
and if you ask the same thing with a numpy array I'll say "hell no"
 
2:52 PM
haha ok
 
He meant "Yam no!" Or maybe "Tomato No!"
 
is storing string values in pandas dataframes seen as ok>
 
yes, but if there are only a few choices you should consider using categoricals
 
ah ok
understood
thanks
 
Yes, its ok. If you're thinking about json, that's mildly ok. You might want to ask about what you are doing as it kind of depends
 
2:54 PM
i'm building a csv output, that contains a mix of string and numbers
i am finding pandas ideal, as it really helps with the maintenance and readability
 
is it a mix of strings and numbers in the same column?
 
Some people use pandas dataframes for the structure and the convenience of the methods and that is fine. But if you are doing any heavy lifting then you really should consider efficiency
 
but I don't want to misuse pandas
@ParitoshSingh no, all columns have the same dtype
@piRSquared ye not doing any heavylifting. using it for structure and convenience
 
ok nice, carry on. pandas is good for dealing with "table-like" data, and csvs in this case fit the bill perfectly.
 
ok great
but on that basis still not good to have a column storing dictionaries
 
2:56 PM
Where are the dictionaries coming from?
 
Would your csv have a cell that is a dict? No.
 
@roganjosh an sql query
@AndrasDeak no
 
Ok, and why is that query returning dictionaries?
 
basically, I build a big dataframe, and then have a series of class objects to represent different asset classes. I then iterate through these to leverage off inheritance and polymorphism. The output is then dumped in a csv for ftp upload
 
@Andy similar logic, you can extend it to pandas. while pandas can "allow" storing a container itself as a value, it incurs some serious drawbacks to performance and efficiency. and it breaks away from the more intuitive "one value per cell/value" model. If it doesn't make sense for your csv to have dictionaries as a value, then for now, you can assume it won't make sense for the pandas to have them as values either.
 
2:59 PM
@roganjosh because the query returns multiple values, i was thinking of putting them all into a dictionary and then that dictionary into a col in the dataframe to keep in slimmer
 
It doesn't keep it slimmer. I would suggest that you have a df that has columns representing the keys
 
@ParitoshSingh ok thanks. thats a clear way of looking at it and makes a lot of sense
 
So, more to the point, you need to ask yourself how to "Treat" this dictionary first so that it makes sense in a tabular model. more often than not, the answer is 1 column per "key" in a dict.
 
ye by slimmer, i mean when I look into the dataframe and dont have lots of columns to scroll through :S
 
@Andy My preference would be to keep a dictionary of dictionaries and dump it to json
 
3:00 PM
i feel like i am being sloppy
 
SQL has tables, and so does pandas. There is no reason to collapse the SQL table down to a single string in a single column in pandas
 
@piRSquared ok interesting. dont know much at all about json, but i hear it mentioned a lot and should probably look into it
thanks all for comments and assistance
 
Hello guys, I'm new here. I kind of new for python, but really enthusiast for learning and I am always programming something. I appreciate every hint and talk. I'm very friendly! Hello everyone! :D
 
Hey
 
Hello :)
 
3:09 PM
Cabbage @MarlonHenriqueTeixeira (-:
 
welcome
 
Sorry, but what Specifically do you guys talk about here? I mean: can I ask for some code helps, for example? I mean, I don't want to break the rules. :)
 
Well there are rules for you to read sopython.com/chatroom
 
Thanks, @piRSquared! :D I'll check it out!
 
I just read the salad talk.
I'm going to Yam this project so hard....it's driving me bonkers.
 
3:16 PM
Ok, ignore what this actually does. I'm asking about the decision to import inf for the sake of manipulating a limit. Using inf seems extremely intuitive in this scenario BUT it requires an import. Thumbs up or thumbs down?
from math import inf
def rec(x, limit=inf):
    if limit < 0:
        yield x
        return

    yield from rec(x, limit - 1)

[*rec(1, 5)]
 
float('inf')
 
boom! thx
^ does that date me?
 
No, it was a rad phrase
 
Should I avoid to import something always it is possible?
 
Are you already importing math? Then just ref as math.inf. No run-time penalty, the dot resolution will happen at method signature compile time.
 
3:20 PM
@PaulMcG nope... it would have been just for inf
 
strings are infinitely iterable! What! can someone please explain how is that possible as per: stackoverflow.com/questions/49641930/…
 
Even so, I would import math, and then do limit=math.inf, but of course it is purely a matter of taste - like oysters vs snails
 
@MarlonHenriqueTeixeira import is a pivotal part of Python. However, as general rule and NOT a hard rule, the fewer imports makes a code more portable (less dependencies). My question regarding the math library is hardly risky as it's part of the standard library and is always there. But as a matter of opinion, importing less is prettier.
 
@MarlonHenriqueTeixeira It's an import from the "standard library" so this might be considered a micro-optimisation
 
Counterpoint to "avoid imports if an alternative exists": every function in the itertools module is something you could write yourself without importing anything. But nobody does that.
 
3:25 PM
@DeveshKumarSingh When you do for c in 'xyz': each c value is a string of length 1.
 
I have a reverse backdoor that I wrote with Python.
I'm running Python2, but I can't run it in python3.

I've been dealing for a week.
I'm solving a mistake.
Another error occurs.
I'm going crazy.
Would you help me upgrade to Python3?

I'm waiting for your help .

Listener: Kali works in linux.
reversebackdoor: Works on Windows 8.



Listener.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket, json,base64



class Listener:
def __init__(self, ip, port):
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
yes, that is correct, but how does it relate to strings being infinitely iterable
 
I got it! Cool! I'm learning. I'll not be here every time. And when my questions are so obvious, feel free to not reply to me. Ill understand! :)
 
If you can't help, can you show me the source?

Because this is json.encode and json.decode is not working.


It gives the following error in Listener.py.
TypeError: a bytes-like object is required, not 'str'


It gives the following error for ReverseBackdoor.py.
TypeError: can only concatenate str (not "bytes") to str
 
Whoa copy and paste long code batman.
@HibritUsta use gist or pastebin or something else for that long of a code plz
 
3:28 PM
okey . Well I'm fixing it right away.
I am sorry
 
@DeveshKumarSingh If you recursively flatten a list of lists of lists of ints, eventually you get down to the level of ints, and your recursion can bottom out. But if you try to flatten a string that way, each recursive call gets passed a string, so the recursion never terminates. Unless you test the item length, and use that to terminate the recursion.
 
The point is [1][0] is not iterable but 'a'[0] is.
 
@HibritUsta one significant change between Python 2 and 3 is how strings are treated. Python 2 has strings and unicode strings. Python 3 has bytes and strings. Many functions that used to return strings in Python 2 instead return a bytes in Python 3; and many functions that used to return a unicode string now return a string.
 
recursively flattening and iterating are two different things right, how will an example of flattening a string and it never bottoming out look like?
 
3:31 PM
(this is because Python 2 strings and Python 3 bytes are essentially the same class, and the same is true for Python 2 unicode strings and Python 3 strings. But I digress)
 
@DeveshKumarSingh It tries to flatten 'a' which is an iterable for which it tries to flatten 'a' which is an iterable for which it tries to...
 
My general advice is to understand the difference between bytes and strings, and know exactly which of your types should be bytes and which should be strings, and know what functions return bytes and which return strings.
 
@piRSquared Another option is to use a sentinel like None as the default limit. It makes the code slightly clunkier, but it makes it far more obvious to the reader that the case with a valid limit vs the case with no limit are being handled differently.
 
I've tried every method I've found in stackoverflow.
I did encode and decode operations.

Can you try my codes?
 
TypeError: a bytes-like object is required, not 'str' occurs when you try to call a function using a string when you should be using a bytes. TypeError: can only concatenate str (not "bytes") to str occurs when you try to add a bytes and a string.
 
3:33 PM
Now you done reverse backdoored yourself. Frontdoored?
 
I'm really confused as to why someone would want to write a reverse backdoor.
 
In [9]: li = [['abc'],['abc'],['abc']]

In [10]: print([i for item in li for i in item])
['abc', 'abc', 'abc']
this doesn't throw an exception, yes let me read up on the comments!
 
@biggi_ I want to improve myself on cyber security.
 
@DeveshKumarSingh how about reading the broader context then?
you're barging in without knowing what the discussion about, no wonder you're confused
 
@DeveshKumarSingh, consider: "hello"[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0] runs without crashing, but (1,2,3)[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0] crashes
 
3:36 PM
def reliable_send(self, data):
json_data = json.dumps(data)
self.connection.send(json_data.encode )
Does json not convert to byte when I do data.encode
 
@DeveshKumarSingh Further to what Andras said, the following code loops forever.
s = 'a'
while s:
    s = s[0]
 
@HibritUsta you forgot to call the method there, but that should lead to other errors
 
@PM2Ring yes this clears it, thanks :) hence need to check instance and length while if the input of recursive function can be a string
 
You might know this already, but keep in mind that json_data is not "a json" or anything of that nature. json_data is a string. Having a clear understanding of the types of your variables is essential when it comes to debugging these kinds of problems
 
which method are you talking about?
print (type (json_data.encode ())) when I print the code
byte type: <class 'bytes'>
it should be right up here
 
3:39 PM
@HibritUsta self.connection.send(json_data.encode ) <-- literal quote from your earlier message, note the lack of () after .encode
 
@DeveshKumarSingh Rule 0 when writing recursive code: Never forget to handle the base case! :)
 
yes hence the base case, I learn a new thing about python everyday from the discussions here :)
 
this has nothing to do with python
 
Why is this still gaining traction? I answered when I thought it was just a minor question; SO functionality aside on featuring questions, is this a real problem of people throwing tracebacks out or is attention snowballing?
Or it's just a slow-news moment. I'm sure I've seen issues with more gravity that get less than half the attention so I'm just curious if there's some kind of undercurrent for an issue
 
3:54 PM
No, just lukewarm days on meta so this will pop up in the comunity bulletin for a few more days
 
@AndrasDeak there is no problem there. I made the correction.
Listener.py
def reliable_send(self, data):
json_data = json.dumps(data)
#print(type(json_data.encode()))
self.connection.send(json_data.encode())


reverseBackdoor.py
def reliable_receive(self):
json_data=""
while True:
try:
#print(self.connection.recv(1024))
json_data = json_data+self.connection.recv(1024)
#return json.loads(json_data.decode('utf-8',"replace"))
return json.loads(json_data.decode())
except ValueError:
continue


It gives the error as follows.
TypeError: can only concatenate str (not "bytes") to str
 
@AndrasDeak in the back of my mind, I'm wondering whether to incorporate your comment and elaborate a bit, since I didn't anticipate the attention. As it is, I think it's best to leave additional views as comments?
 
@AndrasDeak just came across your answer to the copy argument in pandas merge. Really helpful
 
@HibritUsta I suspected that, but saying one thing and meaning another will not help untangle your current confused situation
@roganjosh either is fine. I don't really think it would make a huge difference either way
@Andy glad to hear that, although it has little practical importance (since it doesn't seem to do anything). It was fun to track it down, anyway :)
 
There's a copy argument in pd.merge? Huh, TIL
 
4:00 PM
@AndrasDeak ye but really helpful as it answered my query about it!
 
awesome :)
 
If it really isn't an issue for the community, I'll just leave it as it is. That's why I was curious about whether the popularity is being boosted by no major meta arguments vs. An actual issue
 
I'm not sure what you mean
 
it is gets > 5 upvotes it becomes a hot post
 
Nobody is up-in-arms on meta, so it's a fluke that this trivial Q/A is featured, vs. an actual issue that people in the community have been stewing over.
 
4:03 PM
that's it, that is literally the criteria. Funnily enough it is quite a challenge to clear that hurdle on meta
um, it's fine, lol
users not pitchforking is a good thing
 
@roganjosh yeah, hot meta is only about votes and views. No pitchfork count.
maybe not even views as cs is saying, I'm not aware of any hard facts in this regard
 
I will continue to deal with this problem.
If it doesn't solve the problem, I'll open a question on this problem in stackoverflow.com
 
@HibritUsta OK, that's probably a good idea
 
@HibritUsta I'm pretty sure the source of your specific error is json_data = json_data+self.connection.recv(1024), as I expect recv is going to give you bytes, and you are concatenating it with a str.
 
yes the whole problem originates from here
I'm having trouble sending and receiving json data.
 
4:16 PM
And really think about what things are bytes and what things are str. I know when I started updating from Py2 to Py3 I randomly sprinkled .encode() and .decode() calls about until things worked - don't do this. I'm fairly sure that recv() and send() will want to work with bytes, while json loads/dumps will work in strs. You won't be able to so casually mix and match with str in Py3 like was possible in Py2.
 
@HibritUsta please see the formatting guide. I'm hit with a double whammy of being on a phone and unformatted code with no indentation, so I just can't read it
 
@roganjosh repl.it/repls/SpatialScratchyQbasic You can read the codes here.
well i will be more careful
 
There is no reason to be manipulating a JSON string throughout the program
Keep the nested lists/dicts as python objects and work woth them as such. You only need to convert to JSON at the poibt that you actually need JSON
 
@HibritUsta No, repl.it is virtually useless on a phone.
BTW, since Python 3.6, json.loads can handle a bytes, as long as it's encoded with UTF-8, UTF-16, or UTF-32.
 
4:31 PM
@PM2Ring what are you talking about? ibb.co/64sd8wh :P
 
@roganjosh Try rotating your phone to landscape, it's even better.
 
I can see a few more letters but it's enough to tempt me to try scrolling. Which I can't. I've been trolled
 
One site I periodically visit has decided that to optimize my viewing experience by filling the entire left half of the browser with a blue rectangle, no matter how I resize or scroll.
Combined with all the normal margins etc you might find on a sane site, this means that sometimes
content
gets
presented
like
this
one
word
at
a
time
Naturally, it's driven me completely mad.
If I have to paste the contents of a website into Notepad++ so I can actually read it, it's not a good layout
 
I was on a site a day or so ago that had text wrapped around images. On the phone, the text beside the images was reduced to a column of single chars.
 
4:54 PM
Hello, I'm single
Hello, I'm new here rather
 
Welcome
 
cabbage :)
(also, I think, "Hello, I'm single" is now my new favorite introduction)
 
:P
 
^^
Hello :)
 
Any relation it Idris Elba?
 
4:57 PM
I'm asbestos-free. Mostly.
 
I know that all Kevins in the world share a special mystical connection, but I think We are a special case
 
Wonder if you and @Kcvin are connected XD
 
Ah yes, the Anomaly.
 
Only picking on him since he's also in WPF
 
@biggi_ Kcvin chose that name because he got sick of the false pings coming from this room.
 
5:01 PM
@Kevin register a new domain named "name_of_other_siite-ftfu.whatever" hijack all of the content with a better css. That should be fun project for you. By the way, don't tell your boss my name.
 
@PM2Ring I know, he explained it in WPF haha
 
5:14 PM
I'm subclassing dict where __setitem__ sets the maximum of the value or whatever is already there.
lst = [['a', 2], ['a', 1], ['a', 3], ['b', 5], ['b', 7], ['b', 6], ['c', 20], ['c', 23], ['c', 30]]
si = lambda s, k, v: dict.__setitem__(s, k, max([x for x in [v, s.get(k)] if x is not None]))
m = type('mict', (dict,), {'__setitem__': si})
If you consider the list named lst and I do this:
d = m()
for k, v in lst:
    d[k] = v
d
# {'a': 3, 'b': 7, 'c': 30}
it works fine
But if I pass the lst to the constructor:
m(lst)
# {'a': 3, 'b': 6, 'c': 30}
The max for 'b' is not 7. So what is dict using to set the values when passing an iterable of length 2 iterables?
Is there another dunder I can override to make m(lst) work?
 
btw, if you set the value and a non-existent key to None, I think max([x for x in [v, s.get(k)] if x is not None]) will blow up, trying to take the max of an empty sequence.
 
Can't you pass a default to max?
 
Yes, and yes but that isn't what this is right now
 
Trying to find where it does this in the source... I think it's PyDict_MergeFromSeq2
 
OK, I didn't read above, just the last message
 
5:23 PM
@piRSquared I think that's a C thing... builtin classes often don't bother respecting child classes. I'd just inherit from collections.UserDict instead, honestly
 
(tsk tsk python devs, using digits in your function name)
 
@Aran-Fey isn't that the suggested course of action anyway, rather than subclassing dict?
 
I'm guessing PyDict_SetItem on line 2417 doesn't bother to see if any subclasses have overridden __setitem__.
 
Inheriting from builtins is generally frowned upon, yeah
 
My verdict is: you're doomed
 
5:26 PM
@Aran-Fey UserDict worked perfectly
Nice UserList and UserString as well. TIL alot.
 
I can successfully encode and send windows commands and get answers.

Listener.py
self.connection.recv(1024).encode()

reversebackdoor.py
self.connection.recv(1024).decode()


upload and download commands are not working now.
It gives the following error:
TypeError: Object by type is not JSON serializable

The reason for this is that you can encode and decode files with base64.
I would encode with json when sending the data.
but when I want to send or receive files

write_file or read_file methods I'm converting to a byte type.
 
@HibritUsta why are you pinging me with that?
 
for the above problem
 
What is a good library for pdf generation?
 
@piRSquared alot?
4
 
5:32 PM
^^ removed for being legacy python specific
 
@Aran-Fey in before "TIL alot"
 
Pointing out alots got too mainstream so these days I'm more interested in nitpicking uses of "noone"
 
omg I can't stop crying
 
Noone reads the documentation? Singer/Songwriter Peter Noone sure is a diligent engineer!
 
5:36 PM
"invisibly tiny"^[citation needed]
 
I definitely feel like, if humans hadn't developed society and we all lived in the canopy, I would be the number one louse egg remover in my tribe
 
lots of protein if you're patient enough
 
#BornInTheWrongTimeline
 
MarlonHenriqueTeixeira see above for things we talk about in this chat room (-:
 
5:50 PM
Cmon guys, with all this discussion on grammatical errors are we forgetting about their, there, and they're?
And not to forget phyton which falls under the realm of typos, but one that some people (damn you!) don't care enough to fix.
 
python*
lol kidding. How long have you been coding cs95 see you a lot in posts
 
Who is your daddy and what does he do?
 
@HibritUsta I'm pretty sure I linked the formatting guide to you and you've just disregarded it
 

« first day (3139 days earlier)      last day (1806 days later) »