• 1 Post
  • 10 Comments
Joined 1 year ago
cake
Cake day: May 28th, 2024

help-circle


  • If there’s something you want to search by in a database, you should index it.

    Indexing will create an ordered data structure that will allow much faster queries. If you were looking for the username gazter in an unindexed column, it would have to check literally every username entry. In a table of 1000000 entries it would check 1000000 times.

    In an indexed column it might do something like ask to be pointed to every name beginning with “g”, then of those ask to be pointed to every name with the second letter “a” and so on. It would find out where in the database gazter is by checking only six times.

    Substring matching is much more computationally difficult as it has to pull out each potentially matching value and run it through a function that checks if gazter exists somewhere in that value. Basically if you find yourself doing it you need to come up with a better plan.

    Cartesian explosion would be when your query ends up doing a shit load of redundant work. Like if the query to load this thread were to look up all the posters here, get all their posts, get the threads from those posts and filter on the thread id.




  • it’s pretty good for things that I can eye scan and verify that’s what I would have typed anyway. But I’ve found it suggesting things I wouldn’t remotely permit to things that are “sort of” correct.

    Yeah. I haven’t bothered with it much but the best use I can see of it is just rubber ducking.

    Last time I used it was to asked how to change contrast in a numpy image. It said to multiply each channel by contrast. (I don’t even think this is right and it should be ((original value-128) * contrast) + 128) not original value * contrast as it suggested), but it did remind me I can just run operations on colour channels.

    Wait what’s my point again? Oh yeah, don’t trust anyone that can’t tell you what the output is supposed to do.






  • I don’t know if this something you’re deliberately trying to avoid. Apologies if you are, and I’ve missed the point, but

    I gave up on doing anything in TK years ago. For all the effort to make stuff work in it, you might as well just use flask and have a HTML frontend. That way, you know it’s going to work on everything and includes remote access as a bonus.

    Edit: for a lot more power with a little bit more learning curve, look at fastapi.