|
|
Thank you for the quick response, really appreciated
|
|
|
|
|
You're welcome! Good luck with the granddaughter - teaching isn't as easy as some people think ...
"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!
|
|
|
|
|
|
Excellent, Thank you very much
|
|
|
|
|
Note that the current revision (1.1) of the book is more than 17 years old. Don't expect it to cover all the new bells & whistles. A few things have been added since C# version 2.0 and dotNet 3.0, so don't expect to learn enough to understand all the sample code you'll find on the internet today.
Do read the book - Petzold is a top notch technical writer, and most certainly for beginners. Just be prepared to discover that there is a lot more to C#/dotNet today that Petzold couldn't possibly have described in his 2006-2007 book.
Additional comment: Once you are through Petzold, a nice way to learn about more recent additions is to read The history of C#[^] bottom up. The links to the descriptions of each new extension is mostly quite readable!
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
I don't think you meant this message for me.
|
|
|
|
|
It was meant as an extension to your message, an additional comment.
I wasn't prepared for anyone having problems understanding that. In meatspace discussions, I am used to discussion participants expand on each other's contributions, directed to all listeners, not just to the one making the statement expanded upon. I frequently consider network discussions in a similar way: A post is not meant for one specific listener, but for all participants taking part in the discussion.
I'm really sorry for creating this highly undesirable situation; I hope you do not feel terribly offended. That certainly wasn't my intention. I will try to remember in the future that if I add to something that you say, I will not do it as a followup to your post, but wait until someone else makes a followup to your post and rather add my addition to that post, rather than to yours.
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
Sorry, I did not mean to offend you. And your comments are all valid, but I just thought that they would be best posted to the OP, as follow up to what I suggested. Experience (here) tells me that not everyone reads every message in a thread; even though you and I would seem to.
|
|
|
|
|
I retired from a career as a programmer, systems analyst, and SQL Server developer a couple years ago, but had very little experience with C#. Since there is so much info on programming available on the web (thank you Code Project and Stack Overflow), I almost never buy a book on programming. However, I did buy this one and found it valuable:
Head First C# by Andrew Stellman and Jennifer Greene (Don't know them, have nothing to gain by this plug). I have the 4th Ed, there's a 5th coming out in August. I got the PDF version for the publisher's site, but print and kindle are available at Amazon.
After information is presented, they use different kinds of non-conventional exercises designed to help understanding and recall. There are various places on the web where you can preview some chapters and see how they do it.
It is aimed at young programmers just coming up, rather than old farts like me, and may appeal to your granddaughter.
|
|
|
|
|
I'm trying the C# example here:
Changing the Bluetooth Radio Mode | Microsoft Learn
It's referencing BthUtil.dll. I can't find this DLL anywhere. How can I find this?
Thanks
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|
Look at the date on the article. It's from 14 years ago and really doesn't apply today.
From what I can tell, BthUtil.dll was part of Windows CE/Mobile, which doesn't exist anymore. It was never part of full-blooded Windows.
You're looking at an article for Windows Mobile!
|
|
|
|
|
I'm not sure that even if you find it, it would be any use to you - BthUtil.dll is part of the Windows Mobile (WM) API which was a derivative of WinCE and which finally died the death back in 2013 - it ran on relatively short lived hardware that certainly isn't being made these days and MS ended support for it back in 2019.
If you are targeting WM deliberately in 2024 then you have to ask yourself "why am I doing this?" as it's going to get increasingly hard to find hardware it will still run on that works!
If you are trying to get something working and didn't realize it was a WM app example you were following then that's your problem, right there!
"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!
|
|
|
|
|
Do these links help?
/ravi
|
|
|
|
|
Hi
I am trying to use Parallel.ForEach with ConcurrentBag and it work but to display a feedback I used progessbar control to display fname value , problem after few seconds I get error and the error message is not visible instead a wight box appear because of using a thread . any idea what is the problem in this code ?
int row_idx = 1;
ConcurrentBag<(int, string, float)> bag = new ConcurrentBag<(int, string, float)>();
Parallel.ForEach(elements, element =>
{
string fname = element.name;
float ftrack = (float)(element.track);
var elementsToAdd = new (int, string, float)[]
{
(row_idx, fname, fsize)
};
bag.Add(elementsToAdd[0]);
row_idx++;
ProgressBar1.Text = fname;
ProgressBar1.Update();
});
|
|
|
|
|
That's because you cannot touch a UI control from anything other than the UI (startup) thread. When you use tasks, you're using other threads that are not the UI thread.
To change the text of a control, you have to marshal a call to a function back to the UI thread so that function updates the Text property and does it on the correct thread.
You can see how it's done at How to make thread-safe calls to controls - Windows Forms .NET | Microsoft Learn[^]
|
|
|
|
|
|
Hello everyone,
I'm currently working on a C# project that processes a large dataset. While my code works correctly, it's running slower than expected, especially with bigger files. I'm looking for advice on optimizing the performance.
Here’s a brief overview:
-I'm reading data from a CSV file.
-Processing involves several nested loops and string manipulations.
-Writing results to a new file.
I've tried using Parallel.For for the loops but it didn't improve much. I suspect the string operations might be the bottleneck. Does anyone have suggestions on more efficient data handling or alternative approaches for processing large datasets in C# ? Any tips on using memory more efficiently or reducing execution time would be greatly appreciated.
Thank you in advance for your help.
Best regards,
Steve
tensorflow
modified 6-Jun-24 2:06am.
|
|
|
|
|
off to the C# forum you go
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.
|
|
|
|
|
Aside from posting your question in the correct forum - did you somehow miss the repeated "no programming questions" warnings at the top of the page? - the only thing we can suggest based on such a vague description is that you profile your code to find out where the actual bottleneck is.
Anything else is going to be a wild stab in the dark, with very little chance of success.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Profile.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
|
As has been mentioned, this is not the right place for programming queries - post your request here instead: C# Discussion Boards[^]
But ... Think about a few things first.
1) Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.
Imagine this: you go for a drive in the country, but you have a problem with the car. You call the garage, say "it broke" and turn off your phone. How long will you be waiting before the garage arrives with the right bits and tools to fix the car given they don't know what make or model it is, who you are, what happened when it all went wrong, or even where you are?
That's what you've done here. So stop typing as little as possible and try explaining things to people who have no way to access your project!
Have a look at this: Asking questions is a skill[^] and think about what you need to know, and what you need to tell us in order to get help.
2) Parallelism isn't a "magic bullet" which automagically speeds up your code: it's is a complicated subject and it's very simple to slow an app down if you don't understand what you are doing.
3) The first part of speeding up an app is identifying where bottlenecks occur: if you are guessing (and "I suspect ..." is a good clue that you are) then you are very likely to chase off down a blind alley making tiny gains in performance but ignoring the "slow code". Profile your app and find out what is actually taking time!
4) We can't tell you "do this and your code will be faster" without understanding your code - and nobody wants to wade through a whole app looking for performance gains: we are all volunteers and most of us have paying job to do!
So show us code fragments that we actually need to see - without those, we are just whistling in the dark!
"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!
|
|
|
|
|
It sounds mildly interesting. More specifics would help.
|
|
|
|
|
The terms "nested loops" and "performance" do not belong in the same sentence.
If you're nesting loops in what is supposed to be high-performance code, you're killing performance of that code.
|
|
|
|