Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Ranzear
Jul 25, 2013

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.

Adbot
ADBOT LOVES YOU

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Ranzear
Jul 25, 2013

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

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Ranzear
Jul 25, 2013

Deque wouldn't have the random access, hence VecDeque is a thing too. All still a little more complex than double padding.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
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.

Defenestrategy
Oct 24, 2010

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

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Ranzear posted:

Also apparently for loops are universally faster than while in python.

The gently caress? Python, explain yourself.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Zil
Jun 4, 2011

Satanically Summoned Citrus


Does anyone have a Lua editor suggestion for MacOS? Free preferably, I like Sublime, but I am cheap.

KillHour
Oct 28, 2007


VS Code is the only true text editor

Zil
Jun 4, 2011

Satanically Summoned Citrus


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.

Hadlock
Nov 9, 2004

KillHour posted:

VS Code is the only true text editor

Computer viking
May 30, 2011
Now with less breakage.

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:
install.packages(reshape2
> Oh, I should quote that.
install.packages(reshape2""
> gently caress. Backspace.
install.packages(reshape2
> ffs. Quote right arrow backspace
install.packages(reshape2"
> move to the front of the word and type another quote
install.packages(""reshape2"
> This is helpful, I just need to learn to use it

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

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
Can’t you select the word and hit “ ?

cheetah7071
Oct 20, 2010

honk honk
College Slice
yeah but imagine remembering that instead of only ever doing that on accident when you want to replace the text with " instead

bigperm
Jul 10, 2001
some obscure reference

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

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.

Computer viking
May 30, 2011
Now with less breakage.

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.

KillHour
Oct 28, 2007


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.

nielsm
Jun 1, 2009



A few weeks ago I blew a coworker's mind by casually using multicursor editing in VSCode.

Doktor Avalanche
Dec 30, 2008

KillHour posted:

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.

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

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆

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

qsvui
Aug 23, 2003
some crazy thing
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.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

in the absence of LSP, ^Zing vim and foregrounding has always been the optimal test-code loop strategy imho

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
You can also just invoke your build task directly from inside vim.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

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!

His Divine Shadow
Aug 7, 2000

I'm not a fascist. I'm a priest. Fascists dress up in black and tell people what to do.
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.

spiritual bypass
Feb 19, 2008

Grimey Drawer
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.

mister_gosh
May 24, 2002

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.

hey mom its 420
May 12, 2007

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

necrotic
Aug 2, 2005
I owe my brother big time for this!

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.

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

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.

12 rats tied together
Sep 7, 2006

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. :)

Mush Mushi
Sep 9, 2007
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.

necrotic
Aug 2, 2005
I owe my brother big time for this!
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.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
XPATH expressions and XSLT to convert to XHTML

hey mom its 420
May 12, 2007

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.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

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.
seconding this: if your working set trivially fits into memory, the silliest and simplest thing (loading it into some nested python/ruby/whatever data structure that just sits around waiting to be traversed when requests come in, or whatever) will probably also be the most performant thing too.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Use sqlite

Adbot
ADBOT LOVES YOU

KillHour
Oct 28, 2007


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

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply