|
More primitive than I realized, It's really just a vec. List comprehension always flew over my head in skool so may have hyped them up. Still, it should just be deleting and shifting pointers, cache-friendly stuff, and gc cleans up later. Scratching my head as to how that could ever be too slow.
|
# ? Feb 2, 2023 03:32 |
|
|
# ? May 15, 2024 02:56 |
|
Something being cheap doesn't mean it's literally free, if it's trivial to do and gives you a literal 100x speedup (supposing you're deleting 100 items off the front) then it's just good practice to do it right.
|
# ? Feb 2, 2023 03:49 |
|
Yeah I see it now, even outside of python. It's a problem in isolation still, a homework problem, when there would generally be a better solution in upstream implementation. Use a data structure that trivializes what's needed instead of trying to optimize a primitive to do the same. Also apparently for loops are universally faster than while in python. I'm spoiled by good compilers. Got me on a fun tangent of vecs with padded allocation on both ends and a floating zero index, and now resizing strategy. Not a new idea I guess
|
# ? Feb 2, 2023 04:40 |
|
Ranzear posted:Got me on a fun tangent of vecs with padded allocation on both ends and a floating zero index, and now resizing strategy. Not a new idea I guess A typical implementation of this is called a Deque, and it's basically a ring buffer.
|
# ? Feb 2, 2023 04:43 |
|
Deque wouldn't have the random access, hence VecDeque is a thing too. All still a little more complex than double padding.
|
# ? Feb 2, 2023 05:37 |
|
It's a while since I touched Python in anger but it seems surprising that they allow you to modify a list while iterating over it.
|
# ? Feb 2, 2023 09:04 |
|
edit: taking this to the SQL thread, that I just noticed. sorry
Defenestrategy fucked around with this message at 23:12 on Feb 2, 2023 |
# ? Feb 2, 2023 23:08 |
|
Ranzear posted:Also apparently for loops are universally faster than while in python. The gently caress? Python, explain yourself.
|
# ? Feb 3, 2023 11:43 |
|
Volmarias posted:The gently caress? Python, explain yourself. I mean, this is going to depend on the implementation. For your "standard" interpreted python, it's because a while loop involves running interpreted python code to check the loop condition, while the for loop just makes a single call into the native code backing the iterator. If the iterator you're looping over is not one of the builtin ones (or from a similar library with a native implementation backing it), then it's probably not much difference.
|
# ? Feb 3, 2023 11:53 |
|
Does anyone have a Lua editor suggestion for MacOS? Free preferably, I like Sublime, but I am cheap.
|
# ? Feb 4, 2023 02:27 |
|
VS Code is the only true text editor
|
# ? Feb 4, 2023 06:41 |
|
KillHour posted:VS Code is the only true text editor Thank you. That is what the Mac software thread recommended as well and what I am using currently.
|
# ? Feb 4, 2023 20:49 |
|
KillHour posted:VS Code is the only true text editor
|
# ? Feb 5, 2023 00:51 |
|
Speaking of text editors, I have now given automatic quotes in RStudio a very proper chance, over multiple years, and I will be turning them off from now on. Just the sheer number of times I've done something like this: code:
Actual times it has saved me a keypress? I don't know, zero? Computer viking fucked around with this message at 01:07 on Feb 5, 2023 |
# ? Feb 5, 2023 01:04 |
|
Can’t you select the word and hit “ ?
|
# ? Feb 5, 2023 01:20 |
|
yeah but imagine remembering that instead of only ever doing that on accident when you want to replace the text with " instead
|
# ? Feb 5, 2023 01:22 |
|
|
# ? Feb 5, 2023 08:28 |
|
As a vim user of about 20 years, don't recommend self harm. The world moved away from modal editors. Being dependent on them is not good.
|
# ? Feb 5, 2023 14:48 |
|
Also, testing it now it seems like quote-in-front just works like normal, so it's not quite as bad as I made it out to be.
|
# ? Feb 5, 2023 16:22 |
|
I work with someone who, let's say has been in the industry for a while. Sitting on a screen share and watching him slowly edit code in a full screen terminal with only keyboard shortcuts and no intellisense and have to exit every time he wants to test it is INCREDIBLY painful.
|
# ? Feb 5, 2023 17:19 |
A few weeks ago I blew a coworker's mind by casually using multicursor editing in VSCode.
|
|
# ? Feb 5, 2023 17:26 |
|
KillHour posted:I work with someone who, let's say has been in the industry for a while. I'm working on a project so big that intellisense doesn't even work (in a good enough timeframe, that is) most of the time
|
# ? Feb 5, 2023 18:34 |
|
KillHour posted:no intellisense and have to exit every time he wants to test it is INCREDIBLY painful. ok but vim definitely has lsp plugins and the like, your coworker just has a lovely 15 year old configuration like vscode does c/c++ completion just by calling out over a standardized api to clangd, vim does the exact same thing
|
# ? Feb 5, 2023 20:06 |
|
I thought the C++ extension for VSCode actually uses Intellisense and not LSP? At least that's how I remember it being marketed as. Also, why would you need to exit in order to test? Just create a new terminal tab.
|
# ? Feb 5, 2023 20:45 |
|
in the absence of LSP, ^Zing vim and foregrounding has always been the optimal test-code loop strategy imho
|
# ? Feb 5, 2023 20:47 |
|
You can also just invoke your build task directly from inside vim.
|
# ? Feb 6, 2023 01:28 |
|
nielsm posted:A few weeks ago I blew a coworker's mind by casually using multicursor editing in VSCode. ... Huh. I didn't realize this was even a thing, I usually just did search/replace with regex. TIL, thanks!
|
# ? Feb 6, 2023 21:03 |
|
I use emacs, VScode and Visual Studio Community 2019, depending on workstation. And sometimes notepad++, plain old notepad also gets used more often than I would've thought... I most recently started using emacs at home on a debian vm since I wanted to try something different while also learning C and not lean too hard on an IDE to help me along. I am not sure I like it or not yet but it's difficult to say if something is bad, or I am just used to doing things differently. I currently have an emacs window and a terminal window next to it for testing code, works well enough. Though emacs can run a shell or terminal inside it but I didn't explore that much.
|
# ? Feb 8, 2023 09:31 |
|
Remote editing with emacs (tramp) is cool if you have unmanaged servers that need config changes. If you need to edit a 10 gig file, emacs can do it while VS Code almost certainly can't.
|
# ? Feb 8, 2023 14:04 |
|
I'm trying to figure out the potential architecture for this problem - I have a filesystem in the cloud (AWS EFS, Azure VM) which I need to be able to browse in a React front-end (present a directory tree). The back-end is Java/Spring. I would like to not give the keys to the front-end to browse the filesystem directly (plus I'd like to abstract out the type connection type (AWS, Azure, etc)). I have a rest layer, a persistence layer, services layer, etc. to work with. I'd prefer using REST, but doing rest calls to build a directory tree sounds buggy and would present latency issues - though I could rely on React to worry about state, I suppose, so maybe it's not so bad. I'm hesitant to store every file within the persistence layer because only 10% of the files will be relevant to getting deeper info. In other words, there'd be potentially tons of garbage data bogging down the database.
|
# ? Feb 9, 2023 14:18 |
|
Anyone have any experience with EventStoreDB and event sourcing in general? I just recently learned about the concept and am intrigued. I almost implemented this pattern a couple of times when my customers required tracking of events in a business sense and I added additional tables for that with JSON fields but it never occured to me to derive the complete state from that witha left fold
|
# ? Feb 9, 2023 18:47 |
|
hey mom its 420 posted:Anyone have any experience with EventStoreDB and event sourcing in general? I just recently learned about the concept and am intrigued. You're in luck! There was a recent discussion about event sourcing (and how it kinda sucks) over in the terrible programming thread. Starts on this page.
|
# ? Feb 9, 2023 20:38 |
|
It's a conceptually cool design pattern that is either so intrinsic to your domain that you have no other choice than to use it, or its "probably a bad idea". I think most people overstate how bad of an idea is, but the simple truth is, it will probably be easier to fit your solution inside a normal database with a normal architecture. If you need this for work, you can bolt on some of the useful aspects of it later without having to fundamentally redesign your app by just having an events table or a versions table. paper_trail (rails) is a good example of this. If you want to mess around with it for learning purposes, I would recommend message-db.
|
# ? Feb 9, 2023 22:08 |
|
I'm not a programmer by day but I've been self-learning over the past couple years and am at a point where I want to build something in my field that I and hopefully others would use. I essentially want a single page web front-end to access and browse a specific data set in a more user-friendly way than what is currently on the market. Nothing ground-breaking, but I know at least a few colleagues who would be happy to see this completed and I would use it daily, which is good enough for me! The data is hierarchical with various/unknown levels of nesting in each element. I'm familiar with mongodb atlas and was initially excited that I could stick with mongodb for this, but the data is only available as a bulk download xml file. I'm at a decision point regarding what to do with the bulk data, and this is where my inexperience is showing. For a cloud based solution, it seems I could: 1. Write a script to convert the xml into JSON and use mongodb. The data is around 100mb, doesn't change super often, so I would only need to convert on a periodic basis. 2. Use a native XML database like Oracle XML through AWS. 3. Use a relational database with XML / Xquery support. Leaning towards option 1 as it lets me use the stack that I already know, but I'm wondering if converting from the source format is too hacky.
|
# ? Feb 10, 2023 05:39 |
|
100mb of data is nothing. I’m not a huge mongo fan (got bit by it early by no choice of my own) but if it’s not critical and your familiar with it go for option 1. Hell with 100mb of you could just have an in memory store. It’s such a small amount of data how you use it is unlikely to really matter, since it’s a read small set of data.
|
# ? Feb 10, 2023 06:03 |
|
XPATH expressions and XSLT to convert to XHTML
|
# ? Feb 10, 2023 06:08 |
|
Thanks, I'll take a look! Yeah it seems like one of those ideas that sound great on paper but you just have a feeling there will be a lot of problems of the unknown unknown kind later on.
|
# ? Feb 10, 2023 09:35 |
|
necrotic posted:Hell with 100mb of you could just have an in memory store. It’s such a small amount of data how you use it is unlikely to really matter, since it’s a read small set of data.
|
# ? Feb 10, 2023 16:42 |
|
Use sqlite
|
# ? Feb 10, 2023 17:16 |
|
|
# ? May 15, 2024 02:56 |
|
Node JS / Typescript question. I want to make a hash table with Map<string, T> and my type T has a composite primary key made up of 4 properties. I don't want to just concat these together, because I want to avoid a situation like "var" + "sval" == "vars" + "val", and I don't want to stick in some special character and blindly assume that the properties won't contain those values. The approach that comes to mind is to generate an MD5 hash for each property and then combine them in a safe way, similar to boost::hash_combine in C++. But the problem is I can't find a Node package that does this. I feel like there has to be something out there for this kind of problem, right? Edit: I guess I could generate a JSON-encoded array out of the 4 keys, making sure the properties are always in a consistent order, and hash that. No possible value should be able to break it since it would all be escaped. But that just feels ugly for some reason. KillHour fucked around with this message at 01:32 on Feb 13, 2023 |
# ? Feb 13, 2023 01:29 |