|
Drop the [] so you aren't returning an array.
|
|
|
|
|
XKCD has never felt so real...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I'm trying not to judge, but it's hard.
|
|
|
|
|
|
Certainly, if your code read this, for instance:
int[] item = 1; That would generate a compiler error because 1 is not an array of integers. If you only want one value, change it to
int item = 1; See how [] has been removed.
|
|
|
|
|
But can you show me where the backspace key is please?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
hi
i have attached font in my C# WinForm program.
this is the code:
System.Drawing.Text.PrivateFontCollection privateFonts = new PrivateFontCollection();
privateFonts.AddFontFile(Application.StartupPath + @"\MyFont.ttf");
System.Drawing.Font font = new Font(privateFonts.Families[0], 120);
lblMSG.Font = font;
when i run in the solution i see the font excelent.
but after i make setup to my program, and i install and run the program
i cant see the font (i see empty...)
(Of course that i attached the MyFont.ttf file to my app folder)
and i got this error:
Parameter is not valid
how to fix it ?
thanks
|
|
|
|
|
Did you add the font file to your program folder? Usually if you add a font file to an installer the tool will add install the font in the system Fonts folder, not your application folder. The code you're using expects to find the font file in the same folder as the .EXE.
|
|
|
|
|
thanks for the help,
i change my code like this:
privateFonts.AddFontFile( @"c:\Windows\Fonts\XX.ttf");
but after i install my program i got message that can't find the file
|
|
|
|
|
OK, the thing to do is to NOT change the code. You should be diagnosing what the installer is doing with that font file. Find out first, then react to it.
|
|
|
|
|
Is the file actually there? If no, your installer is in error. If yes, you're probably passing another path.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
thanks for the help,
after the install i see the font file in my application folder
but still same error.....
|
|
|
|
|
how do i make my program autorun when my computer open(windows service)?
|
|
|
|
|
Not enough information.
What is this program supposed to do? Does it require a user interface? Is it support to start doing it's processing when Windows starts, or when a user logs in?
Windows Service applications starts after Windows starts and do not show an interface at all. You'd have to write your application specifically as a Service application.
|
|
|
|
|
Create an application which will call the web services or do what ever you want...then make an exe..put that exe in C:\Users\arka\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup this location. As your computer will start your app within this path will execute.
|
|
|
|
|
That location doesn't start an app when Windows starts. That starts an app when that user logs in.
|
|
|
|
|
Arkadeep De wrote: As your computer will start your app within this path will execute. Some cleaning apps might flag it as possible malware though; the start-menu folder usually contains links to executables, not executables itself.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I was just reading someone's blog where he tested
bool isEmpty = (MyString == "");
bool isEmpty = string.IsNullOrEmpty(MyString);
bool isEmpty = string.IsNullOrWhiteSpace(MyString);
bool isEmpty = MyString.Equals("");
bool isEmpty = MyString.Length == 0;
and he listed the number of ticks each example took.
That got me thinking....
If you wanted to know of a string was null, that's one thing, and determining if its an empty string is another.
But do you REALLY care about TICKS???
With today's PC's and Servers running at ultra high speed, why would anyone really care?
Bonus question: I prefer IsNullOrWhiteSpace. What's your favorite & why?
If it's not broken, fix it until it is
|
|
|
|
|
Most of them are not even equivalent.. of course you can weigh both apples and oranges, but there aren't many useful conclusions that can be drawn from the results.Coder For Hire wrote: With today's PC's and Servers running at ultra high speed, why would anyone really care? Moving into hypothetical territory here, it's easy to make up a scenario in which it matters. "Do that thing a billion times" is usually a good start.
By the way, if you're referring to this blog[^], then disregard the results, that's a very bad benchmark, he makes all the rookie mistakes.
|
|
|
|
|
harold aptroot wrote: By the way, if you're referring to this blog[^], then disregard the results, that's a very bad benchmark, he makes all the rookie mistakes.
I can identify these mistakes:
- he uses DateTime.Now instead of StopWatch
- he doesn't allow for JIT-precompilation
- no GC.Collect() (which shouldn't matter much here but would be good practice)
Are there more mistakes?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
A couple more,
- the result goes nowhere. Apparently it worked, but it's dangerous (operation could be discarded, and really they should have been, so I have a sneaking suspicion it might have been run while suppressing JIT-optimization).
- the whole thing is only done once. The worst part of that is the JIT-compilation, but there is also "turbo lag" (part of the first loop could run at a lower frequency), other start-up nonsense (extra cache misses and so on), and a semi-random number of context switches.
- from these benchmarks, it's impossible to tell how much of the time taken is due to the loop overhead.
- it's measuring a throughput but kind of implying it's a latency.
|
|
|
|
|
Thank you, Harold! I got the first points but I don't see how he's implying that it's a latency - can you elaborate on that?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Well, he doesn't really come right out and say it, but the way he puts things makes it look like it's about latency. Things like "worth the extra ticks" or "takes x ticks", none of it is actually wrong but I just get that vague sense that he doesn't really make the distinctions between how long something takes and how often you can do it in a unit of time.
|
|
|
|
|
Ah, alright. I thought I should be able to see that in the code Thank you, Harold.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|