|
I think you're missing
G.TextRenderingHint = TextRenderingHint.AntiAlias;
/ravi
|
|
|
|
|
That's *much* better. Thanks!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
NP! If you'd like to take advantage of Cleartype (at the expense of a slight performance hit), use ClearTypeGridFit . This is the highest quality mode.
/ravi
|
|
|
|
|
Hello i want to remove a item from datagridcombocell which is use on another row in same cell like this
when i select qw2120 so on next row it will not display the same item on combo cell
how its possible?
|
|
|
|
|
what command use to export the rtf to html with already embedded image
|
|
|
|
|
|
sorry, I'll find out, as I do not speak English, will be a bit time consuming, rsrsr
know the answer if there is any way to convert this project to pascal (Delphi)?
Grateful Renivaldo Silva.
|
|
|
|
|
What project?? Any conversion you do to Pascal or Delphi is going to have to be done by hand.
|
|
|
|
|
|
No compilers, brains only.
double result = 0;
for (double d = 1; d <= 3d; d += 0.25d)
{
result += Math.Round(d);
}
What is result?
Regards,
Rob Philpott.
|
|
|
|
|
18.0
Becasue:
Math.Round, MSDN:
"Rounds a decimal value to the nearest integer, and rounds midpoint values to the nearest even number (example)."
So it will add
1
1
2
2
2
2
2
3
3
==
18
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Outstanding! Full marks Mr. Griff.
I was hoping someone would fall into my trap. As if.
Regards,
Rob Philpott.
|
|
|
|
|
I did - many years ago!
And I try not to make the same mistake twice.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
That's not a trap, this is a trap:
double result = 0.0;
for (double d = 1.0; d <= 3.0; d += 0.25)
{
result += (d + 9007199254740992.0) - 9007199254740992.0;
}
|
|
|
|
|
Ok, I'm going to have a go.
That number looks like a very specific constant, but one I admittedly don't recognise. I've used Calc.exe to tell me what is in hex, and its 14 digits. I'm going to assume doubles have a 14 byte mantissa and a 2 byte exponent.
First thing that springs to mind is unchecked . Could we be looking at a run time error?
Or, infinity? The loop I suspect makes no difference.
Is infinity - infinity zero? Probably NaN.
Can I have a 50/50?
NaN. Final answer.
Regards,
Rob Philpott.
|
|
|
|
|
You .. fell into your own trap.
The result is still 18.0, for the same reason why it's the answer to your challenge. Except now the round is done by "adding just enough to push the fraction bits out of the significant".
|
|
|
|
|
Very good!
Regards,
Rob Philpott.
|
|
|
|
|
How to send mail through c# code for each rows in a table
vidhyan
|
|
|
|
|
|
string body;
body ="anydata";
IDataReader dr = Databaseobject.ExecuteReader("Procedure_Name", CommandType.StoredProcedure, ref ret);
while (dr.Read())
{
body = body+ "," + "\n" + "any data if we want " + dr["column Name"].ToString() + "," + "\n" + ",any data if we want " + dr["column_Name"].ToString() + "\n";
}
obj.Mailto = "to id";
obj.Mailbcc = clientemail.ToString();
obj.MailSubject = "write subject";
obj.MailPriorityis = "write priority";
string mailBody = "data:--- " + body + "," + "\n" + + "\n" + "Date & Time:--- " + Convert.ToString(DateTime.Now);
obj.Mailbody = mailBody;
obj.Sendmail();
if u want in tablar formate use StringBuilder
|
|
|
|
|
I have a mini macro language for my application. Something along the lines of:
"Blah -- [SomeTag:SomeParam=SomeValue] -- Blah. Blah, Blah : [SomeTag2:SomeParam2=SomeValue2]"
So, my current implementation parses the string every time my method gets called, does error checking every time, etc. I parse the string with Regex group matching and then do a String.Replace() on the string to replace the macros with the resolved macro strings.
I get called many times with the same format string, but different parameters.
It doesn't really make sense to parse and error check, etc. every time. That'll be a performance hit. Especially with Regex.
How do people typically "compile" the string for tasks like this?
My first idea was to parse and error check the string the first time and replace the macros with a compact fixed string. For example, in the case above, the first time I would compile to:
"Blah -- $A1 -- Blah. Blah, Blah : $B1"
Then I would know that command $A1 means do SomeTag in SomeParam=SomeValue mode. $A2 would mean do SomeTag in SomeParam=SomeValue2 mode. SomeTag2 would be $B1, etc.
This would save me the regex and error checking every time. I would still have to do String.Replace() of course...
The tag operations are not static constants BTW, they come from various places.
Any other ideas?
|
|
|
|
|
SledgeHammer01 wrote: Any other ideas?
My first thought was to try holding onto the Regex rather than throwing it out -- saving time by using more space -- but I tried a couple of small experiments and I didn't see how it would help.
What is "Blah"? If it is a command, with only limited domain, then you could at least make an enumeration and only parse it once, sort of what I did for my CommScript[^] .
|
|
|
|
|
In it's simplest form of explanation, I'm just trying to expand "complex" macros in a string.
For example, say the caller calls me with "My dogs' name is $[User:Dog]". I need to return "My dogs' name is Spot".
I can have simple macros like $[DateTime] or more "complex" macros like $[User:Fullname=true].
I'm already caching the Regex object to save on the Regex engine having to parse the expression every time.
My other idea besides the $A1 / $B2 thing was to maybe on the first parse to build a string for a C# method like:
static void DummyFunc(User user)
{
return String.Format("My dogs' name is {0} and today is {1}.", user.DogName, DateTime.Now);
}
and compile it into a temp assembly. Or to do something similar using expression trees. My first thought went to the generating C# code at runtime and compiling it because doing something like this with expression trees is a big ol' PITA since I would need to call a bunch of functions to expand all the macros available.
|
|
|
|
|
Got bored waiting for your reply to my reply lol, so I tried my generating C# code at runtime and compiling into a temp in-memory assembly and creating a cached delegate to the compiled method. Works like a charm. The code is pretty gangster too ! This is what the XML serializer does I believe.
|
|
|
|
|
It sounds almost like you want to write your own DSL for this. Our very own Sacha Barber wrote a very interesting article about this[^] very topic.
|
|
|
|