They keep showing that car commercial on TV. The one that starts out with the music sounding like a Star Wars trailer. It feels like sacrilege to me. Apparently this isn't a new thing - there have been other car commercials in the past with Star Wars themes. But I don't remember seeing them, or if I did, they must not have bothered me as much.
Hmm, nope, I haven't seen this one before now. I rather like that one, and it has a funny part too.
On the other hand, this one is even WORSE than the one being shown on TV now. HOW DARE THEY! grrr.
.
I found a grocery store that sells Accent (MSG). All the reviews say it makes "flavor come out" and "makes things taste better". But so far, it doesn't seem that way to me. I tried it on my pasta instead of salt, and ::blech::. Maybe it tastes better when it's added during cooking, or along with other flavors.
.
At work, I noticed a bug in one of the file search utilities I use. I was searching some large XML files for certain element names to verify that all the expected nodes were there, but the count was coming up short in some of the files. The files didn't have line breaks. When I used another tool to add line breaks after each node, and then searched them again, the counts came out correct. So it seems like the utility has a problem searching large files without line breaks.
I thought I would submit a bug report along with a sample file to demonstrate the problem. I stayed late after work to create such a file. I didn't want to submit the original XML file as it had some company-specific things in it. So I started by doing a replace-all to change all instances of one element name to a string of plus signs of the same length. With the file like that, the count of the plus-signs-string still comes out wrong.
Then I did a regex replace-all, to convert *all* other characters in the file to minus signs. That way, the final file still has the same size, and the search string is still in all the same positions as in the original file.
But weirdly, after doing that, the count comes out correct. Even without having added line breaks. So that thwarted me. Tomorrow I may try again, this time not converting the less-than and greater-than characters.
Along the way, I found out that Notepad++ doesn't perform well when using regex to replace nearly all characters in a 10MB sized file. The one time it succeeded at the task, it took 10 minutes to complete. Several other times it locked up or crashed. Then I downloaded UltraEdit, which was able to do the same task in about a minute, maybe less.
Hmm, nope, I haven't seen this one before now. I rather like that one, and it has a funny part too.
On the other hand, this one is even WORSE than the one being shown on TV now. HOW DARE THEY! grrr.
.
I found a grocery store that sells Accent (MSG). All the reviews say it makes "flavor come out" and "makes things taste better". But so far, it doesn't seem that way to me. I tried it on my pasta instead of salt, and ::blech::. Maybe it tastes better when it's added during cooking, or along with other flavors.
.
At work, I noticed a bug in one of the file search utilities I use. I was searching some large XML files for certain element names to verify that all the expected nodes were there, but the count was coming up short in some of the files. The files didn't have line breaks. When I used another tool to add line breaks after each node, and then searched them again, the counts came out correct. So it seems like the utility has a problem searching large files without line breaks.
I thought I would submit a bug report along with a sample file to demonstrate the problem. I stayed late after work to create such a file. I didn't want to submit the original XML file as it had some company-specific things in it. So I started by doing a replace-all to change all instances of one element name to a string of plus signs of the same length. With the file like that, the count of the plus-signs-string still comes out wrong.
Then I did a regex replace-all, to convert *all* other characters in the file to minus signs. That way, the final file still has the same size, and the search string is still in all the same positions as in the original file.
But weirdly, after doing that, the count comes out correct. Even without having added line breaks. So that thwarted me. Tomorrow I may try again, this time not converting the less-than and greater-than characters.
Along the way, I found out that Notepad++ doesn't perform well when using regex to replace nearly all characters in a 10MB sized file. The one time it succeeded at the task, it took 10 minutes to complete. Several other times it locked up or crashed. Then I downloaded UltraEdit, which was able to do the same task in about a minute, maybe less.
no subject
Date: 2017-11-18 12:42 pm (UTC)From:no subject
Date: 2017-11-20 06:10 am (UTC)From:I was actually thinking, this would be pretty easy to code in C. But I'd rather be able to do it using one of my existing tools rather than having to code something each time. I may purchase UltraEdit, as it seems another useful tool to have in my toolbag. I used it as my main editor a decade ago, which I had almost forgotten. (I was thinking "UltraEdit" sounds rather familiar... wait, don't I still have a license key for that? I had asked my company to buy me a license back then, and they did.)
no subject
Date: 2017-11-20 08:22 am (UTC)From:$myfile = get-content C:\tools\testfile.txt -Raw
(-raw means you get it as one string rather than an array of strings - useful if the regex is going to operate across lines. If it's only going to operate on one line at a time then leave that off)
$myfile -replace "thing","otherthing"
will then do your regex. Replace "thing" with your search regex and "otherthing" with what you want it replaced with.
That'll spit the results out to the command line. When you're happy with it, write it back out to a new file with:
$file -replace "thing","otherthing" | Out-File mynewfile.txt -Encoding utf8
(If you leave off the encoding you'll get utf16 by default. Nobody wants that.)
no subject
Date: 2017-11-20 02:56 pm (UTC)From:no subject
Date: 2017-11-21 02:56 am (UTC)From:I had used those get-content and replace commands before, in some of my batch files, for replacing strings. But I hadn't realized they could be used for regex searches too. And I hadn't remembered the commands.
The PowerShell syntax is very non-intuitive to me, which makes it hard to remember. (why does replace need a dash? it's not an option or parameter... Out-File sounds like an object to me, not a command, etc.)
Are there any PowerShell books or online tutorials that you would recommend?