|
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
|
|
|
|
|
|
Brian C Hart wrote: I just wanted to share a link to an article I just posted, today
Don't do this.
There is already a feed of recently posted articles[^], and multiple newsletters which list the recently posted articles. Anyone who is interested in the topic will see your article there and read it.
Recent articles are also posted on the CodeProject Twitter feed, for those who still use that site.
Posting in The Lounge to promote your new article stinks of spam / rep-point hunting. Imagine how useless the forum would become if every author did this!
You think it's annoying having a daily Wordle thread? Having page after page of "Check out my new article", "No, check out MY new article", "My new article is better than your new article"" etc. threads would be a thousand times worse.
And it's not going to achieve much. By this time next week, your article promotion post will be buried on page 42, where nobody is ever likely to see it.
So seriously, don't do this.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Spot on!
"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!
|
|
|
|
|
And yet he gets 4 up-votes.
|
|
|
|
|
|
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...
|
|
|
|
|
Brian C Hart wrote: I have to get off this dumb planet sooo bad...
Graffiti:
Q: Is there intelligent life on Earth?
A: Yes, but I'm just visiting.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
π΅ And pray that there's intelligent life
Somewhere up in space
'Cos there's bugger all
Down here on Earth! π΅
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
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
β¬β¬β¬β¬π¨
β¬β¬β¬π¨π¨
β¬π©π©β¬π©
β¬π©π©π©π©
π©π©π©π©π©
Looks like almost everyone went about the same word sequence. Funny
modified 17 secs ago.
|
|
|
|
|
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!
|
|
|
|
|
β¬π¨β¬β¬π¨
β¬β¬β¬β¬β¬
β¬π©π©β¬β¬
β¬π©π©β¬π©
π©π©π©π©π©
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
Wordle 1,055 6/6*
β¬β¬β¬β¬π¨
π¨β¬β¬π¨π©
β¬π©π©β¬π©
β¬π©π©β¬π©
β¬π©π©π©π©
π©π©π©π©π©
Happiness will never come to those who fail to appreciate what they already have. -Anon
And those who were seen dancing were thought to be insane by those who could not hear the music. -Frederick Nietzsche
|
|
|
|
|
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.
|
|
|
|
|
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.
|
|
|
|