|
Or Mod2Equals1.
Better that the method remain anonymous.
|
|
|
|
|
I use this:
private bool IsEven(int value)
{
return (value & 1) == 0;
}
So the creationist says: Everything must have a designer. God designed everything.
I say: Why is God the only exception? Why not make the "designs" (like man) exceptions and make God a creation of man?
|
|
|
|
|
|
I did this for months after I started teaching myself visual basic, I would compare boolean object properties to TRUE.
If (checkbox1.checked = true) then
Needless to say how stupid I felt when I realised what I was doing
|
|
|
|
|
Hmmm, I always thought it should be along the lines of:
private static bool isEven(int i)
{
return ((i % 1) == 0);
}
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello everyone ,
How come I still get an overflow error , yet the inpu entries are still being inserted into the database ?! I just get the exception & when I check the database all seems fine . All inputs r in their places and inserted correctly !!
J ,
|
|
|
|
|
Is that a coding horror ?
|
|
|
|
|
Even if it looks like a code horror.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I just need some help . Its been a while since im trying to figure out what the problem is :S Any appropriate forum to posy this message ?
J ,
|
|
|
|
|
It depends on the programming language you're using (we have C++, C#, VB and even Java forums). You may also as the SQL/ADO/ADO.NET forum if you feel the problem springing from the database.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
string strSql = "select a.Abr,a.Description As"+
" MaterialType,a.Description,a.code,'" + cm.ChipPath +
"'+LEFT(min(m.GraphicID),3)+'/'+min(m.GraphicID)+'.jpg' As ImgPath, " +
" Case a.PackageFlag When 'Y' Then '<a href=# "
+"onclick=javascript:window.open(&#39;/Page/ShowPackageDetails.aspx"
"?PK='+a.Abr+'&#39;,&#39;Package&#39;,&#39;resizable=no,scrollbars=no,width=1000,height=730,left=50,top=50&#39;);>'" +
"+a.Description+'</a>' Else a.Description End As MaterialTypeLink " +
" from Material_Type a "
. . .
OK how do you like this: JavaScript in SQL?
|
|
|
|
|
Where is the horror?
Is it opening a new window in SQL?
*jaans
|
|
|
|
|
Yea.. but its javascript!
|
|
|
|
|
Tadas Budvytis wrote: OK how do you like this: JavaScript in SQL?
where is the BEEF
I don't see any horror adding JS in sql, but again I don't know the output. I have added js to a code generation. That way I don't have to mack off with the output at the UI level.
Yusuf
|
|
|
|
|
I agree completely. String substitution in SQL is pretty stupid (it's not very good at string manipulation), non-parameterized SQL queries are very stupid as they're easily subjected to SQL Injection attacks, and both together (and there's a third language here as well, HTML) is just confusing as all hell.
I'd split this up into only retrieving actual values from SQL Server using parameterized queries, writing a real JavaScript function that calls window.open , then writing formatted string code to generate the HTML to call the JavaScript function passing the parameters, and passing that through an HTML/XML entity encoding routine where that turns out to be necessary.
As it is, that's an unmaintainable mess.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
public bool CheckValue(int first, int second)
{
if(first > second)
return true;
else
return false;
}
Folks like this way because it is better than the following way?
return first > second;
modified on Friday, May 30, 2008 1:36 PM
|
|
|
|
|
CheckValue.
I'd also recommend
public bool IsFirstGreaterThanSecond(int nFirst, int nSecond)
{
..
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
Donate to help Conquer Cancer[ ^]
|
|
|
|
|
That is legit. The VB to VB.Net migration tool and the VB.Net to C# translation tool did it, so it must be so.
|
|
|
|
|
che3358 wrote: is better than
Certainly not better, but even MS presenters will do that because it matches what they're saying*.
Unfortunately the newbies in the crowd get the idea that it is the proper way to write it.
It's part of why I voted "Microsoft" to this week's poll.
* That's an assumption, but I saw it several times during the VS 2008 {launch} event, I cringed every time.
|
|
|
|
|
che3358 wrote: Folks like this way because it is better than the following way?
It's a bit easier to set a breakpoint on, is it not? Further, such code may appear in cases where (1) it had at some point been necessary to do more on the 'true' or 'false' case than is now necessary, or (2) it will likely in future be necessary to do more on the 'true' or 'false' cases than is now necessary.
|
|
|
|
|
As someone said before me, it's easier to debug, but I think this is just lack of experience in its best .
I had my share of awkward code (true horror when compared to this) when I was junior programmer .
|
|
|
|
|
It may be a bit more verbose, but it's also easily understandable. The generated code may perhaps be less then optimal, but it would be a good candidate for examining the disassemblies to see if any optimisation occurs there.
Even without optimisation this should have little impact unless this method is called very often. So for me it comes down to a readability versus efficiency choice and obviously the tastes are quite different there.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
love the sig!
WarePhreak
Programmers are tools to convert caffiene to code.
|
|
|
|
|
Thanks. I just wonder where all this will end. Today there are many more users, but they have even less knowledge than many users in 'the good old days'. But that does not keep them from thinking that everything can be done with the wave of a hand. Perhaps some already think that you need some kind of mystic powers to get those machines going
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
What I find even worse are some of those same users who have some "tool" (i.e. Access) that they believe makes them a programmer. And then you look at what they've done and it is magic it even works.
WarePhreak
Programmers are tools to convert caffiene to code.
|
|
|
|