|
Why can't not ONE of you folkes be grown up enough to simply say that the rubbish:
://it checks if it contains 11 char (dd/MMM/yyyy)
if (Convert.ToInt16(chkdate.Length.ToString()) != 11)
{
// Do something if not.
}
SHOULD be:
:// it checks if it contains 11 char (dd/MMM/yyyy)
if (chkdate.Length != 11)
{
// Do something if not.
}
How hard can it be?
It's OK to pinpoint bad code like that but it's not OK not to come up with a useable alternative.
Michael M., mm it-consult dk.
|
|
|
|
|
Michael Mogensen wrote: Why can't not ONE of you folkes be grown up enough to simply say...
Michael,
Is your sense of humor having a bad day?
But if we are geting serious, I'd like to point out that your question contains a double negative and means the opposite of your apparent intended meaning.
|
|
|
|
|
Pete O`Hanlon wrote: :
<br />
if (Convert.ToInt16(chkdate.Length.ToString()) != 11)<br />
{<br />
return false;<br />
}<br />
Shouldn't the comparison do this?
<br />
if (chkdate.Length.ToString() != "11")<br />
|
|
|
|
|
...Double negative... I give up... SS... forget it...
Not beeing 100% into C# (I'm c/cpp) I suppose that this issue is something in the area of 'to get the types right' right? (ough double 'right' ... sorry)
If this is string: chkdate, then this is int: chkdate.length and then I compare 11 to int which is ok, or?
Michael M., mm it-consult dk.
|
|
|
|
|
Michael,
I'm far from 100% into C#, like you, I'm a c/c++ guy. (We still have lots of stuff that's says it's c++ but it's mostly old style C).
Anyway, this is an issue of getting the types right. And I was just being a smart alec.
-- Tony
|
|
|
|
|
i am doing a proj to implement quantum encryption in a vb appln. i just need a best algorithm for doin that.. pls help me soon as my proj dates are coming closer....
Thank u,
Freak8802
|
|
|
|
|
FREAK8802 wrote: implement quantum encryption in a vb appln
I think you are going to need a very small chisel and hammer.
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
No need. All VB apps are quantum encrypted anyway.
Or did I mean 'a quantity of cr*p'?
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
|
|
|
|
|
FREAK8802 wrote: proj dates are coming closer
don't worry, quantum encryption runs at the speed of light.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi. Tell you what, you tell me the secret password, the number I'm thinking of and 1 valid reason why I should give this information to you from THIS forum, and I'll oblige.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Tell you what, you tell me the secret password
cheesynipple
Pete O`Hanlon wrote: the number I'm thinking of
42
Pete O`Hanlon wrote: and 1 valid reason why I should give this information to you from THIS forum
I'll give you a free pie
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
The Undefeated wrote: I'll give you a free pie
that won't cut it, IMO Pete wants a waffle, but I know you ran out.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
The Undefeated wrote: cheesynipple
That's so gross - BTW that's the counter reply to cheesynipple.
The Undefeated wrote: 42
Correct.
The Undefeated wrote: I'll give you a free pie
Now, had you said you'd give me two free pies or one waffle and you would have got the code for free.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The Undefeated wrote: Pete O`Hanlon wrote:
the number I'm thinking of
42
Like there is another number
codito ergo sum
|
|
|
|
|
Quantum cryptography makes use of light waves and optical fibers. Firing up Visual Basic 1.0 isn't going to get you there.
Suggestion: Get a flashlight and manually flip the light on and off (1 for on, 0 for off).
ROFLOLMFAO
|
|
|
|
|
|
Once you get some code written, modify your your post and add some code so your post will be in the proper forum.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Although I also have a hard time taking this seriously, here goes a shot at a serious answer. Quantum Cryptography usually signifies two things, as far as current tech allows: (1) generating truly random numbers, via Quant. Phys.; (2) sending keys securely, by using quantum physics to recognize a tap on the line. MagiQ sells VPN hardware that does both of these things. Their RNG alone creates up to 100 unpredictable keys a second.
So, what do you need to do? Get some of that hardware. Write VB wrappers around all pertinent API functions. Generate keys with the Quantum RNG, and use them with a good encryption algorithm, like AES. If you are transmitting data, send it using Public Key cryptography, with at least the private keys generated from the quantum hardware. You can do the key-exchange part over quantum hardware, to detect taps. Operator should be notified if line is breached regularly. Just be sure to ask MagiQ (or the other unknown one) for technical documentation, to be sure this would work. Oh yeah, if you build a VB Quantum CryptoAPI, I will be expecting a free copy.
-Nick P.
|
|
|
|
|
I hate posting this, since probably 85% of general population actually love using #if and #ifdef and even see that's the only easy way to do "cross-platform". I don't, BTW.
Here is my gripe.
One #if is fine. Nested #if is nasty (I've seen #if else nested 8 level deep, with structures whose definition has more #if in it).
Problem is #if begets another #if. I work in a company that has at least 90 conditional compile flags set into either makefile or command line. BTW, my Unix terminal has to scroll 4 pages for the complete build commands (and yes, mostly are the -D define flag). The worst part is the flags are peppered all over the code, maybe 2 millions LOC. And nobody bothers to consolidate them.
I've seen a Linux distro that has parts of files that is different between platform stored in different directory. I couldn't remember what the Linux flavor was. They choose between target sources in makefile, instead of in the code. And the differences are stored in different dirs for ex. /x86 /alpha /risc, and these files have exactly same files with different content.
I think this is a much more cleaner and maintainable approach. The key is to identify what would be different and consolidate it in one area.
Any other ideas?
|
|
|
|
|
crewchill wrote: I've seen #if else nested 8 level deep, with structures whose definition has more #if in it
Well, that would certainly be a programming horror. Please, feel free to post it up so that we can all gasp in dismay and horror at the sheer beastly inhumanity of it.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Then you have for every platform own code, which will do the same. One change and you work in every file. I hate nested #if but this seems not to be better.
I try to be prepared for this via structuring classes for use with or without API and MFC.
Greetings from Germany
|
|
|
|
|
I Have put on hold certan project, i am using nested #if. I am using for a feature and permision to be build or not. I chose this aprouach, so it woudnt be hacked.
Also an option to hardcode a connection string, or specificy manul.
Another reason i have chosen is because i wanted to make open source, so if someone woud modify, then they coud get direct database accsess.
But i have put it on hold, Because i am doing asp.net version, And when it will be finished, i woud have appropriate schema. The way it is currently progresing, i think i won't need nested #if statments, Instead if i woud put script betwen application and server.
|
|
|
|
|
I maintain a thin client which was originally designed for Symbol Series 3000 DOS-based handheld computers. Over time it's been ported to desktop Windows (for testing), Palm (for Symbol's relatively short-lived Palm devices with integrated scanners), other DOS-based handhelds and a variety of Windows CE and Pocket PC-based devices.
The device-specific stuff tended to be implemented originally with #ifdefs but where possible I've replaced that with separate implementations, where the code needed to be completely different. In some places, I've replaced platform defines with feature defines, and added a configuration header which sets the feature defines up appropriately per-platform (unfortunately Microsoft C 6.0 . Finally, to try to keep the number of builds manageable, in some places I've used dynamic loading on CE using LoadLibrary/GetProcAddress to detect whether a feature is supported. This can happen if you're trying to use some manufacturer-specific APIs, for example we try to determine whether a Symbol MC3000 has full waveform-audio support or simply a beeper. The waveform-audio version supports the beeper API but with a significant amount of latency, so we use our own waveform-generator where possible (and of course it's necessary on the non-Symbol devices anyway).
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
can't you just replace a nested if with case statement in many cases?
|
|
|
|
|
It's not nested if... it's nested #if.
And the reason they have to do #if, is that in certain platform the function or even the structure protected inside the #if is not available (not compiled).
|
|
|
|