« first day (3678 days earlier)      last day (1286 days later) » 
02:00 - 21:0021:00 - 00:00

2:18 AM
cbg all
 
 
3 hours later…
5:46 AM
@AndrasDeak I figured out what the issue was...it wasn't where I though. I had a couple of BOOLEAN NOT NULL CHECK(email_sent IN (0,1)) DEFAULT FALSE, fields in that same table, which I wasn't submitting data for. Apparently, although IWOMM, I guess the version of Linux running on Travis didn't like FALSE - SQLite stores BOOL as 1,0 anyway, and putting the DEFAULT 0 made it happy.
 
 
1 hour later…
6:58 AM
@toonarmycaptain sounds weird to my rubber duck ears
 
7:57 AM
Cbg.
 
8:26 AM
does the jquery ajax function send the data as type json ?
 
9:04 AM
since I was asked for examples on "namespace packages are worth it" a couple of times:
qiskit is a pretty good example of splitting one big namespace into separately maintained sub-packages.
and if it were a proper namespace package, instead of duct taped mess of partial-packages, the past hour of my live could have been spent towards achieving world peace.
 
you mean like ros?
I'm so happy they changed the shorter visualization_msgs::Marker to visualization_msgs::msg::Marker, because who doesn't like to repeat themselves...
 
9:26 AM
probably, so far I haven't had the chance to build any killer robot drones
 
 
1 hour later…
10:40 AM
Hi guys, can someone help me with a small profile like thing that appears in the profile part? A small box with username and badge and other SE sites
like this box small box , Fairly new to SO so I havent got my proper ways here, how do you actually get this?
 
@CoolCloud in your profile settings
It's called a "flair"
on the left among "site settings"
 
@AndrasDeak Thanks a lot, this is fairly new to me
 
 
1 hour later…
12:00 PM
Hey guys I have a really weird thing happening here with the wtforms I have a select field that I am dynamically updating with ajax but when trying to access the data with form.lesson.data I am recieving none however when using dict(form.lesson.choices) I am recieving the data expected and not quite sure why this is
it is printing the choices given but the data is resulting in none
 
12:16 PM
what i am printing is
        print(form.lesson.raw_data)
        print(dict(form.lesson.choices))
the results are:
[]
{6: 'STA - 1 Students: 1/8 14:00:00'}
 
For the record, [] and None are different things
 
yeah well when accessing with form.lesson.data it equates to None
raw_data gets []
 
1:08 PM
without knowing anything about WTForms, I'm decently sure that form.lesson.choices is what you have pre-defined as possible choices, not what some user/script has entered.
 
I don't know anything about WTForms but in my experience, updating the page ajaxily will usually only update the html and not the back end, unless you take extra care to inform the back end as well
So if you have a dollop of javascript that adds new options to your dropdown list, once the user submits, your form object might still think that the dropdown contains only the original options
This doesn't directly explain why your data is entirely None, but it at least tells us that the backend is not infallible. So you have a better idea of which of your assumptions you should be questioning
Unrelated curiosity: a file I was writing to contained incomplete data because I wasn't flushing my streams. Nothing special there, except the data was missing from the beginning of the file and not the end. Never seen that before.
 
Did you work with the file in regular w mode, or did you do some append/truncate/... operations on it?
 
regular w mode. But there are about three layers of 3rd party MemoryStreamRollingFileAppenderHelperBean classes in between me and the real file object, that could be doing silly things to my data.
Were I not on a relatively tight deadline, I would wade through the bog of mystery buffers and get to the bottom of this. But instead I'll have to content myself with calling flush() manually on every flushable object, which fixes the problem
 
1:25 PM
MemoryStreamRollingFileAppenderHelperBean sounds suspiciously as if you should be using a proper language. Like brainfuck.
 
C# is a decent enough language most of the time... My primary complaint is that the C# chat doesn't go out of their way to help me, unlike in here
I gotta, like, cultivate friendships and prove I'm not a buffoon all the time, and stuff. That takes a lot of time.
 
Finally my flask issue got resolved :)
 
That's good. How did you resolve it?
 
I just changed "name = request.form.get('name')" to "username = request.form.get('name')" . I had tried this previously too but that time it didn't work . I don't know how it got resolved this time.
Maybe my luck was better this time ;)
 
1:42 PM
Curious. Well, if it ain't broke,
 
Actually, right on my way to bed it occurred to me that it might not be "make it happy" as much as the comparison being directly between `DEFAULT FALSE` value to `in (1,0)` before coercing that `FALSE` to `0`?
So while you can pass python's `True, False` to sqlite, which it then coerces to 1/0 because strictly speaking it has no `BOOL` type, you need to put the 'actual' default value in the `DEFAULT`? I mean, it works on my machine, it worked on Windows on Appveyor... so maybe an implementation difference?
 
1:55 PM
Well, if it isn't thefourtheye. It's been a while :-)
 
2:14 PM
Vacation at home cbg, all.
 
hello!! anyone up....
 
Aah allergies are driving me mad today
I'mma need winter to come and put all these pesky plants to sleep
 
winter is already here :)
 
Not enough
 
yup.shall I grab some time to take you a look on my issue. I ts related to login into RDP host its giving some port error
 
2:29 PM
What kind of error?
(brb)
 
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner[WinError 10054] An existing connection was forcibly closed by the remote host
this error
 
2:53 PM
hmm
 
morning cabbages folks. How's everyone doing?
 
Tough day at work, but when I get home I can indulge in the spaghetti I cooked and in my internet connection that's 10 times as fast as a few days ago
(at least in theory. My wifi adapter can't go that fast)
 
enjoy your spaghetti! I'm trying not to lose my mind in a data model migration today
 
it's nice to have spaghetti on a plate instead of in a code base for once (:
 
@Kwsswart you might need request.form.getlist("list_name")
Depending on what the field type is. I've just skimmed through sorry. <flies away again>
 
3:07 PM
Btw, if anyone hasn't checked on the available internet plans in a while, you probably should. I got effectively 10 times as much speed for pretty much the same price, and my plan was only 2 or 3 years old
 
Crossing my fingers that none of my users are going to say "the new CSV report looks great! One thing, though, we need the header row to use red text"
No problem, I'll just need to get hired on the Microsoft Excel team and sneak in a css engine without anyone noticing...
 
and then you need to convince your company to update from Office 2010 to the newest version...
 
Just build Excel from the master branch
 
I've already had this conversation twice since the beginning of the assignment:
mgmt: The data looks good, but the styling is a bit basic.
Me: yes, because csv files have no style by definition.
mgmt: well, why don't we use xlsx? You can style those.
Me: the reason we did this redesign to begin with is to replace the existing xlsx implementation with csv, because our users' firewall refuses to allow xlsx downloads.
mgmt: oh yeah. I guess we'll live with unstylishness.
 
Huh. Why would they block xlsx files? If anything, you should block xlsm files, those can contain macros
 
3:22 PM
I'm glad that they're graceful about me refuting their suggestion, I just wish they would write it down
@Aran-Fey Erring on the side of caution, I guess.
 
3:34 PM
does anyone know of a SQL-like language/API/<noun>/<adjective> for python? I'm trying to query a database, but I don't want my SQL query to be a python string in the middle of my code
 
@inspectorG4dget not sure I'm following...
 
typically, if I query a database, I'd do something like this:
query = """SELECT * FROM table WHERE condition"""
with connect(...) as conn:
    with conn.cursor() as cur:
        cur.execute(query)
        result = cur.fetchall()
My queries are usually much longer than that, but you get the point
 
okay... and... what are you trying to get to?
 
when queries do get much larger (as they usually do), it becomes pretty strenuous to look at that query to parse/debug/whatever it. I would much prefer a magical something like this:
query = Query(select="*", from='table', where=cond)
 
you could use SQLAlchemy... but... could be a steep curve if you're not familiar with it...
 
3:43 PM
I don't know if such a thing exists, but with the Django templating language being a thing (I hope I named the correct thing here), I figured this has got to exist... or I'll just be sad that such a thing doesn't exist
 
are you using this in django or similar?
I imagine you might mean the Django ORM there btw...
 
negative. I'm using this in a backend, fronted by a streamlit webapp
@JonClements oh! thanks for the correction
 
@roganjosh hmm will look into it but it is very weird as i have a similar form working perfectly in this route dpaste.com/9ZVUQZZ8W but when implementing it here: dpaste.com/8765LS5BJ it doesn't note not full route as its rather large but thats where it happens and another weird one when printing the form.lesson.data in the first one it prints the expected output and choices prints [] but in the second one
 
hey! this thing is cool. I totally see what you mean by the steep learning curve, but I think it's worth the time investment. Thanks for the tip, @JonClements
 
when printing form.lesson.data it prints None and form.lesson.choices returns the choices in it which is weird
the ajax results are manipulated the same in both which is even weirder
 
3:48 PM
@Aran-Fey mine did not increase in speed but they essentially doubled my data cap for the same price
 
@inspectorG4dget the Django ORM or SQLAlchemy ?
 
@JonClements SQLAlchemy
 
phew... just checking you're looking at the right thing :p
 
reviving an old convo here: Anyone has an idea how to convert bit little-endian to big-endian?
without bin and friends :/
 
4:00 PM
I could do it with eight bit shift operators and a bunch of ANDs, but that's distinctly inelegant
Supporting ints larger than 2^8 would also take some doing
 
@MisterMiyagi because it's not python?
 
All of the suggestions in stackoverflow.com/questions/9144800/… use a loop (either explicit or unrolled) so it seems likely there's no terribly clever and concise arithmetical solution
 
@AndrasDeak because that's weird with padding
 
@MisterMiyagi I'll take your word for it
 
@Kwsswart Possibly due to the fields being of different type e.g. a select dropdown, especially if it supports multiple entries
That's why I was suggesting looking at the underlying form data that gets sent back with request.form.getlist()
 
4:08 PM
How about instead of bin() you use string formatting's binary formatter? That gives you more control over padding.
>>> (lambda x: int(f"{x:08b}"[::-1], 2))(23)
232
 
hmm as far as i know they are the same type atleast as far as i can see having been created the same way displaying in html the same being filled the same way just on different routes with different forms but the forms are fairly similar
 
I'm not seeing what's stopping you from trying my suggestion. Then you will know one way or another
I can't help more than that because I can't run anything. It's only a suggestion, maybe I'm incorrect
The other thing might be how your AJAX populates the forms. Have you checked for typos on the front end?
 
@roganjosh will give it a try got nothing to lose
 
@Kevin yeah, that's similar to what I have right now.
int(f'{number:0{width}b}'[::-1], 2)
 
ooh, nested curly brackets 👀
 
4:15 PM
hm, I should probably rephrase my question "how to represent bit big- and little-endian". As in, are there proper types for that?
@Kevin that's the weird part, yes
 
@Kwsswart The only thing you can be reasomnably confident of is that they're not different by random chance. You really must have introduced some difference between the two forms for them to be behaving differently
Or, nasal demons. Could be those, too
 
I usually use struct and bytes when I need to represent binary-like data, but I don't think either one gives you control over bit order.
 
@roganjosh well the only difference I have implemented is the ajax in this dpaste.com/G4CFTWZBY thats the one working and in order to try make the javascript more readable i did this dpaste.com/EU9ZQTYJJ which is being used with:
run_ajax('#form1', $('#lesson_name'), $('.lesson'), $('#step'), $('#exam'), $('#kid'), $('#age'), type_of)
 
Ha, I was thinking of suggesting "use a big lookup table" as a joke, but the top voted answer actually recommends a translation table (After it recommends not having this problem in the first place)
 
i dont know if this would affect it as the ajax function is being run by 3 different forms on the same page
but it felt redundant to repeat the same function 3 time with the values input slightly differently
 
4:21 PM
@Kevin That's not that far off, since I need to build a permutation matrix, actually.
 
I can already see there that you're updating $('.lesson') - the class- vs the named input. All the rest go off the input name. Is that current?
 
But since there's lots of debugging going on along the way, being able to represent intermediate and individual results would be nice as well.
 
Sensible
 
the class just using to hide and display the label while the lesson_name is the actual field to be populated
 
Also, I realise that I'm commiting the cardinal sin of starting with the Z to my Y problem. :/
 
4:25 PM
You must wear the cone of punishment
 
I imagine a cone with lots of big ; stickered to the side of it :D
 
Unfortunately cones are So In this year so it's not much of a punishment.
 
Link? or does cone have two meanings?
 
@Kevin Can I just eat the scone of punishment instead?
 
Ok. It's getting too complicated for me to follow sorry, @Kwsswart. It's either a typo somewhere or you're not selecting an option from the dropdown. It really wouldn't surprise me if the None just gets parsed out by wtforms from .attr("value", 'None')
 
4:26 PM
Yes, if you also replace the lightbulb in the hard-to-reach Sconce of Punishment
@Hakaishin No citation, I merely declare it to be In because I am the arbiter of fashion
 
@Kevin Is that on some remote mountain top?
 
That would explain why you either get an empty list or the actual None value when you always expected an empty list
 
@roganjosh thanks mate will check to see if this is the case appreciate the attempts mate
 
It's on the second floor of the library and you have to squeeze your arm through the guardrail whose bars are too close together
 
@Kevin that's such a weird and Kevin thing to find fashionable
 
4:29 PM
Cones IN, cylinders OUT, non-orientable surfaces simultaneously IN and OUT
 
So, what I have are two systems representing bit-vectors, both in reverse order to each other – so 1010 in one is 0101 in the other. What the systems represent are superpositions of these bit-vectors as vectors, e.g. [0.25, 0, 0.75, 0] would be 0.25 x 00 + 0.75 x 10. Likewise with matrizes.
 
@edward Please don't ask here with fresh off-topic questions on the main site as per our rules
 
user14596741
ok sorry
 
@MisterMiyagi <3 "matrizes"
 
4:31 PM
Converting between the two means permutating the elements, e.g. [a, b, c, d] in one system is [a, c, b, d] in the other. Because the order is [00, 01, 10, 11] and [00, 10, 01, 11] in the respective system.
And, well, needless to say that is super ugly and fragile. :/
 
@MisterMiyagi sounds like a matrix operation to me
I presume using a vector of bits or nibbles is not an option
 
@AndrasDeak yam, scolded again for mistranslating. I'm on a run this week!
 
Hmm, nibble is 4 bits. Is there a name for 2 bits? "Buts"?
@MisterMiyagi no, I love such native-language related typos :D
it also conveys that you know the plural is "matrices"
 
Matrixen, matri, matripode
A byte and a nibble are also known as an octet and quartet, so the two bit equivalent would presumably be a duet
 
Works for me!
 
4:42 PM
@AndrasDeak I guess so, we're currently working with a permutation matrix. E.g. [[0. 2.] [1. 3.]] for a 2-bit system.
 
Man whoever developed ros2 had no clue how to name things. Like it's ros2 instead of ros and rviz2 instead of rviz, but rqt same as old rqt. this is infuriating. Also there are a dozen datatypes, but only for pointclouds they decided to go with pointclouds2 and not for the others. I miss Pythons level of cleanliness
 
I have a feeling that unless you've got numbers that end up being very large represented as bit strings... more "elegant" ways of doing this aren't actually going to be any more performant than string-formatting etc...
 
You mean it's best to just wrap the ugly in a nice package and not look inside?
That... could actually work for now.
 
I imagine something with bytearrays and buffer and all that might be an option but.... converting even a large integer to a bit string, reversing that and then back to an it is far from slow
 
Don't let a C programmer hear that, they'll get a heart attack
 
4:48 PM
the only think that makes me go slightly ugh with it, is that making a bit-string rep of something just to manipulate feels "dirty"
 
There's a roundtrip from numpy arrays through that bit-string repr and back, in case that affects your feeling of "dirty"
 
I don't consider bit strings inherently bad, you just need to think critically about whether it's worth using
The answer can very well be "yes, it's worth using here" especially when the alternative is eight shifts in a loop
 
How many bits do your ints have @MisterMiyagi? Might have a play with stuff later... but have you got an example input and it's example output ?
 
At the moment, 16'ish bits is the upper bound
Oh my, I might have messed up applying the permutation matrix to matrizes. Given the permutation matrix P, a vector v and matrix M, the translation is Pv=v' and PMP^-1 = M', right?
 
5:04 PM
@MisterMiyagi we need np.uint1
 
Could you (ab)use int.to_bytes and int.from_bytes ?
(might not work for your specific case though)
 
user14596741
Hi guys, you all know me, I've made another account to ask some really dumbish question.
could i ask
 
@JonClements not sure how. bytes always end up as basically lists of integers, which puts me back to square one.
 
user14596741
Guys, If i make a new package in pip then it have some dependencies like sklearn-2.0.0 or something, If some people would install and their system sklearn version is 5.0.0, then how should i make it compatible to all other future sklearn version when people install my packages
 
I'm not sure I understand the question. Is the problem that sklearn 5.0.0 isn't backwards compatible with sklearn 2.0.0?
If so, does your code work with sklearn 5.0.0 or 2.0.0 or both?
 
user14596741
5:18 PM
yes i am talking that backward compatibility, not only sklearn but all other big packages if i used in pip .
 
@edward as in, declare the dependency sklearn>=2.0.0?
 
user14596741
if some packages functions and classes would depreciated and removed in new version like 5.0.0, what would happen?
 
Note that generally, you do not want "compatibility" beyond major versions, since that implies breaking changes. sklearn ~= 2.0 might be adequate.
 
@edward and what was wrong with the old account?
 
user14596741
no, I am alive. I am asking in this account because not to pollute my original account for asking dumb questions.
I see alot of genius people have only one repo in github and dont really ask question and answer only answer and are alot detailed so i made this account
 
5:20 PM
I'd dealing with JSON elements with up to three keys, two of which are "startIndex" and "endIndex: (both optional) and the third, which indicates the element type. Can anyone do better than this to find the object type?
def element_type(se):
    residuals = set(se.keys()) - {"startIndex", "endIndex"}
    assert len(residuals) == 1, "Unexpected key in structuralElement :{!r}".format(
        sorted(se.keys())
    )
    return list(residuals)[0]
 
@edward Well, if your code tries to access them, it'll crash
 
user14596741
so i can i aware if some depreciation had done?
checking all sklearn functions step by step, and look if it depretiated is tedioustack
 
@holdenweb the third key is an arbitrary one, correct?
@edward if you do not want to check manually, the only alternative is to do so automatically. A good suite of unittests should have you covered for that.
Make releases for major versions known to be good, and test compatibility when new major versions are released.
 
def element_type(se):
    residuals = {'startIndex', 'endIndex'}.symmetric_difference(se)
    assert len(residuals) == 1
    return residuals.pop()
@holdenweb maybe something like ^^^ ?
 
user14596741
oh thank you @MisterMiyagi , i should now look how to make unit tests.
 
5:28 PM
@holdenweb You can exploit that keys are already set-like. Compare {'a': 0, 'b': 1, 'c': 2}.keys() - {'a', 'b'}
 
user14596741
Thank you guys bye
 
@MisterMiyagi Yup.
@JonClements Yeah, forgot abot pop - thanks!
@MisterMiyagi So I can omit the set() call? Cool!
@JonClements One could program ints to bitstrings to run much more quickly in a C extension, with direct access to the representation.
 
@holdenweb yup... or as I've done, take advantage that set.symmetric difference takes any iterable as its input which in the case of a dict is its keys anyway
 
@JonClements symmetric_difference is cute!
Unfortunately it fails because the optional keys appear in the result when they don't appear in the element ... :-(
 
oh... mocked up example?
 
5:42 PM
As in {'startIndex', 'endIndex'}.symmetric_difference({'Puppy': 'Jon'}.keys())?
 
Ahh... I missed the both optional bit... sighs
for some reason I was thinking it had to be those 2 and exactly one other... must be getting near end of the day or something :p
yeah... so stick with residuals = se.keys() - {'startIndex', 'endIndex'} as suggested
 
user14596741
Guys, while doing work in jobs in python,
Do you make all things in classes or make seperate functions,
How do you cope with it whether to make functions or classes
 
seems an odd way of presenting data though... instead of having a single left over key being the type, you'd have thought there'd be a type or similar key whose value was the type... :p
 
user14596741
Excepts some tutorial what is official way of making pip packages.
 
@edward The answer to "do you do everything with <subset of language>" is generally "No".
 
5:54 PM
@edward if you go back to your main account will you also stop asking so many weird questions?
 
@edward going through your previous chat history - you're not doing yourself any favours by continuing to ask vague open ended questions with apparently no reason to do so but cause noise... please stop
 
user14596741
I thought you would give me ideas, But thankyou for this @JonClements
 
6:10 PM
So, have you guys ever tried to enforce type checking at runtime?
 
assert(isinstance(myObj, typeICareAbout)) is one way to do it
 
Yeah, there are also some decorators...
When he type is specified, the "assert()" approach seems to violate DRY
 
Why does it violate DRY?
 
a quick google search brought up pydantic - might be worth looking into. I know that pystitia can also do this
 
@inspectorG4dget nooo
 
6:19 PM
As in, this is on top of mypy or something?
 
Assertions are like tests. You don't use them for validating runtime input. Assertions can be disabled with a switch in prod.
 
@Mikhail yeah. then I stopped doing it again.
 
It violates DRY because you're specifying 1) the type in the function signature 2) the type at the assert statement
This looks nifty:
11
A: Python >=3.5: Checking type annotation at runtime

aravindsagarI was looking for something similar and found the library typeguard. This can automatically do runtime type checks wherever you want. Checking types directly as in the question is also supported. From the docs, from typeguard import check_type # Raises TypeError if there's a problem check_type(...

 
@Mikhail one of those is not like the other
 
Well that's why I mentioned mypy, Mikhail
 
6:21 PM
type in the function signature is homeopathy
 
At minimum the type in the signature is good documentation, with mypy it has some static analysis capabilities.
 
I think people can leverage arguments against different methods of type checking but I don't think it violates DRY, specifically, to have both
 
Somehow repeating the type specification is repeating yourself?
 
it is most certainly a waste. Type checking doesn't make much sense beyond static types, and then you might as well not do it at runtime.
 
Maybe I misunderstand static type checking, but I have a library like this (super-simplified)
class Vehicle:

    def __init__(self, capacity):
        self.capacity = capacity

class Problem:

    def __init__(self):
        self.vehicles = []

    def add_vehicle(vehicle):
        self.vehicles.append(vehicle)
At any time during a continuous loop, someone using that library might have a new vehicle come online that I want to add to an instance of a Problem. I can't statically-type-check that what they add with add_vehicle is an instance of a Vehicle if the code is already running?
So the static type checking might make sure that I don't make the library itself inconsistent in its various interfaces, but I can't cover the case where a problem evolves during an event loop... can I?
 
6:30 PM
you can re-use the annotations from static type checking for runtime type checking as well.
 
Ok, then that's news for me
 
@roganjosh the functools.singledispatch is a useful example, though it does not do type checking in the sense of verification.
 
Well without any magic libraries you'd need to to have an isinstance which you'd need to manually match to the type (hence the complaints about DRY)...
 
@Mikhail it is actually pretty easy to write a decorator to perform type-checking.
The tricky part is to define type-checking itself, e.g. what it means for [] to be a list[dict[str, int | float]].
 
@MisterMiyagi indeed, you have shown (and opened my eyes to) that one before. I guess I haven't connected the dots, I'll revisit the code
 
6:39 PM
@Mikhail Note: static typing. mypy is not concerned with enforcing types at run-time, focusing mostly on issues that can be deduced simply from examination of the source.
 
I'm extremely confused
I'm changing the slider, but the arrow is not moving:
If anyone can help, that would be greatly appreciated
 
I might be looking at crap examples, but the singledispatch code definitely looks like you end up typing a whole lot more and it seems easier to say if not isinstance(obj, the_one_thing_i_will_accept) than make different handlers (in this instance)
 
singledispatch is most useful to keep the function extensible.
 
@roganjosh Sorry, but I don't see that in my code
 
When you have an if..elif..else inside the function, you cannot go back and change it from the outside.
 
6:44 PM
@DarkRunner there are multiple discussions going on :)
 
Got it, thanks
 
@AndrasDeak oh?! how come?
 
@MisterMiyagi Are you referring to my code?
 
If anyone can help me with my code, that would be great.
 
6:45 PM
@DarkRunner as far as I can tell, none of the sliders do anything.
 
I've been working on it for hours, but to no avail
 
@DarkRunner no, he is referring to my response to him that also wasn't to you. I'm sure people will ping you directly if it's about your problem. You just happened to join in the middle of another discussion
 
@MisterMiyagi The first slider is supposed to change the angle of the green arrow
But it doesn't and I don't know why
 
And actually, I'm not sure what this has to do with python, @DarkRunner?
 
@roganjosh It's the visual module of Python, also known as VPython or Glowscript
@roganjosh vpython.org
 
6:47 PM
Ok. So won't you need to include some code if something isn't working?
 
I did (the link is above)
 
@DarkRunner As said, none of the sliders do anything. It doesn't help that the "same" slider can be duplicated by clicking a category multiple times, with each instance having separate values.
So your sliders do not appear to have a direct correspondence to some well-defined state in the program.
 
@MisterMiyagi My goal is this: Link the angle of the Arrow WRT to Horizontal to the value of the first slider ("Relative Velocity is")
The first slider's value is given by vel_A.value
 
@roganjosh A good application for singledispatch would serialisation akin to JSON. For each custom type one could just register a new overload to make it serialisable.
 
Then on Line 59, I do pointer.rotate(angle = vel_A.value) to rotate the arrow
 
@MisterMiyagi I don't see what I'm doing wrong. I've linked the Arrow to the Slider, no?
 
@DarkRunner can you please stop pinging people
 
You've appeared in the room with a problem, in the middle of several other discussions. It wasn't clear to me that I needed to then go through other steps to actually find the code to see your problem. MisterMiyagi gave you a broad overview of the problem. Nobody here has to help. Please be patient while people review what was posted and they will get back to you if they feel able to help further
 
@DarkRunner I don't see how the code can even reach that point. angle appears to be undefined for line 58 while angle != vel_A.value:.
 
6:54 PM
@roganjosh Please understand that I've been working on this code for hours, but to no avail. Google didn't help, and neither did Docs. I understand others may be busy, but I hope someone will be able to provide me some assistance with this, as I'm very anxious to find the solution. Thank you.
 
I am very aware of that; many of us are also working for hours (or in my case, the last 3 days) on a problem. Everyone here is happy to help where possible, just please don't try to push your issue above others
 
OK, let me look into that. Thanks @roganjosh
@MisterMiyagi OK, I removed that line. How do I actually rotate the arrow based on the slider? It's just not working, even though I do pointer.rotate(angle = rotationConst)
 
erm, let's just assume for a moment that I'm not intimately familiar with those 100 lines of code, yes? ;)
at a glance, I don't see S waiting for input.
so it likely just draws everything once with the default value of the slider, then stops before the user can change the input.
 
Hm, interesting idea. Let me try putting a middleman variable
Wow. I'm stuck
OK, so I got something
If you change angleChange = .55 in rotationConst = degrees(atan(((angleChange)*(speedOfC))/speedOfC)), it rotates the arrow!
Now here's the thing: that angleChange variable is literally the value of the slider.
@MisterMiyagi But when I let angleChange = vel_A.value, nothing happens when I change the slider.
Any ideas?
 
7:35 PM
Hey all! I edited this Enum based question to be non-opinion based. Please help reopen it. :)
0
Q: Is storing and accessing functions a good use-case for Enum?

GGGuserI use Enum classes to explicitly show possible values of argument. It is nice and concise. However, when I am accessing one Enum from another it stars to look unpythonic: Functions[day.value].value. The fact that I need to pass and retrieve the value attribute of Enum adds complexity. How can thi...

 
"it likely just draws everything once with the default value of the slider," sounds exactly right to me. The code that positions the arrow executes at lightning speed before the user can do anything, and by the time the slider is interactible, it never tries to update anything again
I'm guessing that for i in range (0,100) loop is supposed to make the code continue executing for 100 frames. But 100 frames is, like, 1.4 seconds. And it doesn't make sense to create a new slider every frame, because they'll just pile up
I'm not sure if you guys see 300 sliders on your screen, but it's what I see on mine
 
@MisterMiyagi Sorry, popped out. Ok, yeah, now I see the implementation for something very similar; the PEP says "The original function decorated with @singledispatch is registered for the base object type, which means it is used if no better implementation is found." so it reduces to just my original case but I can see how it's more extensible. Thanks :)
 
Compare your program to glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/…, which has almost nothing inside its loop. All the sliders and stuff are created once
 
@DarkRunner I have a feeling we are not getting anywhere here. Do you understand what I meant with " stops before the user can change the input"?
 
7:57 PM
@MisterMiyagi closed
 
@EthanFurman done
 
@Andras, et al -- thank you very much. :)
 
anytime :)
 
AAB
Hi all,
I have sqlite3 DB
I am trying to store the price history for now
 
8:09 PM
And are you calling the connection's commit() method after you write to the DB?
 
AAB
anyway I can limit the entries
 
(Maybe you don't need to with slite3?)
 
AAB
for eg say I have entries as follows prod_name, website_name, date, price
 
@holdenweb Lol, I think that's become like the old doctors' reflex test tapping joints with that old mini hammer. You passed :)
 
@AAB "Entries" meaning columns in a table?
 
AAB
8:11 PM
I don't want to insert more than 10 entries for prod_name,website_name
rows
@holdenweb rows
 
Anyway AAB, please finish your question. It might be better just to group it together into fewer posts
 
AAB
@roganjosh Yes sure
I have a table with columns prod_name,website_name, date, price fields. I want to limit the number of Inserts for prod_name, website_name to say 10 rows only. Say I already have 10 entries I remove the entry with the oldest date and insert a new one and maintain the 10 rows only.
 
Called it, I had the dupe ready: here
 
AAB
@roganjosh so insert normally without checks and run another query for delete to maintain the latest records by date.
 
That, or keep only the last 9 and then write over the new entry to history
I suppose the former is slightly better because you don't delete something until the new write has already been successful
 
AAB
8:21 PM
@roganjosh 'keep only the last 9 and then write over the new entry to history' how do I do that
??
 
@AAB what's your concern about only maintaining 10 at a time - is it space or something else?
 
Well I'm assuming you have the current data and the history in 2 different tables
 
AAB
@roganjosh @JonClements no not the case I am just building a hobby app to store price history.
 
@AAB so just store it - only ever take the latest 10 based on date and worry about pruning it later if really needed?
 
I'm not sure the fact that it's a hobby project answers either of our questions
 
AAB
8:23 PM
My plan was to insert only if price changes and store only the last 10 changes
 
seems you're over thinking it tbh... just store everything (even if not changed) - that way you've got a complete history which you can worry about later if it grows large
I'd start with that and worry about the rest later
 
AAB
@roganjosh @JonClements a reason for storing 10 entries only is to save costs if I host it on one of the managed databases they charge for the GB usage as well
 
@AAB you'd probably have to have a million odd rows to even get close to that - is that even something to worry about at the moment?
 
AAB
@JonClements the data I scraped from the 4 sites is close to 26000 products
 
just seems you're jumping at an infrastructure problem before you even know if it's an issue
@AAB which in the grand scheme of things is a drop in the ocean for even the most meagre of databases
 
AAB
8:27 PM
so say I have 10 rows per product for price change the number goes very big very soon. I do agree that price changes may happen monthly and it might be over a year before I need to worry about each product having 10-20 rows of price change.
@JonClements @roganjosh would your advice be that I build and deploy first and then worry about such issues if they occur?
 
let me put it this way... I've done for a client a scraper that does overall from 6 sites, 270k products and price updates every single day... their system is only 25gb of disk (and it costs them $5/mth) - we keep only the last 2 years worth of data and the system's never gone beyond 20gb for DB usage - then it's a very simple case of archiving YEAR() - 3, then a one off query to remove that year's data... keeps it simple
 
@AAB I tend not to approach things like that but then, that's me. I've had this debate in other areas about how, as soon as I need a Flask access management system, I drop the full-blown approach in from the start. People disagreed with me, I don't really care because the world doesn't end either way and we're bound to see things differently when it comes to this kind of stuff
I'll begrudgingly spend up to several days up-front to get something that I'm pretty confident that I can just copy/paste between all future projects that vaguely have the same issue on the assumption it will become a problem again, and I don't like retro-fitting solutions
 
(and also if something crops up - you can go back... as it might turn out that actually - 20 historic prices is more useful for proper analysis than 10 is... but if you start with 10 - you've cut yourself off from that option)
My rule of thumb is: prefer to store too much - work out what's definitely not of use and drop that... and then as you spend time with the system and how it ends up being used, you can refine it further again...
 
AAB
@JonClements thanks for the example seems like I am worrying about the wrong things for now.
also the hosting fee you mention is too less
which managed DB is this?
:P
 
why do you need a manage one - just spin up your own postgres instance on a DO droplet or something... again... are you really sure you need a managed DB right now?
 
AAB
8:38 PM
@roganjosh @JonClements to be honest I am not sure if I am going things the right way I have spent too much time thinking about a few things let me give an example,
the products I scrape may have different names in different sites but from what I see from running a few queries it seems as though the names are like an 80% match +- a few extra words in the product name
I spent a lot of fo time wondering If I should find a way to aggregate all these names and then store in the DB,
 
@AAB yup sounds like you're doing what I did a while back... identifying identical products either by sku/ean/gtin if it's available from the site and otherwise falling back to a bit of confidence matching on names...
 
AAB
its like each thing I do I have so many questions on how should I proceed or move ahead
 
you're in for an interesting time - that's for sure! :)
 
AAB
@JonClements is doing the same necessary the places I scrape I cant find the SKU or partID
the best I felt I can do was use difflib to check if strings are a 60-80% match if so combine
and then a part of me just screams and yell idiot just store in different rows you anyway won't cross more than 50k products this way why bother.
 
that's a tricky part... double check there's not part numbers/skus etc somewhere in the source html as data attributes etc... just 'cos they're not visible on a page doesn't mean they're not actually available :)
 
AAB
8:44 PM
It's like I spend more time thinking about what to do than actually going ahead and doing it.
 
(and depending on the sites - there's a few times it's possible to catch it doing some ajax'y stuff... and go directly to that - or otherwise, it might include some json-ld data in the page that gives away more about stuff than is directly shown)
 
AAB
@JonClements I checked they don't :P
 
@AAB a balance between those two is good... if you don't spend time thinking and just go for it - you're likely to end up just wasting your time and getting nowhere... and if you spend too much time thinking, you'll likely to not actually end up doing anything
So your current example about 10 rows only... the thought process might be something like realising that might just be a limitation, but until you discover it is, or isn't, just to get enough done to start storing the data so you can even reach a 10 limit to start with...
 
AAB
@JonClements true I need to learn how do I finalize something and go ahead with it. Yes even I feel it may be a year before I get to 10 rows for a website+product
the reason I went for a managed DB was that I felt they would be better secured than the one I spin up.
 
Secured against what? All your data is just taken from other websites
 
AAB
8:52 PM
@roganjosh true :P
but if they gain access using a security flaw won't they be able to run anything on the instance? like say may be some crypto miner or some script which try to crash some other website?
 
But where is your actual code running from?
 
AAB
again I am probably just going nuts and overthinking.
 
managed instances involve things like automatic backups and failover... you probably don't need that at the moment
 
AAB
@roganjosh for now I am using a heroku instance/dyno free-tier
 
I would just stick with SQLite for now, if I'm honest. I <3 postgres but you're talking much lower volumes of data, and seemingly no need for multiple writers.
 
8:56 PM
A cheap solution (doesn't handle backups/failover automatically) is to spin up a very cheap instance of something somewhere with SSH key for its root (no password), make sure you set 2FA up for it's control panel access, then install your DB that listens only locally on that server, and tunnel over SSH to that instance so the system doing things can access it like it was local
anyway... bbiab
 
Lol, like ships in the night. Now I'm advocating SQLite when I was first talking about extensible approaches, and Jon's going to 2FA instances of DBs. I think we're not going to get anywhere useful here tbh
 
02:00 - 21:0021:00 - 00:00

« first day (3678 days earlier)      last day (1286 days later) »