Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×

Comment Re:Not enough people that use powershell commentin (Score 1) 110

So... PowerShell is a scripting language with a shell attached?

Obviously not, since the ability to run scripts is disabled by default.

There's a script I need to run on my machine every now and then, and it requires me to log in as admin. Under CMD, I can just launch it with the Ctrl-Shift-Enter trick. Under PowerShell, the way I have to do it is launch the shell and type, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process'

You can also just Ctrl-Shift-Enter PowerShell too. The Set-ExecutionPolicy you are running is not about running as admin, but about running scripts at all. Your example has been limited to just the current Process, so it will not be saved. If you just removed the Scope specifier altogether then it would be saved for the local machine. You would never have to type that in again (although you would still need to Ctrl-Shift-Enter to do administration tasks).

As a shell, it's still bloated, overly complicated, and confusing.

It definitely took a while to really grok the change of mindset when coming from bash. The extra long parameter names annoyed me at the start, until I realised how useful it is to be able to just tab through the parameters on the command line and effectively get documentation as you go because of how descriptive they are. For example, the option to Select-String (aliased to sls for short) for -NotMatch is far more obvious to what it does than grep's -v. However, it is not much different from grep's --invert-match which is the long form of the same parameter.

They also follow a consistent pattern so that once you get to know the way command names work, then you can often just guess what another command will be.

It was also confusing about how the pipeline worked, coming from bash's "everything is text" mentality. But after a while there will be a point where the full power of it will suddenly hit you. Elsewhere here I wrote a two-line script in response to a challenge to someone saying that it would be more bloated than the four-line bash script. (I didn't even try to optimise it - it was just the first way that I thought of doing the task in PowerShell.) But as I was going to post it, I realised that the full power of the shell came from the fact that the script that I wrote was also much more useful just by the nature of how the objects and pipeline worked. I could output my script to other commands to manipulate the files that were listed. To do this in the similar output from the bash script would have required parsing the text to get the filenames back and then looking up the files again.

And the commands that I could pipe my script's output to were the same ones that I used to sort and filter the output of a database query (without having to go query it again) and of an imported CSV file. While PowerShell being fully self-contained with commands seems very much against the idea of Unix, its ability to use the same commands in a wide variety of applications is very much the epitome of it.

Finally, I find it amusing how so many people complain that Microsoft (sorry, M$) just copies Unix, but when they do produce something that is genuinely different everybody complains about how complicated it is and that they should have just used bash. Most of the people here who have criticized it have just used vague reasoning without any examples of the problems they found. Most of the time they demonstrate a complete lack of understanding of the language. At least you gave a specific example, and for that I applaud you.

Comment Re:Is it indispensable? (Score 3, Informative) 110

Here is a script just from the top of my head (so it may not be the best way of doing it). I could have easily got it down to a single line if I didn't want to worry about efficiency. Also, if this were a real script I would use named arguments.

$l = $args | foreach { dir $_ -File }
$l | select @{ N="File"; E={$_} }, @{ N="Matches"; E={ $n=$_.Name; $l | where { sls $n $_.FullName -Quiet } } }

And now for a follow up challenge. Take the output of the bash and PowerShell scripts and sort the list by the write time of the most recently written reference file. In your case, Dir_2/file_four may sort before Dir_1/file_one if the files that contain its name were the earliest.

This is where PowerShell comes into its own as the output of the script are all objects rather than just text. That means I can just do this challenge from the CLI:

Example Dir_1 Dir_2 Dir_3 | sort { ($_.Matches | Sort-Object LastWriteTime | select -Last 1).LastWriteTime }

Now filter the list to only show the *.txt files (but still show all the references from non *.txt files). You can't just grep .txt as this would also show *.cpp files that were referenced by a text file.

Example Dir_1 Dir_2 Dir_3 | where { $_.File.Extension -eq '.txt' }

There are definitely times when I will decide to use bash for some scripting, but there are a lot of other times when I choose PowerShell as the most efficient for the task - even on Linux.

So when do I use it on Linux? I found it easier than bash to work with directory trees, JSON and XML files, as well as interacting with databases and custom C# libraries. The same utilities that sorts, filters, and display directory listings (foreach, where, sort, select) can also (for example) manipulate records from a JSON file. That makes it very elegant and useful.

Comment Re:Prop the doors open and leave (Score 1) 379

And do you also think that civilized adults go around calling people cunts? Because that is what you have been doing here today. You even swear at people who simply ask if this will lead to other people committing vandalism.

Perhaps you should tone it down and act more civilized.

Comment Re:Decisions (Score 1) 200

If you include more of the quoted section, it goes on to say:

Yet that is precisely what the agency seeks to do now - regulate not just what happens inside the workplace but induce individuals to undertake a medical procedure that affects their lives outside the workplace.

So that section is not about requiring people who work from home to get a vaccine, but that people who get vaccinated for use within a workplace are then still vaccinated when they leave.

This section does not back up your claim at all. Your use of selective quoting is very misleading.

Also, since the ETS allowed for weekly COVID-19 testing along with wearing of a face covering at the workplace, the standard does not force any medical procedure that would affect people outside the workplace. So both you and the Supreme Court are wrong.

Comment Re:You mean we can get developers for free? (Score 0) 65

Ah yes. 20 years of bullshit like this. 20 years of being told not to use C# because Microsoft would suddenly go after all their users for patent violations. 20 years (and more) of the old Embrace, Extend, and Extinguish line - but only with vague promises that the extinguish part is going to happen real soon now...

recently welcomed Linux to the Windows desktop

Extend.

In this case, how does implementing a subsystem for Linux to run equate to extending? The actual Linux distros that you can run under Windows is made by other people (example: Ubuntu). Microsoft has submitted code to the kernel to facilitate their virtualization, but how is that any different than anyone else write code for it. All of that code is publicly available under GPL license, so what is the problem?

This is just the same old FUD from people who are still think that it is 25 years ago. Times have changed, and it is time to accept the truth. Linux is easy to install now, Microsoft works with the open source community instead of against it, and Keven Spacey might not be the stand-up ladies man that you think he might be.

Comment Re:As Microsoft intends... (Score 2) 83

While it is the standard sport here to blame everything on Microsoft, if you have a look at the top 10 list you will see that multiplayer games are the most played games on the PC. It is not DirectX and Windows that is the problem, but rather anti-cheat software that is the bane of playing Windows games on Linux.

Comment Re:Why can't I code for my own computer anymore? (Score 1) 33

Have you not heard of .NET? Every installation of Windows comes with a C# compiler csc.exe, a JScript compiler jsc.exe, and a Visual Basic compiler vbc.exe. These are all found in C:/Windows/Microsoft.NET/Frameworks/v4.0.30319. (WTF? Slashdot says it is ascii art if you use blackslashes in paths).

Also pre-installed on Windows is JScript and VBScript scripting languages (under the banner of the Windows Script Host) using the cscript.exe for the command line version, and wscript.exe for the windowing version.

You can also download the Microsoft Windows SDK for free which gives you the C and C++ compiler, along with the headers & libraries to develop Win32, .NET, and Universal Windows Platform (UWP) applications (depending on which version you get). The more modern version is the Microsoft C++ Build Tools, which are the standalone compilers from Visual Studio (which also has a free version you can download if you want the full experience). If you can't handle downloading the installer from Microsoft's site, then you probably would not cope with C/C++!

None of these are new. In fact, JScript and VBscript came with Windows 95. There are other development environments that Microsoft are happy to tell you about, including Python, Rust, etc.

Now they are taking our ability to program with 3rd party developer tools off our PC.

Nobody is doing that. The desktop versions (and command line compilers) still exist. What made you think that adding a web version something meant that everything else was going to be discontinued?

Comment Re:I hope you reject all vaccines (Score 1) 311

If the New Rule is that all drugs which have more than one use are to be denounced based on one of the uses, or that all drugs also used on animals are to be labelled as animal drugs, then nearly all vaccines are out.

If the people who are taking it are prescribed it in the correct doses by a doctor, then that is fine. But they are not doing this - they are going out and buying horse de-wormer and using it without medical supervision in who-knows-what doses. So I think that it is entirely fair to say that they are taking horse de-wormer.

There are plenty of drugs that are straight up poison if you take too much of it. This is why you should only take drugs that are recommended by doctors. In this case, they overwhelmingly recommend vaccines.

Comment Re:The killer is already inside the building, (Score 2) 255

Trump's rollout plans were "counterproductive"? Biden had to "re-do" everything? You're as bad as a Trump supporter.

There is some truth to that. There were indeed supply chain problems that the incoming Biden administration had to correct. Soon after he took office, Biden changed the system to ensure regular deliveries to the states (they could not plan if they had no idea how many doses they were going to get. Also, they procured more doses because they did not have enough to meet the demand.

As I commented to a sibling poster, Donald Trump had rejected an offer from Pfizer of an additional 100 million doses of their vaccine. It is fair to say that widespread vaccinations did not really take off until Biden became president.

Comment Re:The killer is already inside the building, (Score 1) 255

Trump didn't even do a deal for enough doses to get everyone vaccinated.

It was worse than not doing a deal. He actively rejected an offer of more vaccines in December. The only reason that I can think of that he would want to do this is to sabotage the Democratic role-out of the vaccines. He played politics at the expense of untold thousands of American lives.

Comment Re:The GOP are a bunch of cunts (Score 5, Informative) 214

Liberals are the most close-minded people you will ever meet. They won't tolerate any opinion other than their own.

Right. That's why conservatives have to set up their own media networks specifically designed to cater to conservative beliefs. Any news report that doesn't align with what they "know" is deemed to be fake news. It is all because conservatives are closed-minded to anything that doesn't match their notions of reality.

It is why Republicans make laws about what must be taught and can't be taught in schools. It is why Republicans censor scientists from discussing things that conservatives don't like, and when they do have to release reports that don't match the right-wing narrative they bury it so that it doesn't get seen. It is why when they should be focusing on the virus that is killing hundreds of thousands of Americans and how we must find ways the economy recover, conservatives would rather to invent scandals like the incredibly few transgender athletes who want to compete with girls. It is why when conservatives are polled, they report that they hate Obamacare, but love the Affordable Care Act. The only difference is the name "Obama".

Conservatives are so open-minded that they will claim something as fact even when GOP investigations find no evidence. Conservatives habitually believe the opposite of what the experts tell us, like climate change, trickle-down economics, evolution, the link between smoking and cancer, etc. They make up conspiracy theories and peddle them by "just asking questions" (so that they are never forced to provide any proof of what they are saying).

With all of that, it is unsurprising that the people on the left and center of politics would routinely disbelieve what conservatives say. I can imagine from the conservative's point of view, this must appear like it is closed-mindedness. But when you have Fox hosts saying that they know voter fraud happened but that they have had a devil of a time finding actual proof, then perhaps you might understand other people might seem so dismissive of your ideas. If you "know" something to be true before you have found any evidence of it, then you are peddling a conspiracy theory.

Liberals are open-minded to reality. If conservatives don't let reality get in the way of what they believe, then you can't really blame liberals for paying no attention to the lies. To ensure that I wasn't being indoctrinated into one set of beliefs, I started watching a mix of mainstream and conservative media. The problem was that it wasn't just a different set of opinions or even a different slant on the news of the day. What was being reported on Fox and conservative sites was just a completely different set of facts. The problem was that so much of what I saw being discussed on Fox was the opposite of the video and documentary evidence provided by mainstream media. When you have one side showing a video of the then-President saying something while the other side just has talking heads claiming that he never said that, then I am going to believe the side that actually showed the evidence. Unfortunately, that was never the conservatives.

Comment Re: A few translations (Score 1) 172

Microsoft has a long history of being a shitty company that seeks to destroy anything that competes with their products; they want to be the only OS in the world.

Microsoft can compete aggressively, but they also have been known to give support to their competitors. For example, back in '97 they bailed out Apple when the now-massive company was in difficult times. Microsoft knew that they needed a healthy competitor. They gave them $150 million and promised to keep supporting Office on the Mac.

Meanwhile you don't post anything to support your own theory.

Are you blind? I gave examples of what Microsoft has done that supports Linux and it is the exact opposite of what you say. Are you suggesting that they have not ported any of their software to Linux, like .NET, PowerShell, VS Code, SQL Server, etc? Are you suggesting that they don't host multiple distributions of Linux on Azure? Have you never heard of Windows Subsystem for Linux?

On the other hand, you have not offered anything as evidence of them attempting to kill Linux in any way. All you have is your "suspicion" and the claim that even if you don't know how they could kill off Linux, Microsoft would find a way. That is not good enough.

Don't waste my time again.

You are wasting everyone's time by posting your FUD. You are like Chicken Little, crying out that the sky is falling.

Comment Re:Developers, developers, developers (Score 1) 172

I wonder if they would give you the source if you asked for it.

You don't even need to ask for it. Just follow the link at the bottom of the store page for Publisher Info. Go to the Downloads page and you can find the source code there. As I said in another comment, this isn't Microsoft publishing this software. It is one of the contributors to the application.

The only criticism of Microsoft here is that their store assumes that if you have a free version and paid version (which this application does), then it labels the free version as a trial. There is no limitation on the trial version of HexChat on the store.

Comment Re:Developers, developers, developers (Score 1) 172

Surely you realise that it is not Microsoft that put that up on their store for $10, right? The person who did that was TingPing, who is one of the contributors listed on github. Also, if you look at the description of the software, it states:

NOTE: This application is free the purchase is optional.

Comment Re: A few translations (Score 1) 172

If they really wanted to they'd find leverage somewhere to do precisely that.

By that logic, if they haven't found and used something to leverage to kill the open source OS then they proves that they don't want to.

To summarise your whole position: until you have been shown proof that they are NOT going to destroy Linux as an OS (and just how do you prove a negative), you will ignore all of Microsoft's efforts to port their software to run on Linux, host Linux on their cloud services, add Linux as a target in their development systems, and enable Linux distros to run as a subsystem on Windows.

You guessed that they were going to destroy Linux, but cannot say how anyone could possibly do that. But until you find evidence to the contrary, you will continue to espouse your unfounded idea. That is the perfect definition of a conspiracy theory.

Slashdot Top Deals

I have hardly ever known a mathematician who was capable of reasoning. -- Plato

Working...