Saturday, July 20, 2024
HomePowershellUX Headache - Becoming a member of Traces in a Textual content...

UX Headache – Becoming a member of Traces in a Textual content File

Part of me critically needs to be concerned in UX. I continually discover issues with nearly each UI through which I interface. This one is gorgeous, however it’s missing. This one is ugly, however works. Perhaps it’s why I like PowerShell; it’s all the time the identical it doesn’t matter what I’m working with. It’s in all probability additionally why I want each web site on the planet was written with APIs first. What a tremendous world, if I might do every little thing utilizing PowerShell: examine the financial institution, register youngsters for college, order Chipotle, and make appointments on the physician, the dentist, the attention physician, the auto store, and so forth. The checklist is countless.

Anyway, again to the subject right here. I’ve typically thought of shopping for a brand new area and declaring terrible, real-world experiences of my very own till somebody comes alongside, realizes I get it, and employs me to cease all of the terrible interfaces… a minimum of for that firm. Us people, residing on this digital world, are continually subjected to awful-looking, unhelpful, and inconsistent interfaces which have develop into a requirement in our lives. If I request that your web site present me 100 rows at a time, then it’s not going I’m going to vary my thoughts after I click on into one file after which return out to the row view once more. And if I do wish to change it, guess what, that’s on me. I might go on for days.

The corporate accountable for these, two paragraphs is the rationale I’m writing immediately. I used to be despatched an inventory of 100 or 200 CIDR ranges. No downside, I’ll simply copy and paste them into that one field on the web site set to just accept each single IPs and CIDR ranges. Nope. That induced an error. It was unable to parse it, and so now it was my job to enter them one by one!? Nicely, it could’ve been had I not recognized PowerShell. Critically, somebody someplace is perhaps doing that. Copy and paste, or choose and drag, or no matter different choice was left. Whichever technique, it could be a lot slower than what I did. So, immediately’s put up is each me venting slightly of my pent-up UX frustration and offering a fast decision for anybody on this identical state of affairs, that didn’t routinely assume PowerShell themselves. You see, the interface would take a comma-separated checklist, it simply couldn’t deal with a line-delimited checklist–if that’s even what that’s referred to as. Perhaps new-line-delimited; I don’t know for certain.

Right here’s what I had (after eradicating the general public IP addresses):

Let’s save this file to my laptop as C:UserstommymaynardDocumentsCIDR.txt. Now, let’s see what number of entries we’re working with. What sort of time may I save?

(Get-Content material -Path $Path).Rely


We’re working with 117 entries, or relatively, 116 commas. Yeah, I’m not transferring these over one after the other; I don’t have the type of time throughout my day. Enter PowerShell. To start testing, I selected a smaller subset of the CIDR ranges. After I was pleased with that, which was virtually instantly, I added the -join operator.

Get-Content material -Path $Path | Choose-Object -First 5

(Get-Content material -Path $Path | Choose-Object -First 5) -join ',',,,,

As soon as I had this, I solely had two issues left to do. One, check to see if the corporate’s UI accepted comma-separated entries like this, and two, if it did, then be part of all 117 addresses with a comma in between every, and stick with it with my day. That’s three issues. Nicely, 4 in case you depend writing up this put up after work. The UI did settle for issues that method, and so I ran the under command, pasted it within the field, saved every little thing, and reported again to my buyer that it was set and carried out, as requested. Subsequent.

(Get-Content material -Path $Path) -join ',' | Set-Clipboard



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments