the loop or match statement could possibly be extracted to another function, depending on the situation. rustc will most likely inline it so its zero cost
Oh sorry, I misread what you typed and went on a tangent and just idly typed that in.
One thing you could do for your situation if you’re planning on iterating over some array or vector of items is to use the inbuilt iterators and the chaining syntax. It could look like this
<span style="color:#323232;">let output_array = array.into_iter()
</span><span style="color:#323232;"> .map(|single_item| {
</span><span style="color:#323232;"> // match here if you want to handle exceptions
</span><span style="color:#323232;"> })
</span><span style="color:#323232;"> .collect();
</span>
The collect also only collects results that are Ok(()) leaving you to match errors specifically within the map.
This chaining syntax also allows you to write code that transverses downwards as you perform each operation, rather than transversing to the right via indentation.
It’s not perfect and sometimes it’s felt a bit confusing to know exactly what’s happening at each stage, particularly if you’re trying to debug with something mid way through a chain, but it’s prettier than having say 10 levels of nesting due to iterators, matching results, matching options, ect.
I definitely use that syntax whenever I can. One of the situations where I get stuck with the nested syntax that I shared is when the result of the function call in the for loop affects the inputs for that function call for the next item in the loop. Another is when I am using a heuristic to sort the iterator that I’m looping over such that most of the time I can break from the loop early, which is helpful if the function in the loop is heavy.
It feels like maybe this could be a code structure issue, but within your example what about something like this?
<span style="color:#323232;">fn main(){
</span><span style="color:#323232;"> let mut counter = 0;
</span><span style="color:#323232;"> let output_array = array.into_iter()
</span><span style="color:#323232;"> .map(|single_item| {
</span><span style="color:#323232;"> // breaks the map if the array when trying to access an item past 5
</span><span style="color:#323232;"> if single_item > 5 {
</span><span style="color:#323232;"> break;
</span><span style="color:#323232;"> }
</span><span style="color:#323232;"> })
</span><span style="color:#323232;"> .collect()
</span><span style="color:#323232;"> .map(|single_item| {
</span><span style="color:#323232;"> // increment a variable outside of this scope that's mutable that can be changed by the previous run
</span><span style="color:#323232;"> counter += 1;
</span><span style="color:#323232;"> single_item.function(counter);
</span><span style="color:#323232;"> })
</span><span style="color:#323232;"> .collect();
</span><span style="color:#323232;">}
</span>
Does that kinda syntax work for your workflow? Maybe it’ll require you to either pollute a single map (or similar) with a bunch of checks that you can use to trigger a break though.
Most of the time I’ve been able to find ways to re-write them in this syntax, but I also think that rusts borrowing system although fantastic for confidence in your code makes refactoring an absolute nightmare so often it’s too much of a hassle to rewrite my code with a better syntax.
There is something fascinating about getting a glimpse of how truly complex and incomprehensible the world is. There’s a reason Fire and Water are so hard to replicate with mathematical processors (in CGI)
Aside from the boring story I wasn’t impressed by the 48fps and optical abberations of water when compared to real life. I don’t believe we “figured that shit out” yet.
Pretty sure cameron is playing the long con with this one. We got “Avatar the last Airbender” around the same time “Avatar” came out. The first Avatar was Earth Kingdom. This most recent was Water Kingdom. So it stands to reason the next two are Wind and Fire, right?
I'm trying to wrap my head around "invagination". Like I'm pretty sure I get the general gist of the meaning, but it's really making me realize I don't think I know the etymology of the root word at all...
ChatGPT A preauricular sinus (PAuS) is like a tiny hole near your ear that you’re born with. It can be on one side or both, and sometimes there can be more than one hole on one ear. People have known about these little holes for a long, long time, even before doctors named them. Some artists in the past, like Hieronymous Bosch, drew pictures of them. Doctors later called them preauricular sinuses.
These little ear holes are special because they can be a part of different health conditions that some people have from birth. Think of them like a unique feature, just like how some people have freckles or dimples. So, in modern times, doctors see them as something interesting about a person’s body, but they also check if they might be connected to any health issues.
I barely remember anyone from Reddit. Too many people to ever see any consistent names (except on smaller subs). I see reccuring people on Lemmy pretty frequently though.
What ever happened to making memes just to make someone smile for a moment and not a means to publicize an agenda? We get it, you’re a liberal who hates capitalism. Enough already…
I do not see others laughing. This isn’t exactly funny. How is a CEO getting paid much more than the average worker supposed to make me laugh? This more of a news article snippet than a meme
Since when were memes exclusively meant to make you laugh? Memes have always been a means of societal commentary, think Rage Comics and AdviceAnimals plenty of the most famous ones talk about very real issues.
Even something as simple as the “This is fine” meme could be considered “not funny” in the same way this meme is “not funny” depending on how it’s used.
I am laughing. Because what else can you do, seeing the hell we were born into and will probably stay the same for the rest of our lives. Nothing is going to change and if you weren’t born on top, you’re never going to come out on top. No matter what you tell yourself.
To add this for posterity, there is an additional component to the U.S. autoworkers union striking. In 2008 during the global financial crisis (with things like robosigning foreclosures, predatory loans with ballooning interest rates, etc.), some U.S. automakers were asking for government bailouts, which eventually were granted. These bailouts were entirely taxpayer funded. Now the automakers are refusing to meet union contract negotiations. Automakers not paying employees cost-of-living, or frankly, just salary increases is upsetting, but the additional hypocrisy of U.S. tax-paying citizens bailing out these companies with their own money in 2008, and then not having the companies return some of the wealth in 2023 is enraging.
Edit:
Forgot to add that when the automakers were begging for government bailouts, the automakers had to take away worker pensions and some benefits to “protect the system”. In 2023, the U.S. autoworkers union is fighting to get those benefits back for the workers.
The purpose is to trick the user in to clicking the fake link and waste 5 euro for the fake “survey” with those fake waits and fake countdowns leading ultimately to an error 404
Big Lots, worst pay to effort ratio of anywhere I’ve ever worked. Working harder than I ever have for less than I ever have until I find something else.
That sucks smelly ass, sorry to hear that, maybe try and organize once you have another job lined up? I’ll never forget working the morning shift at hardes, literally the most stressful job I have ever had, for the least pay I have ever made. I got a job at a factory and made twice the salary, but did a quarter of the work, and I had to hear the people I work with denigrate fastfood workers wanting to raise the minimum wage to $10 an hour, cause they thought they worked so much harder and only made $12 an hour. They pit us against eachother while eating caviar from fishes that are going extinct because they are actively poisoning every aspect of our society and our world simultaneously and living in opulence that make the Kings of old look modest. Shits gotta give…
But if you’ve got a clean criminal record look into city jobs. The pay isn’t usually amazing (better than yours though), but the benefits are usually really, really good.
Even in Texas I have never had to pay premiums on medical, dental, and vision for a government job, and my last 2 cities have provided 2:1 matching on my retirement plan at 7% (so I have 21% going towards pension). The guys mowing the parks get the same benefits.
I work in an IT call center and only make 25k. It’s a nightmarish routine of answering calls from customers who don’t believe in your basic right to be respected, answering to employers who believe the same.
At best, it means sysadmin have to support both Linux and windows. You’re going to double everyone’s tools.
This reads like an engineer who is way too invested in using their toolset and thinks everyone else is stupid for not using the same. Like someone who has never worked in management or had to make business decisions. They are looking at it only through a tech viewpoint.
Not only would you need to have an IT team that knew how to manage and support it (which costs money and time) but you then have to train your entire work force which costs insane amounts of time. You would have to do IT training for every new hire for them to even use their computer. That sort of time and training (which takes two employees, the trainer and trainee) costs a lot of money, far more than any OS licensing or end user software costs. Plus the decreased work output while the user to get used to the toolset.
In a software development company, sure, Linux might be a valid option. But it’s not ready for most companies main workforce. And it’s not a technological issue. It’s a human resources issue.
It’s also a tech issue. Linux Desktop is a mess and breaks constantly as soon as you start to tweak it. And every damn plug in is maintained by a few different people with no commitment of backwards compatibility. It’s a disaster and incredibly time intensive to troubleshoot every broken desktop on patches.
Linux is great for running technology services. Linux DE is and has been a disaster for 20 years now.
Wtf is “Linux desktop”? There are more than a dozen different mainstream desktop environments and window managers that have different degrees of maturity, stability and complexity so this blank statement is very hard to support. Not even talking about the servers/prtocols behind it. I can certainly not confirm that experience on Sway, Gnome and Hyprland and with how young the latter is, I would actually expect it to break.
So no, from a technical perspective, Linux is absolutely ready as long as you stick to stable distros and configurations.
GNOME is the king of stability and professionalism, like it or not. KDE is like the GNU car meme, except GNOME is also open source, so KDE has no bragging rights. On top of it, GNOME is the Windows of extension ecosystem, putting cherry on top of the truffle cake.
So you’re purposefully using something you dislike even more than something you call shitty? Really healthy habits there, no wonder you’re a miserable to be around.
I’m actually hoping this place is successful. I don’t think it will be but I’m here for now. You really are inventing an imaginative story from a user name.
Many places support MacOS as well, so it would only be a third additional toolset. Plus, there’s a ton of overlap between toolchains, which reduces the overhead further. If you’re supporting enterprise MacOS, you’re probably using Foreman, JAMF, or Puppet with Active Directory.
Not to mention, a lot of places already have Linux servers, so the configuration management toolchains and expertise may already exist in a given organization, unless they’re absolutely pathologically mired in the Windows ecosystem. Which, granted, is a lot of places, but you’re making it sound far harder than it would be in a real world situation.
At this point I wouldn’t be suprised that some dev companies are taking Microsoft kickback money under the table. There is really no excuse for a game not to work on Linux natively on 2023.
@Rooty@Uluganda you mean apart from the extra work it takes for devs to give support to the platform, a platform where they will get less than 1% of sales.
Steam decks and other deck PCs are rapidly gaining ground, not to mention that steam runs natively on Linux. The “less than 1% marketshare” meme is 20 years old at this point and no longer relevant. Once again, there is no excuse.
@Rooty even 3 - 5% is not worth it for a lot of devs for the amount of time it would take. you must also consider every update also needing the same care taken to it. financially small devs don't have the resources and big devs know it would eat into their profits
I don’t think it neccesarily takes much to make a game compatible, from what I hear at this point it basically just consists of not doing really weird things with your game and not choosing an anti cheat that doesn’t work
By the fact basically every indie game I’ve ever tried has worked flawlessly in proton I’d say there’s no excuse for new triple a games not to
@flashgnash yeah they work in proton... that's not native linux. porting a windows game to native Linux is more trouble that its worth for most devs hence projects like proton
I guess so but I honestly think proton is the way forward for Linux gaming, as far as I can tell they run just as well if not better under proton than on windows
It’s still less than 5%, so unfortunately it’s still at a level they can ignore.
We need more gaming devices that ship with Linux out of the box, like the Steam Deck. Market share is not going to go up only with PC gamers choosing Linux over Windows.
what kind of support mate? jesus I hate this argument. As if publisher do anything out of the ordinary to provide linux compatbility. All the work was done by valve already or is still being done.
Look at no man’s sky and how they in the past have had to patch their game for Linux via proton. It happens, proton is not perfect and it never will be
Well, the thing is that developers need to go out of their way to intentionally break Linux support. The community does 99% of the work in most cases. Launchers, along with anti-cheat are the most egregious.
Anti-cheat I can semi-understand, the developer has to do some work, but popular anti-cheats support Linux no problem.
Launchers, however are 100% useless other than Steam itself, I wish Valve would ban third-party launchers. I wouldn’t be surprised though if some publishers would pull their games from Steam if Valve outright banned them.
lemmy.ml
Top