|
See here: Fast Search and Replace in Large Number of Files: A Practical Guide[^]
Hello all,
My name is Dr. Brian Hart, and I am a PhD astrophysicist and one of the original users of The Code Project from back in the year 2000. I've written many articles in C++ and C# programming.
I just wanted to share a link to an article I just posted, today, on The Code Project. I hope you will stop by and take a look.
It's about using memory-mapped files in C# to do a search and replace a large number of files fast. I implemented the algorithm both as a (really bare-bones) console application and a more graphical/user-friendly Windows Forms tool.
It came out of work that I was doing on this .sln file that contains almost 1,000 projects in Visual Studio, and I was pushing my existing Find In Files / Replace In Files tools to the limit. I needed to write my fast algorithm as part of a file- and project-renaming tool I was writing, partly to manage the refactoring of so much code.
The code included with the article compiles (after doing a nuget restore in the Solution directory). It should be informative and a great example of processing a huge number of files really fast.
The impetus of the article was trying to imitate the speed with which Notepad++ processes files with its Find in Files and Replace in Files operations.
I also include code to create a progress dialog in WinForms and report the operation's progress to the user while keeping the GUI responsive. I hope it helps someone with their programming work!
Regards,
Brian Hart
|
|
|
|
|
|
This is cool and not cool at the same time.
Jeremy Falcon
|
|
|
|
|
|
this is the most awesome thing ever. C'mon Star Trek and Babylon 5! Science fiction needs to turn into science fact! I have to get off this dumb planet sooo bad... ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Wordle 1,055 6/6*
⬛⬛⬛⬛🟨
⬛⬛⬛🟨🟨
🟨🟩⬛⬛⬛
⬛🟩⬛⬛🟨
⬛🟩🟩🟩🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Kinda looks like Mario running to left but his hat fell on his face.
Jeremy Falcon
|
|
|
|
|
Wordle 1,055 4/6
⬛🟨⬛⬛🟨
⬛🟩🟩⬛⬛
⬛🟩🟩⬛🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 1,055 6/6
⬜⬜⬜🟨⬜
⬜🟩⬜⬜🟨
⬜🟩🟩⬜⬜
⬜🟩🟩⬜⬜
⬜🟩🟩⬜🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 1,055 6/6
⬜⬜⬜⬜🟨
⬜⬜🟨⬜🟨
🟨⬜🟨🟨⬜
🟨🟩⬜⬜🟨
⬜🟩🟩🟩🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 1,055 5/6
⬜⬜⬜⬜🟨
⬜⬜⬜🟨🟨
⬜🟩🟩⬜🟩
⬜🟩🟩🟩🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 1,055 5/6
⬛🟩⬛🟨⬛
⬛🟩⬛⬛🟨
⬛🟩🟩⬛⬛
⬛🟩🟩⬛🟩
🟩🟩🟩🟩🟩
Jeremy Falcon
|
|
|
|
|
Wordle 1,055 6/6*
⬜🟨⬜⬜🟨
⬜⬜⬜🟨🟨
⬜🟩⬜🟨⬜
⬜🟩🟩⬜🟩
⬜🟩🟩🟩🟩
🟩🟩🟩🟩🟩
That was close!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
So, I'm extremely annoyed at MS these days. Every dang OS update I get some new advertising, etc. Anyway, so I decided to give Copilot (preview) a swing. Now, call me paranoid - I actually believe that corporations collecting data on us is completely out of control - with that said, I cannot run Copilot queries unless I'm logged into my MS account. There can only be one reason for that...
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
charlieg wrote: I cannot run Copilot queries unless I'm logged into my MS accoun
That was previously true for chatGPT too, but I noticed recently that they will let you talk to it without logging in now. At least for me, it doesn't require me to log in at: https://chatgpt.com/[^]
Originally they said that it was so you didn't do crazy things with AI.
So, maybe that is what MS is thinking too?
or, they are tracking you like every other company in the world.
or both.
Oh, and one reason it is nice that they "track" you is because later you can read over your discussions with AI that you had long ago. It's like a diary of your life. ![Laugh | :laugh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_laugh.gif)
|
|
|
|
|
I suspect you are correct. But this part: "It's like a diary of your life" - I have to laugh. My primary customer has gone full tilt into the MS eco-system. Can you say Teams? So now everyone is sending messages and files and what not over teams. The only problem is that there is NO data retention. Ah well, it's not going to matter much longer.
Charlie Gilley
7.1.2024 starts a new chapter of my life.
|
|
|
|
|
charlieg wrote: Ah well, it's not going to matter much longer.
That seemed foreboding until I saw your sig line.
![Big Grin | :-D](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|
|
lol, yeah, I'm going fishing. I'll keep my foot in the water on small projects, but I'm ready to slow down.
what's weird is I cannot get sig changes to stick.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Oh Copilot half baked...
So, I'm fighting with a code base of ancient VC6++ code, trying to lift it to VS2022. I think, wth, I'll try copilot - since MS decided to push it to my computer...
My query: "best practices for migrating a vc6++ project to vs2022?"
The answer: "Sorry, it looks like you've been signed out. Please sign-in again." And yes I'm signed in.
more half baked crap.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
charlieg wrote: I actually believe that corporations collecting data on us is completely out of contro It's gonna get worse too if consumers don't take a stand.
charlieg wrote: There can only be one reason for that.. You can run your own ChatGPT-like bot locally with no accounts needed using something like Ollama . Unfortunately, they don't have the code base training that Copilot has though. Not sure how good it'll be at generating code, but maybe worth a try. Thar be a YT video on getting it going too.
Jeremy Falcon
|
|
|
|
|
Perhaps they intend to give each user his/her own personalized/customized/curated AI experience, (including personalized/customized/curated ads).
modified 2hrs ago.
|
|
|
|
|
|
raddevus wrote: It's too much!! Was thinking about writing a package manager to read CP posts...
Jeremy Falcon
|
|
|
|
|
|
AND?
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
I’m begging you for the benefit of everyone, don’t be STUPID.
|
|
|
|