@roganjosh Fair enough on executemany only being intended for multiple actions on one table. But for some of those, I also need to enter data in another table, then put the primary key in the row in the other table. I can pass tuples to actions in the first table, then the second, then pass back over the first entering the missing values. I don't know if it's generally worth that complexity though. Thanks.
I have a query, I have a python UDP client. The box has multiple network interface, how do I ensure the packet goes out of a specific interface, say eth1. Any clue ?
I am a newbie to python sockets, any help will be appreciated. Thanks.
@toonarmycaptain it isn't. You can cheat and get the ID of one row inserted into the table, and then just assume that the foreign key is a contiguous block of ints in the range of that ID to that ID +list length. Then watch it all crumble as soon as you have concurrent users :P
@ArunodoyDasGupta Listening on IPv4 address 0.0.0.0 instructs the network layer to listen on all available interfaces.
Normally you let the network layer worry about routing - why do you need to send from a specific interface?
The destination IP address determines which interface is used for the outbound packet. Most systems just have a "default gateway" (their router), through which all non-local (different IP network) traffic is routed.
Psychologists have been studying the effects of text presentation methods on comprehension and speed for decades, and the information presented by W3C is based on that research. Tons of research has repeatedly concluded that information from surrounding lines of text can interfere with reading speed and efficiency, suggesting additional spacing between lines of text is valuable. That's not even just for people with cognitive disabilities, who struggle more than usual. It is true of everyone. Stop attacking the research angle while presenting nothing of your own. We're done talking about this. — animuson ♦12 hours ago
heh
@roganjosh "6-8 weeks" is a meme for "whenever the company decides to do something, if ever"
@hkotsubo We're listening to the feedback we're getting about it. We are not listening to people who are simply stating "the research is nonsense" because that is not constructive to any discussion here. (The comments doing so have been deleted here, but my comment remains to deter people continuing to bash research instead of offering constructive opinions.) — animuson ♦11 hours ago
I guess I'm an oddball because I find it much harder to read on mobile
@holdenweb i fixed it, thanks for anyway. i just put the old elements in a list and then cleared the list just before writing the new elements. now it works perfectly.
Mmm, well, technically they are pushing it by making it the default. You'd think I would know how to override their style, but I don't. It's at least 30 mins of effort to understand how to do that, and typing my frustration doesn't take nearly as long
@AndrasDeak Yes, but you don't increase diversity by appealing to either the majority or to minorities unless there's an element of choice. UI styles can be a matter of user choice, but most UIs don't give the user much choice, or make it easy to configure the necessary options.
@OldTinfoil Cleaning up after people's random illusions of grandeur is my job. I have little desire to fiddle with every little knob off the clock as well.
When I was at Tesco they had a board in our office for "days since last unicycle accident". I thought it was a joke... nope. One of the guys had a unicycle and they used to all practice in the car park at lunch
@holdenweb It is a private OS based on Free BSD, the node is packet listening device (Proprietory h/w), it acts as a bump in the network. Such boxs are used by service provider to implement regulatory packet dissection. There are multiple interfaces and most of them are for customer data to flow. Its own packet should not use those. Hence the question
user13415013
10:27
yes @roganjosh, i think i have somehow solved the problem
Probably. I think the trick is in catchy titles "You won't BELIEVE what this guy does. He had NO CHOICE but to be flabbergasted by his own decisions". You get that suggestion for free
@roganjosh That library would need it's own twitter promoting the streams...
Thinking out loud...if I make several inserts as part of an executemany, then take that cursor's lastrowid, those inserts should be sequential, right? Or can multiple cursors be inserting at once such that each of their inserts won't have immediately sequential ids, despite being part of a single executemany?
Or is that dreaming in that sqlite might optimise and those INSERTS might not be in the sequence one would expect?
@toonarmycaptain it isn't. You can cheat and get the ID of one row inserted into the table, and then just assume that the foreign key is a contiguous block of ints in the range of that ID to that ID +list length. Then watch it all crumble as soon as you have concurrent users :P
With SQLite I don't think it's possible because the transaction would lock the database for writes
For 5 seconds (the default) and that's quite a long time. But if you upgrade to anything else, I don't know how they process query queues
Fun fact: executemany in psycopg2 just does a load of individual transactions anyway, against sensibility. I'm gonna stress again how silly that line of thought is that I put in the comment, when it's translated to actual implementation
Is there some way to flag edits? I've seen a ~150 rep user adding information not known to them and fluff, e.g. ""not all my code is shown, the rest works fine" and "Thanks for your help."
@roganjosh I figured this was what you meant. I think I need to do some reading on how execute/executemany/cursor.commit all actually relate and function at the db end. My mental model is a little but assumptive and vague.
@toonarmycaptain if it were for postgres you can use extras.execute_batch but I think the bottom line that I'm trying to convey is that your code is as efficient as reasonably possible :)
Duly noted for postgres though :) Assuming psycopg2's implementation of execute_batch isn't borked like it is for executemany. Seems like a lot of wasted network-db time could be saved by making this more intuitive, as I'm sure I'm not the only one with such a conundrum. That said, I'm sure there's reasons all the way down why it doesn't function how I expect.
@ArunodoyDasGupta At my office I had a case where I needed to generate network traffic as if it came from many different clients, so I created a number of pseudo-interfaces on a single client, and then spun up multiple test client processes, each using a different outbound interface. The bad news: this test required higher traffic activity than Python could generate, so the code was in C (cribbed from the example code that comes with libnfs).
I've been training similar neural networks my main box using Keras and PyTorch. I'm doing this while browsing the internet, etc. Anybody ever noticed a bunch spurious GPU memory allocation failures with Keras but not PyTorch.
general question about password hashing ,so when a user creates a password the hashfucntion creates a hash of that password , and the hash is then stored in the database insted of the password correct ?
@python_learner I use from werkzeug.security import check_password_hash, generate_password_hash for password hashing. You'll get something like pbkdf2:sha256:50000$t8eIOKts$902feab95d7255c22575b046ddb84aace4fef100f786d6c83747eec9a4bc44f2 where 50000 is the number of iterations and t8eIOKts is the salt
That feeling you get when you spend 3 hours reading web pages Google-translated from Romanian and typing up an informative answer that's much clearer than the lousy Wikipedia page, only to have the question closed out from under you before you can submit...
I feel slightly misled by the beautiful Escher-esque landscapes in Manifold Garden's trailer, because the game itself is about 60% block pushing puzzles in rectangular rooms, and 40% beautiful Escher-esque landscapes in between the puzzles
That Manifold Garden looks interesting... I like that the Steam description starts with "Rediscover gravity" - did we lose it at some point and no-one noticed? :p
Grumps on the Internet might be annoyed that most of The Witness' puzzles aren't particularly integrated into the environment. Like, you'll be walking through a forest, and then there's a metal panel with a puzzle on it.
Woohooo... apparently "Into The Breach" is free on 3rd September... by the guys that did FTL and that was enjoyable enough, and I've read favourable reviews for it, so that's something to look forward to
@AndrasDeak "special kind of mind" - as in the sort that means the rest of society thinks you'll probably be happier in a padded room and a tight fitting jacket? :p
I can understand a grump reading a bunch of reviews gushing about the lush landscape and then finding themselves spending most of their time looking at grids
well anyway I'll ask regardless - say you have loads of files being sent by a client for processing and your using a message queue to buffer the load - is the message separate form the file (i.e. does the file get sotored somewhere else)
i mean do you send the file inside the message to the queue or is the queue just recceiving a marker like an ID for you to locate the file somewhere else
you generally don't want large amount of data in the messages that the queue uses itself and there's generally limits on the total size of a message that can be submitted to a queue... the general approach is you store any significant data elsewhere but with enough info. to retrieve it
@AndrasDeak I've tried a couple games like that, where you need to e.g. bisect an angle or whatever. They tend to be a bit janky in the later levels, where I think I've solved it but accumulated error in the simulation makes it think I'm a tenth of a degree off
I wonder how hard it would be to make a simulation like that, with infinite precision... How would you handle irrationals? Is it even possible to make a line of irrational length with a compass and straightedge?
(supposing you start with a line segment of length 1, for reference)
@erotavlas yeah - it's definitely best to keep the messages themselves as small as possible... if it's maybe a couple of kilobytes or that kind of level, then it's generally not a big deal, but obviously if you've got something like a 20mb image file, you'd definitely store that somewhere and just put a reference to it in the message so that whatever worker picks it up can use that to retrieve the actual data
@JonClements so my company is using queues wrong for sure then, we have an application for processing text based reports and they are putting the entire report into the queue - needless to say they have encountered several times in the past instances where the queue couldn't accept reports over a certain size
@erotavlas yeah - that doesn't sound good... on AWS for instance you'd put the source data in an S3 bucket and then the consumer uses a reference for that object to get the actual content. Amazon SES works for instance is that you can store replies to emails sent, but those replies get stored in S3, and you get (generally via SNS) a notification that you have a reply and some meta data about it, and a link to get the content of the email - that content just isn't sent in the notification